Scripts version 2183

This commit is contained in:
Mikhail Tergoev
2023-05-15 02:19:05 +03:00
parent 866bda3e0c
commit d982c8fab3
12 changed files with 77 additions and 53 deletions

View File

@ -105,7 +105,7 @@ export -f check_process
try_download () {
PW_DOWNLOAD_FILE_NAME="$(basename $1)"
set -o pipefail
wget -O "$2" --read-timeout 300 --retry-connrefused --timeout 15 --tries 2 \
wget -O "$2" --read-timeout 300 --retry-connrefused --timeout 4 --tries 2 --no-dns-cache --no-cache \
--user-agent="Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)" "${1}" 2>&1 | \
tr '\r' '\n' | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9,.]\+.\) \(.*\)/\1\n#Downloading at \1\/, \2\/s, ETA \3/; s/^20[0-9][0-9].*/#Done./' | \
zenity --progress --percentage=0 --title="Download ${PW_DOWNLOAD_FILE_NAME}" --text=Starting... --auto-close --width=500 --height=90
@ -113,10 +113,10 @@ try_download () {
print_error "Failed to download ${PW_DOWNLOAD_FILE_NAME} from GitHub."
print_info "Try download ${PW_DOWNLOAD_FILE_NAME} from FTP"
try_remove_file "$2"
wget -O "$2" --read-timeout 300 --retry-connrefused --timeout 15 --tries 2 \
wget -O "$2" --read-timeout 300 --retry-connrefused --timeout 4 --tries 2 --no-dns-cache --no-cache \
--user-agent="Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)" --ftp-user=anonymous "ftp://171.22.215.18/archives/${PW_DOWNLOAD_FILE_NAME}" 2>&1 | \
tr '\r' '\n' | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9,.]\+.\) \(.*\)/\1\n#Downloading at \1\/, \2\/s, ETA \3/; s/^20[0-9][0-9].*/#Done./' | \
zenity --progress --percentage=0 --title="Download ${PW_DOWNLOAD_FILE_NAME}" --text=Starting... --auto-close --width=500 --height=90
zenity --progress --percentage=0 --title="Try download ${PW_DOWNLOAD_FILE_NAME} from FTP" --text=Starting... --auto-close --width=500 --height=90
if [ "${PIPESTATUS[0]}" != 0 ] ; then
print_error "Failed to download ${PW_DOWNLOAD_FILE_NAME} from FTP."
try_remove_file "$2"
@ -129,7 +129,7 @@ try_download () {
try_download_to_path () {
set -o pipefail
wget --directory-prefix="$2" --read-timeout 300 --retry-connrefused --timeout 15 --tries 3 \
wget --directory-prefix="$2" --read-timeout 300 --retry-connrefused --timeout 4 --tries 2 --no-dns-cache --no-cache \
--user-agent="Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)" "$1" 2>&1 | \
tr '\r' '\n' | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9,.]\+.\) \(.*\)/\1\n#Downloading at \1\/, \2\/s, ETA \3/; s/^20[0-9][0-9].*/#Done./' | \
zenity --progress --percentage=0 --title="Download $(basename $1)" --text=Starting... --auto-close --width=500 --height=90
@ -142,7 +142,7 @@ try_download_to_path () {
}
try_download_silent () {
wget -O "$2" --read-timeout 300 --retry-connrefused --timeout 15 --tries 3 \
wget -O "$2" --read-timeout 300 --retry-connrefused --timeout 4 --tries 2 --no-dns-cache --no-cache \
--user-agent="Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)" "$1"
if [ "${PIPESTATUS[0]}" != 0 ] ; then
print_error "Failed to download $1. Skipping."