Commit cede8465 authored by Vladislav's avatar Vladislav

Updated updates

parent 17a2a21e
...@@ -22,11 +22,10 @@ print_wrapped () { ...@@ -22,11 +22,10 @@ print_wrapped () {
local text="$1" local text="$1"
local a="0" local a="0"
local b="$2" local b="$2"
local c="$3"
if [[ -n "$c" ]] ; then if [[ -n "$3" ]] ; then
if (( ${#text} > b )); then if (( ${#text} > b )); then
echo "${text:a:b}${c}" echo "${text:a:b}${3}"
else else
echo "$text" echo "$text"
fi fi
...@@ -1700,7 +1699,6 @@ pw_port_update () { ...@@ -1700,7 +1699,6 @@ pw_port_update () {
if [[ ! -f "${PORT_WINE_TMP_PATH}/scripts_ver" ]] ; then if [[ ! -f "${PORT_WINE_TMP_PATH}/scripts_ver" ]] ; then
echo "2024" > "${PORT_WINE_TMP_PATH}/scripts_ver" echo "2024" > "${PORT_WINE_TMP_PATH}/scripts_ver"
fi fi
scripts_install_ver=$(<"${PORT_WINE_TMP_PATH}/scripts_ver")
URL_ETERFUND="https://gitlab.eterfund.ru/Castro-Fidel/PortWINE/raw/${BRANCH}/data_from_portwine/scripts/var" URL_ETERFUND="https://gitlab.eterfund.ru/Castro-Fidel/PortWINE/raw/${BRANCH}/data_from_portwine/scripts/var"
URL_GITHUB="https://raw.githubusercontent.com/Castro-Fidel/PortWINE/${BRANCH}/data_from_portwine/scripts/var" URL_GITHUB="https://raw.githubusercontent.com/Castro-Fidel/PortWINE/${BRANCH}/data_from_portwine/scripts/var"
...@@ -1750,8 +1748,12 @@ pw_port_update () { ...@@ -1750,8 +1748,12 @@ pw_port_update () {
echo "$UPDATE_DAYS $UPDATE_MINUTES UPDATE_GITHUB $UPDATE_MINUTES" > "${PORT_WINE_TMP_PATH}/update_skip_mirror" echo "$UPDATE_DAYS $UPDATE_MINUTES UPDATE_GITHUB $UPDATE_MINUTES" > "${PORT_WINE_TMP_PATH}/update_skip_mirror"
UPDATE_URL_MIRROR="UPDATE_GITHUB" UPDATE_URL_MIRROR="UPDATE_GITHUB"
fi fi
PW_FORCE_UPDATE="1"
} }
[[ ! -f "${PORT_WINE_TMP_PATH}/scripts_update_notifier" ]] && echo "1" > "${PORT_WINE_TMP_PATH}/scripts_update_notifier"
scripts_update_not=$(<"${PORT_WINE_TMP_PATH}/scripts_update_notifier")
if [[ ! -f "${PORT_WINE_TMP_PATH}/update_skip_mirror" ]] ; then if [[ ! -f "${PORT_WINE_TMP_PATH}/update_skip_mirror" ]] ; then
pw_check_update pw_check_update
else else
...@@ -1761,16 +1763,27 @@ pw_port_update () { ...@@ -1761,16 +1763,27 @@ pw_port_update () {
UPDATE_SKIP_DATE="$(echo "${CHECK_UPDATE_MIRROR}" | awk -F" " '{print $4}')" UPDATE_SKIP_DATE="$(echo "${CHECK_UPDATE_MIRROR}" | awk -F" " '{print $4}')"
UPDATE_DAYS=$(date +%-j) UPDATE_DAYS=$(date +%-j)
UPDATE_MINUTES=$(($(date +%-H) * 60 + $(date +%-M))) UPDATE_MINUTES=$(($(date +%-H) * 60 + $(date +%-M)))
if (( $((UPDATE_DATE_MIRROR + 360)) <= UPDATE_MINUTES )) \ if [[ "${scripts_update_not}" != "0" ]] ; then
|| [[ "$UPDATE_SKIP_DAYS" != "$UPDATE_DAYS" ]] \ if (( $((UPDATE_DATE_MIRROR + 360)) <= UPDATE_MINUTES )) \
|| [[ "$PW_FORCE_UPDATE" == "1" ]] || [[ "$UPDATE_SKIP_DAYS" != "$UPDATE_DAYS" ]] \
then || [[ "$PW_FORCE_UPDATE" == "1" ]] ; then
pw_check_update pw_check_update
fi
else
if [[ "$UPDATE_SKIP_DAYS" != "$UPDATE_DAYS" ]] ; then
pw_check_update
else
return 0
fi
fi fi
fi fi
if (( $((UPDATE_SKIP_DATE + $(((RANDOM%11)+25)) )) <= UPDATE_MINUTES )) \ if (( $((UPDATE_SKIP_DATE + $(((RANDOM%11)+25)) )) <= UPDATE_MINUTES )) \
|| [[ -n "$PW_UPDATE_ALL_LIST" ]] ; then || [[ "$PW_FORCE_UPDATE" == "1" ]] \
|| [[ "${scripts_update_not}" == "2" ]] ; then
if [[ "${scripts_update_not}" == "2" ]] ; then
echo "1" > "${PORT_WINE_TMP_PATH}/scripts_update_notifier"
fi
print_info "Check update..." print_info "Check update..."
echo "" echo ""
if [[ -z "$UPDATE_URL_MIRROR" ]] ; then if [[ -z "$UPDATE_URL_MIRROR" ]] ; then
...@@ -1779,33 +1792,42 @@ pw_port_update () { ...@@ -1779,33 +1792,42 @@ pw_port_update () {
fi fi
case "$UPDATE_URL_MIRROR" in case "$UPDATE_URL_MIRROR" in
UPDATE_ETERFUND) UPDATE_ETERFUND)
if [[ ! -f "${PORT_WINE_TMP_PATH}/curent_var_ver" ]] \ if [[ ! -f "${PORT_WINE_TMP_PATH}/curent_var_ver" ]] \
&& ! timeout 2 curl -f -s --list-only "$URL_ETERFUND" > "${PORT_WINE_TMP_PATH}/curent_var_ver" && ! timeout 2 curl -f -s --list-only "$URL_ETERFUND" > "${PORT_WINE_TMP_PATH}/curent_var_ver"
then then
pw_check_update pw_check_update
fi fi
URL_FOR_CHANGELOG="https://gitlab.eterfund.ru/Castro-Fidel/PortWINE/raw/${BRANCH}/data_from_portwine" 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" URL_TO_PW_BRANCH="https://gitlab.eterfund.ru/Castro-Fidel/PortWINE/-/archive/${BRANCH}/PortWINE-${BRANCH}.tar.gz"
;; ;;
UPDATE_GITHUB) UPDATE_GITHUB)
if [[ ! -f "${PORT_WINE_TMP_PATH}/curent_var_ver" ]] \ if [[ ! -f "${PORT_WINE_TMP_PATH}/curent_var_ver" ]] \
&& ! timeout 2 curl -f -s --list-only "$URL_GITHUB" > "${PORT_WINE_TMP_PATH}/curent_var_ver" && ! timeout 2 curl -f -s --list-only "$URL_GITHUB" > "${PORT_WINE_TMP_PATH}/curent_var_ver"
then then
pw_check_update pw_check_update
fi fi
URL_FOR_CHANGELOG="https://raw.githubusercontent.com/Castro-Fidel/PortWINE/${BRANCH}/data_from_portwine" 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" URL_TO_PW_BRANCH="https://github.com/Castro-Fidel/PortWINE/archive/refs/heads/${BRANCH}.tar.gz"
;; ;;
esac esac
else else
return 0 return 0
fi fi
[[ "$LANGUAGE" == ru ]] && local PW_CHANGELOG_FILE="changelog_ru" || local PW_CHANGELOG_FILE="changelog_en" scripts_current_ver=$(grep "$BRANCH_VERSION_UPDATE" "${PORT_WINE_TMP_PATH}/curent_var_ver" | awk -F "=" '{print $2}')
[[ ! -f "${PORT_WINE_TMP_PATH}/scripts_update_notifier" ]] && echo "1" > "${PORT_WINE_TMP_PATH}/scripts_update_notifier" if [[ ! -f "${PORT_WINE_TMP_PATH}/update_remind_later" ]] ; then
read "scripts_update_not" < "${PORT_WINE_TMP_PATH}/scripts_update_notifier" echo "$scripts_current_ver" > "${PORT_WINE_TMP_PATH}/update_remind_later"
if [[ "${scripts_update_not}" == "1" ]] ; then else
scripts_current_ver=$(grep "$BRANCH_VERSION_UPDATE" "${PORT_WINE_TMP_PATH}/curent_var_ver" | awk -F "=" '{print $2}') PW_REMIND_LATER=$(<"${PORT_WINE_TMP_PATH}/update_remind_later")
if [[ $PW_REMIND_LATER != "$scripts_current_ver" ]] ; then
echo "2" > "${PORT_WINE_TMP_PATH}/scripts_update_notifier"
echo "$scripts_current_ver" > "${PORT_WINE_TMP_PATH}/update_remind_later"
scripts_update_not=$(<"${PORT_WINE_TMP_PATH}/scripts_update_notifier")
fi
fi
if [[ "${scripts_update_not}" == [12] ]] ; then
[[ "$LANGUAGE" == ru ]] && local PW_CHANGELOG_FILE="changelog_ru" || local PW_CHANGELOG_FILE="changelog_en"
print_info "Scripts version in git = ${scripts_current_ver}" print_info "Scripts version in git = ${scripts_current_ver}"
print_info "Scripts version local = ${scripts_install_ver}" print_info "Scripts version local = ${scripts_install_ver}"
if [[ -n "${scripts_current_ver}" ]] && [[ "${scripts_current_ver}" -gt "${scripts_install_ver}" ]] ; then if [[ -n "${scripts_current_ver}" ]] && [[ "${scripts_current_ver}" -gt "${scripts_install_ver}" ]] ; then
...@@ -1832,8 +1854,10 @@ pw_port_update () { ...@@ -1832,8 +1854,10 @@ pw_port_update () {
# --button="${translations[EXIT]}"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"":252 \ # --button="${translations[EXIT]}"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"":252 \
case "${YAD_STATUS}" in try_remove_file "${PORT_WINE_TMP_PATH}/curent_var_ver"
1|252) exit 0 ;;
case ${YAD_STATUS} in
1|252) echo "2" > "${PORT_WINE_TMP_PATH}/scripts_update_notifier" && exit 0 ;;
16) xcsd="${translations[DO NOT REMIND ME]}" ;; 16) xcsd="${translations[DO NOT REMIND ME]}" ;;
18) xcsd="${translations[REMIND ME LATER]}" ;; 18) xcsd="${translations[REMIND ME LATER]}" ;;
20) xcsd="${translations[UPDATING NOW]}" ;; 20) xcsd="${translations[UPDATING NOW]}" ;;
...@@ -1864,14 +1888,12 @@ pw_port_update () { ...@@ -1864,14 +1888,12 @@ pw_port_update () {
yad_error_download && pw_port_update || exit 1 yad_error_download && pw_port_update || exit 1
fi ;; fi ;;
"${translations[REMIND ME LATER]}") "${translations[REMIND ME LATER]}")
echo " " ;; echo "2" > "${PORT_WINE_TMP_PATH}/scripts_update_notifier" ;;
"${translations[DO NOT REMIND ME]}") "${translations[DO NOT REMIND ME]}")
echo "0" > "${PORT_WINE_TMP_PATH}/scripts_update_notifier" ;; echo "0" > "${PORT_WINE_TMP_PATH}/scripts_update_notifier" ;;
esac esac
fi fi
fi fi
export scripts_install_ver
try_remove_file "${PORT_WINE_TMP_PATH}/curent_var_ver"
return 0 return 0
} }
...@@ -5761,6 +5783,7 @@ change_branch () { ...@@ -5761,6 +5783,7 @@ change_branch () {
pw_notify_send -i info \ pw_notify_send -i info \
"${translations[Branch changed to:]}" "<b>DEVEL</b>" "${translations[Branch changed to:]}" "<b>DEVEL</b>"
unset SKIP_CHECK_UPDATES unset SKIP_CHECK_UPDATES
export PW_FORCE_UPDATE="1"
fi fi
else else
if yad_question "${translations[Do you actually want to change the scripts version to:]} <b>STABLE?</b>" ; then if yad_question "${translations[Do you actually want to change the scripts version to:]} <b>STABLE?</b>" ; then
...@@ -5770,6 +5793,7 @@ change_branch () { ...@@ -5770,6 +5793,7 @@ change_branch () {
pw_notify_send -i info \ pw_notify_send -i info \
"${translations[Branch changed to:]}" "<b>STABLE</b>" "${translations[Branch changed to:]}" "<b>STABLE</b>"
unset SKIP_CHECK_UPDATES unset SKIP_CHECK_UPDATES
export PW_FORCE_UPDATE="1"
fi fi
fi fi
print_info "Restarting PP for change branch..." print_info "Restarting PP for change branch..."
......
...@@ -169,7 +169,7 @@ export PW_WINELIB="${PORT_WINE_TMP_PATH}/libs${PW_LIBS_VER}" ...@@ -169,7 +169,7 @@ export PW_WINELIB="${PORT_WINE_TMP_PATH}/libs${PW_LIBS_VER}"
try_remove_dir "${PW_WINELIB}/var" try_remove_dir "${PW_WINELIB}/var"
install_ver="$(<"${PORT_WINE_TMP_PATH}/PortProton_ver")" install_ver="$(<"${PORT_WINE_TMP_PATH}/PortProton_ver")"
export install_ver export install_ver
scripts_install_ver=$(<"${PORT_WINE_TMP_PATH}/scripts_ver") scripts_install_ver="$(<"${PORT_WINE_TMP_PATH}/scripts_ver")"
export scripts_install_ver export scripts_install_ver
export WINETRICKS_DOWNLOADER="curl" export WINETRICKS_DOWNLOADER="curl"
export USER_CONF="${PORT_WINE_PATH}/data/user.conf" export USER_CONF="${PORT_WINE_PATH}/data/user.conf"
......
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