Commit e7b60410 authored by Mikhail Tergoev's avatar Mikhail Tergoev

added branches

parent 013eab8e
......@@ -1355,20 +1355,31 @@ pw_init_db () {
# SCRIPTS UPDATE
pw_port_update () {
case "$BRANCH" in
master|stable)
BRANCH_VERSION="SCRIPTS_STABLE_VERSION"
BRANCH="master"
;;
devel|beta)
BRANCH_VERSION="SCRIPTS_NEXT_VERSION"
BRANCH="devel"
;;
esac
if [ ! -f "${PORT_WINE_TMP_PATH}/scripts_ver" ] ; then
echo "2024" > "${PORT_WINE_TMP_PATH}/scripts_ver"
fi
scripts_install_ver=$(head -n 1 "${PORT_WINE_TMP_PATH}/scripts_ver")
print_info "Check update..."
if curl -f -s --list-only --connect-timeout 3 "https://gitlab.eterfund.ru/Castro-Fidel/PortWINE/raw/master/data_from_portwine/scripts/var" > "${PORT_WINE_TMP_PATH}/curent_var_ver"
if curl -f -s --list-only --connect-timeout 3 "https://gitlab.eterfund.ru/Castro-Fidel/PortWINE/raw/${BRANCH}/data_from_portwine/scripts/var" > "${PORT_WINE_TMP_PATH}/curent_var_ver"
then
URL_FOR_CHANGELOG="https://gitlab.eterfund.ru/Castro-Fidel/PortWINE/raw/master/data_from_portwine"
URL_TO_PW_MASTER="https://gitlab.eterfund.ru/Castro-Fidel/PortWINE/-/archive/master/PortWINE-master.tar.gz"
URL_FOR_CHANGELOG="https://gitlab.eterfund.ru/Castro-Fidel/PortWINE/raw/${BRANCH}/data_from_portwine"
URL_TO_PW_BRANCH="https://gitlab.eterfund.ru/Castro-Fidel/PortWINE/-/archive/${BRANCH}/PortWINE-${BRANCH}.tar.gz"
else
if curl -f -s --list-only --connect-timeout 3 "https://raw.githubusercontent.com/Castro-Fidel/PortWINE/master/data_from_portwine/scripts/var" > "${PORT_WINE_TMP_PATH}/curent_var_ver"
if curl -f -s --list-only --connect-timeout 3 "https://raw.githubusercontent.com/Castro-Fidel/PortWINE/${BRANCH}/data_from_portwine/scripts/var" > "${PORT_WINE_TMP_PATH}/curent_var_ver"
then
URL_FOR_CHANGELOG="https://raw.githubusercontent.com/Castro-Fidel/PortWINE/master/data_from_portwine"
URL_TO_PW_MASTER="https://github.com/Castro-Fidel/PortWINE/archive/refs/heads/master.tar.gz"
URL_FOR_CHANGELOG="https://raw.githubusercontent.com/Castro-Fidel/PortWINE/${BRANCH}/data_from_portwine"
URL_TO_PW_BRANCH="https://github.com/Castro-Fidel/PortWINE/archive/refs/heads/${BRANCH}.tar.gz"
else
print_error "Unable to determine the version on the server. Skip it..."
return 1
......@@ -1378,7 +1389,7 @@ pw_port_update () {
[[ ! -f "${PORT_WINE_TMP_PATH}/scripts_update_notifier" ]] && echo "1" > "${PORT_WINE_TMP_PATH}/scripts_update_notifier"
read "scripts_update_not" < "${PORT_WINE_TMP_PATH}/scripts_update_notifier"
if [[ "${scripts_update_not}" == "1" ]] ; then
scripts_current_ver=$(grep "SCRIPTS_NEXT_VERSION" "${PORT_WINE_TMP_PATH}/curent_var_ver" | awk -F "=" '{print $2}')
scripts_current_ver=$(grep "$BRANCH_VERSION" "${PORT_WINE_TMP_PATH}/curent_var_ver" | awk -F "=" '{print $2}')
print_info "Scripts version in git = ${scripts_current_ver}"
print_info "Scripts version local = ${scripts_install_ver}"
if [[ ! -z "${scripts_current_ver}" ]] && [[ "${scripts_current_ver}" -gt "${scripts_install_ver}" ]] ; then
......@@ -1412,18 +1423,18 @@ pw_port_update () {
"$(gettext "UPDATING NOW")")
echo "######################################################"
print_info "Update scripts..."
try_remove_file "${PORT_WINE_TMP_PATH}/PortWINE-master.tar.gz"
if try_download "${URL_TO_PW_MASTER}" "${PORT_WINE_TMP_PATH}/PortWINE-master.tar.gz" no_mirror ; then
if unpack "${PORT_WINE_TMP_PATH}/PortWINE-master.tar.gz" "${PORT_WINE_TMP_PATH}"
try_remove_file "${PORT_WINE_TMP_PATH}/PortWINE-${BRANCH}.tar.gz"
if try_download "${URL_TO_PW_BRANCH}" "${PORT_WINE_TMP_PATH}/PortWINE-${BRANCH}.tar.gz" no_mirror ; then
if unpack "${PORT_WINE_TMP_PATH}/PortWINE-${BRANCH}.tar.gz" "${PORT_WINE_TMP_PATH}"
then
create_new_dir "${PORT_WINE_TMP_PATH}/scripts_backup"
cd "${PORT_WINE_PATH}/data/" || fatal
tar -czpf "${PORT_WINE_TMP_PATH}/scripts_backup/scripts_v.${scripts_install_ver}.tar.gz" \
./scripts ./img/gui ./locales ./themes ./changelog* ./dxvk.conf ./vkBasalt.conf ./tmp/scripts_ver
try_remove_dir "${PORT_WINE_PATH}/data/scripts/"
cp -fr "${PORT_WINE_TMP_PATH}/PortWINE-master/data_from_portwine/"* "${PORT_WINE_PATH}/data/"
try_remove_file "${PORT_WINE_TMP_PATH}/PortWINE-master.tar.gz"
try_remove_dir "${PORT_WINE_TMP_PATH}/PortWINE-master/"
cp -fr "${PORT_WINE_TMP_PATH}/PortWINE-${BRANCH}/data_from_portwine/"* "${PORT_WINE_PATH}/data/"
try_remove_file "${PORT_WINE_TMP_PATH}/PortWINE-${BRANCH}.tar.gz"
try_remove_dir "${PORT_WINE_TMP_PATH}/PortWINE-${BRANCH}/"
echo "${scripts_current_ver}" > "${PORT_WINE_TMP_PATH}/scripts_ver"
echo "Restarting PP after update..."
unset SKIP_CHECK_UPDATES
......@@ -5002,10 +5013,10 @@ export -f change_loc
change_mirror () {
if [[ "$MIRROR" == "CDN" ]] ; then
sed -i 's/="CDN"/="GITHUB"/g' "$USER_CONF"
yad_info "$(gettext "Mirror changed to:") GITHUB"
yad_info "$(gettext "Mirror changed to:") <b>GITHUB</b>"
else
sed -i 's/="GITHUB"/="CDN"/g' "$USER_CONF"
yad_info "$(gettext "Mirror changed to:") CDN"
yad_info "$(gettext "Mirror changed to:") <b>CDN</b>"
fi
print_info "Restarting PP for change mirror..."
export SKIP_CHECK_UPDATES=1
......@@ -5014,6 +5025,24 @@ change_mirror () {
}
export -f change_mirror
change_branch () {
if [[ "$BRANCH" == "master" ]] ; then
sed -i 's/="master"/="devel"/g' "$USER_CONF"
if [[ "$MIRROR" != "GITHUB" ]] ; then
sed -i 's/="CDN"/="GITHUB"/g' "$USER_CONF"
fi
export MIRROR="GITHUB"
yad_info "$(gettext "Branch changed to:") <b>DEVEL</b>"
else
sed -i 's/="devel"/="master"/g' "$USER_CONF"
yad_info "$(gettext "Branch changed to:") <b>STABLE</b>"
fi
print_info "Restarting PP for change branch..."
/usr/bin/env bash -c ${pw_full_command_line[*]} &
exit 0
}
export -f change_branch
change_gui_start () {
if [[ "$PW_GUI_START" == "NOTEBOOK" ]] ; then
sed -i 's/="NOTEBOOK"/="PANED"/g' "$USER_CONF"
......
......@@ -171,27 +171,39 @@ else
echo 'export GUI_THEME="default"' >> "$USER_CONF"
fi
# choose branch
if [[ -z "$BRANCH" ]] ; then
echo 'export BRANCH="master"' >> "$USER_CONF"
export BRANCH="master"
fi
if [[ "$BRANCH" == "master" ]]
then print_info "Branch in used: STABLE\n"
else print_warning "Branch in used: DEVEL\n"
fi
# choose mirror
if [[ -z "$MIRROR" ]] \
&& [[ "$LANGUAGE" == "ru" ]]
&& [[ "$LANGUAGE" == "ru" ]] \
&& [[ "$BRANCH" != "devel" ]]
then
echo 'export MIRROR="CDN"' >> "$USER_CONF"
export MIRROR="CDN"
MIRROR="CDN"
elif [[ -z "$MIRROR" ]] ; then
echo 'export MIRROR="GITHUB"' >> "$USER_CONF"
export MIRROR="GITHUB"
MIRROR="GITHUB"
fi
export MIRROR
print_info "The first mirror in used: $MIRROR\n"
if [[ "${INSTALLING_PORT}" == 1 ]] ; then
return 0
fi
# choose gui start
case "$PW_GUI_START" in
PANED) : ;;
NOTEBOOK) : ;;
*)
PANED|NOTEBOOK) : ;;
*)
sed -i '/export PW_GUI_START=/d' "$USER_CONF"
echo 'export PW_GUI_START="NOTEBOOK"' >> "$USER_CONF"
export PW_GUI_START="NOTEBOOK"
......@@ -560,9 +572,9 @@ else
else NEW_MIRROR="CDN"
fi
if [[ "$PW_GUI_START" == "NOTEBOOK" ]]
then NEW_PW_GUI_START="PANED"
else NEW_PW_GUI_START="NOTEBOOK"
if [[ "$BRANCH" == "master" ]]
then NEW_BRANCH="DEVEL"
else NEW_BRANCH="STABLE"
fi
orig_IFS="$IFS" && IFS=$'\n'
......@@ -603,6 +615,7 @@ else
--field=" Xterm"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"":"FBTN" '@bash -c "button_click pw_start_cont_xterm"' \
--field=" $(gettext "Credits")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"":"FBTN" '@bash -c "button_click gui_credits"' \
--field=" $(gettext "Change mirror to") $NEW_MIRROR"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"":"FBTN" '@bash -c "button_click change_mirror"' \
--field=" $(gettext "Change branch to") $NEW_BRANCH"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"":"FBTN" '@bash -c "button_click change_branch"' \
--field=" $(gettext "Change start gui")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"":"FBTN" '@bash -c "button_click change_gui_start"' \
2>/dev/null &
......@@ -767,6 +780,7 @@ fi
open_changelog) open_changelog ;;
change_loc) change_loc ;;
change_mirror) change_mirror ;;
change_branch) change_branch ;;
change_gui_start) change_gui_start ;;
118) gui_edit_db ;;
120) gui_vkbasalt ;;
......
#!/usr/bin/env bash
#Author: Castro-Fidel (linux-gaming.ru)
#SCRIPTS_NEXT_VERSION=2316
#SCRIPTS_STABLE_VERSION=2316
#SCRIPTS_NEXT_VERSION=2317
#SCRIPTS_STABLE_VERSION=2317
########################################################################
export LANGUAGES_LIST="ru es"
export PW_VKBASALT="0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment