Commit cede8465 authored by Vladislav's avatar Vladislav

Updated updates

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