Commit ec6718d9 authored by Mikhail Tergoev's avatar Mikhail Tergoev

Merge branch 'Htylol-added-skip-updates' into devel

parents b6a50b90 ab4510aa
...@@ -560,7 +560,9 @@ debug_timer () { ...@@ -560,7 +560,9 @@ debug_timer () {
END=$(date +%s%N) END=$(date +%s%N)
DIFF=$((($END - $START)/1000000)) DIFF=$((($END - $START)/1000000))
if [[ -n "$2" ]] ; then if [[ -n "$2" ]] ; then
if [[ "$2" != "-s" ]] ; then
print_warning "It took $DIFF milliseconds for $2" print_warning "It took $DIFF milliseconds for $2"
fi
else else
print_warning "It took $DIFF milliseconds" print_warning "It took $DIFF milliseconds"
fi fi
...@@ -1566,22 +1568,107 @@ pw_port_update () { ...@@ -1566,22 +1568,107 @@ 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=$(head -n 1 "${PORT_WINE_TMP_PATH}/scripts_ver") 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"
pw_check_update () {
debug_timer --start
if ! timeout 3 curl -f -s --list-only "$URL_ETERFUND" > "${PORT_WINE_TMP_PATH}/curent_var_ver"
then
print_warning "https://gitlab.eterfund.ru/ broken. Skip it..."
UPDATE_SKIP_ETERFUND="1"
fi
debug_timer --end -s
UPDATE_ETERFUND="$DIFF"
debug_timer --start
if ! timeout 3 curl -f -s --list-only "$URL_GITHUB" > "${PORT_WINE_TMP_PATH}/curent_var_ver"
then
print_warning "https://raw.githubusercontent.com/ broken. Skip it..."
UPDATE_SKIP_GITHUB="1"
fi
debug_timer --end -s
UPDATE_GITHUB="$DIFF"
if [[ "$UPDATE_SKIP_ETERFUND" == "1" ]] \
&& [[ "$UPDATE_SKIP_GITHUB" == "1" ]] ; then
print_error "Unable to determine the version on the server. Skip it..."
return 1
fi
PW_UPDATE_ALL_LIST=($UPDATE_ETERFUND $UPDATE_GITHUB)
UPDATE_MIN=${PW_UPDATE_ALL_LIST[0]}
for i in "${!PW_UPDATE_ALL_LIST[@]}"; do
if (( ${PW_UPDATE_ALL_LIST[$i]} < UPDATE_MIN )) ; then
UPDATE_MIN=${PW_UPDATE_ALL_LIST[$i]}
fi
done
UPDATE_DAYS=$(date +%-j)
UPDATE_MINUTES=$(($(date +%-H) * 60 + $(date +%-M)))
if [[ "$UPDATE_ETERFUND" == "$UPDATE_MIN" ]] ; then
print_info "Selected https://gitlab.eterfund.ru/"
echo "$UPDATE_DAYS $UPDATE_MINUTES UPDATE_ETERFUND $UPDATE_MINUTES" > "${PORT_WINE_TMP_PATH}/update_skip_mirror"
UPDATE_URL_MIRROR="UPDATE_ETERFUND"
elif [[ "$UPDATE_GITHUB" == "$UPDATE_MIN" ]] ; then
print_info "Selected https://raw.githubusercontent.com/"
echo "$UPDATE_DAYS $UPDATE_MINUTES UPDATE_GITHUB $UPDATE_MINUTES" > "${PORT_WINE_TMP_PATH}/update_skip_mirror"
UPDATE_URL_MIRROR="UPDATE_GITHUB"
fi
}
if [[ ! -f "${PORT_WINE_TMP_PATH}/update_skip_mirror" ]] ; then
pw_check_update
else
CHECK_UPDATE_MIRROR=$(<"${PORT_WINE_TMP_PATH}/update_skip_mirror")
UPDATE_SKIP_DAYS="$(echo "${CHECK_UPDATE_MIRROR}" | awk -F" " '{print $1}')"
UPDATE_DATE_MIRROR="$(echo "${CHECK_UPDATE_MIRROR}" | awk -F" " '{print $2}')"
UPDATE_SKIP_DATE="$(echo "${CHECK_UPDATE_MIRROR}" | awk -F" " '{print $4}')"
UPDATE_DAYS=$(date +%-j)
UPDATE_MINUTES=$(($(date +%-H) * 60 + $(date +%-M)))
if (( $((UPDATE_DATE_MIRROR + 360)) <= UPDATE_MINUTES )) \
|| [[ "$UPDATE_SKIP_DAYS" != "$UPDATE_DAYS" ]] \
|| [[ "$PW_FORCE_UPDATE" == "1" ]]
then
pw_check_update
fi
fi
if (( $((UPDATE_SKIP_DATE + $(((RANDOM%11)+25)) )) <= UPDATE_MINUTES )) \
|| [[ -n "$PW_UPDATE_ALL_LIST" ]] ; then
print_info "Check update..." print_info "Check update..."
if curl -f -s --list-only --max-time 3 "https://gitlab.eterfund.ru/Castro-Fidel/PortWINE/raw/${BRANCH}/data_from_portwine/scripts/var" > "${PORT_WINE_TMP_PATH}/curent_var_ver" echo ""
if [[ -z "$UPDATE_URL_MIRROR" ]] ; then
UPDATE_URL_MIRROR="$(echo "${CHECK_UPDATE_MIRROR}" | awk -F" " '{print $3}')"
sed -i 's/[0-9]*$/'"$UPDATE_MINUTES"'/' "${PORT_WINE_TMP_PATH}/update_skip_mirror"
fi
case "$UPDATE_URL_MIRROR" in
UPDATE_ETERFUND)
if [[ ! -f "${PORT_WINE_TMP_PATH}/curent_var_ver" ]] \
&& ! timeout 3 curl -f -s --list-only "$URL_ETERFUND" > "${PORT_WINE_TMP_PATH}/curent_var_ver"
then then
pw_check_update
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"
else ;;
if curl -f -s --list-only --max-time 3 "https://raw.githubusercontent.com/Castro-Fidel/PortWINE/${BRANCH}/data_from_portwine/scripts/var" > "${PORT_WINE_TMP_PATH}/curent_var_ver" UPDATE_GITHUB)
if [[ ! -f "${PORT_WINE_TMP_PATH}/curent_var_ver" ]] \
&& ! timeout 3 curl -f -s --list-only "$URL_GITHUB" > "${PORT_WINE_TMP_PATH}/curent_var_ver"
then then
pw_check_update
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
else else
print_error "Unable to determine the version on the server. Skip it..." return 0
return 1
fi
fi fi
[[ "$LANGUAGE" == ru ]] && local PW_CHANGELOG_FILE="changelog_ru" || local PW_CHANGELOG_FILE="changelog_en" [[ "$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" [[ ! -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" read "scripts_update_not" < "${PORT_WINE_TMP_PATH}/scripts_update_notifier"
...@@ -3903,7 +3990,7 @@ A brief instruction: ...@@ -3903,7 +3990,7 @@ A brief instruction:
export bool_from_yad=$(( ${bool_from_yad} + 1 )) export bool_from_yad=$(( ${bool_from_yad} + 1 ))
done done
PW_ADD_SETTINGS=$(head -n 1 "${PW_TMPFS_PATH}/tmp_output_yad_fps_limit") PW_ADD_SETTINGS=$(<"${PW_TMPFS_PATH}/tmp_output_yad_fps_limit")
PW_WINDOWS_VER="$(echo ${PW_ADD_SETTINGS} | awk -F"%" '{print $1}')" PW_WINDOWS_VER="$(echo ${PW_ADD_SETTINGS} | awk -F"%" '{print $1}')"
PW_DLL_INSTALL="$(echo ${PW_ADD_SETTINGS} | awk -F"%" '{print $2}')" PW_DLL_INSTALL="$(echo ${PW_ADD_SETTINGS} | awk -F"%" '{print $2}')"
...@@ -4450,7 +4537,7 @@ fi ...@@ -4450,7 +4537,7 @@ fi
export bool_from_yad=$(( ${bool_from_yad} + 1 )) export bool_from_yad=$(( ${bool_from_yad} + 1 ))
done done
PW_ADD_SETTINGS_DGV2=$(head -n 1 "${PW_TMPFS_PATH}/tmp_yad_dgv2_set_cb") PW_ADD_SETTINGS_DGV2=$(<"${PW_TMPFS_PATH}/tmp_yad_dgv2_set_cb")
PW_DGV2_RESOLUTION="$(echo ${PW_ADD_SETTINGS_DGV2} | awk -F"%" '{print $1}')" PW_DGV2_RESOLUTION="$(echo ${PW_ADD_SETTINGS_DGV2} | awk -F"%" '{print $1}')"
PW_DGV2_FPS_LIMIT="$(echo ${PW_ADD_SETTINGS_DGV2} | awk -F"%" '{print $2}')" PW_DGV2_FPS_LIMIT="$(echo ${PW_ADD_SETTINGS_DGV2} | awk -F"%" '{print $2}')"
...@@ -4640,7 +4727,7 @@ relaxed - Same as fifo but allows tearing when below the monitors refresh rate." ...@@ -4640,7 +4727,7 @@ relaxed - Same as fifo but allows tearing when below the monitors refresh rate."
export bool_from_yad=$(( ${bool_from_yad} + 1 )) export bool_from_yad=$(( ${bool_from_yad} + 1 ))
done done
PW_ADD_SETTINGS_GS=$(head -n 1 "${PW_TMPFS_PATH}/tmp_yad_gs_set_cb") PW_ADD_SETTINGS_GS=$(<"${PW_TMPFS_PATH}/tmp_yad_gs_set_cb")
PW_GS_SHOW_RESOLUTION="$(echo ${PW_ADD_SETTINGS_GS} | awk -F"%" '{print $1}')" PW_GS_SHOW_RESOLUTION="$(echo ${PW_ADD_SETTINGS_GS} | awk -F"%" '{print $1}')"
PW_GS_INTERNAL_RESOLUTION="$(echo ${PW_ADD_SETTINGS_GS} | awk -F"%" '{print $2}' | tr ',' '.')" PW_GS_INTERNAL_RESOLUTION="$(echo ${PW_ADD_SETTINGS_GS} | awk -F"%" '{print $2}' | tr ',' '.')"
...@@ -4742,7 +4829,7 @@ gui_userconf () { ...@@ -4742,7 +4829,7 @@ gui_userconf () {
gui_open_user_conf gui_open_user_conf
;; ;;
166) 166)
PW_ADD_SETTINGS_UC=$(head -n 1 "${PW_TMPFS_PATH}/tmp_yad_userconf_set_cb") PW_ADD_SETTINGS_UC=$(<"${PW_TMPFS_PATH}/tmp_yad_userconf_set_cb")
PW_GPU_USE="$(echo ${PW_ADD_SETTINGS_UC} | awk -F"%" '{print $1}')" PW_GPU_USE="$(echo ${PW_ADD_SETTINGS_UC} | awk -F"%" '{print $1}')"
PW_SOUND_DRIVER_USE="$(echo ${PW_ADD_SETTINGS_UC} | awk -F"%" '{print $2}')" PW_SOUND_DRIVER_USE="$(echo ${PW_ADD_SETTINGS_UC} | awk -F"%" '{print $2}')"
GUI_THEME="$(echo ${PW_ADD_SETTINGS_UC} | awk -F"%" '{print $3}')" GUI_THEME="$(echo ${PW_ADD_SETTINGS_UC} | awk -F"%" '{print $3}')"
...@@ -5502,6 +5589,7 @@ gui_rm_portproton () { ...@@ -5502,6 +5589,7 @@ gui_rm_portproton () {
export -f gui_rm_portproton export -f gui_rm_portproton
gui_pw_update () { gui_pw_update () {
export PW_FORCE_UPDATE="1"
try_remove_file "${PORT_WINE_TMP_PATH}/scripts_update_notifier" try_remove_file "${PORT_WINE_TMP_PATH}/scripts_update_notifier"
print_info "Restarting PP for check update..." print_info "Restarting PP for check update..."
unset SKIP_CHECK_UPDATES unset SKIP_CHECK_UPDATES
......
...@@ -162,7 +162,7 @@ export urlg="https://linux-gaming.ru/portproton/" ...@@ -162,7 +162,7 @@ export urlg="https://linux-gaming.ru/portproton/"
export url_cloud="https://cloud.linux-gaming.ru/portproton" export url_cloud="https://cloud.linux-gaming.ru/portproton"
export PW_WINELIB="${PORT_WINE_TMP_PATH}/libs${PW_LIBS_VER}" 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="$(head -n 1 "${PORT_WINE_TMP_PATH}/PortProton_ver")" install_ver="$(<"${PORT_WINE_TMP_PATH}/PortProton_ver")"
export install_ver export 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"
...@@ -299,7 +299,6 @@ if [[ "${SKIP_CHECK_UPDATES}" != 1 ]] ; then ...@@ -299,7 +299,6 @@ if [[ "${SKIP_CHECK_UPDATES}" != 1 ]] ; then
PW_SCREEN_RESOLUTION="$(<"${PW_TMPFS_PATH}/xrandr.tmp" sed -rn 's/^.*primary.* ([0-9]+x[0-9]+).*$/\1/p')" PW_SCREEN_RESOLUTION="$(<"${PW_TMPFS_PATH}/xrandr.tmp" sed -rn 's/^.*primary.* ([0-9]+x[0-9]+).*$/\1/p')"
PW_SCREEN_PRIMARY="$(grep -e 'primary' "${PW_TMPFS_PATH}/xrandr.tmp" | awk '{print $1}')" PW_SCREEN_PRIMARY="$(grep -e 'primary' "${PW_TMPFS_PATH}/xrandr.tmp" | awk '{print $1}')"
export PW_SCREEN_PRIMARY PW_SCREEN_RESOLUTION export PW_SCREEN_PRIMARY PW_SCREEN_RESOLUTION
echo ""
print_var PW_SCREEN_RESOLUTION PW_SCREEN_PRIMARY print_var PW_SCREEN_RESOLUTION PW_SCREEN_PRIMARY
else else
print_error "xrandr - broken!" print_error "xrandr - broken!"
...@@ -349,7 +348,7 @@ if [[ "${SKIP_CHECK_UPDATES}" != 1 ]] ; then ...@@ -349,7 +348,7 @@ if [[ "${SKIP_CHECK_UPDATES}" != 1 ]] ; then
PW_FILESYSTEM=$(stat -f -c %T "${PORT_WINE_PATH}") PW_FILESYSTEM=$(stat -f -c %T "${PORT_WINE_PATH}")
export PW_FILESYSTEM export PW_FILESYSTEM
else else
scripts_install_ver=$(head -n 1 "${PORT_WINE_TMP_PATH}/scripts_ver") scripts_install_ver=$(<"${PORT_WINE_TMP_PATH}/scripts_ver")
export scripts_install_ver export scripts_install_ver
fi fi
......
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