added branches

This commit is contained in:
Mikhail Tergoev
2024-07-14 13:41:52 +03:00
parent 013eab8e11
commit e7b604109e
3 changed files with 69 additions and 26 deletions

View File

@ -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"