mirror of
https://github.com/the-sane/lug-helper.git
synced 2024-12-28 16:24:21 +00:00
Fix merge goof
This commit is contained in:
parent
8167ae9a40
commit
c20e91e1e8
@ -1112,6 +1112,7 @@ download_file() {
|
|||||||
download_url="${1// /%20}"
|
download_url="${1// /%20}"
|
||||||
download_filename="$2"
|
download_filename="$2"
|
||||||
download_type="$3"
|
download_type="$3"
|
||||||
|
echo "DEBUG: $download_url"
|
||||||
|
|
||||||
# Download the item to the tmp directory
|
# Download the item to the tmp directory
|
||||||
debug_print continue "Downloading $download_url into $tmp_dir/$download_filename..."
|
debug_print continue "Downloading $download_url into $tmp_dir/$download_filename..."
|
||||||
@ -1140,47 +1141,6 @@ download_file() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download a file to the tmp directory
|
|
||||||
# Expects two arguments, the download URL and the file name
|
|
||||||
download_file() {
|
|
||||||
# This function expects two string arguments
|
|
||||||
if [ "$#" -lt 2 ]; then
|
|
||||||
printf "\nScript error: The download_file function expects two arguments. Aborting.\n"
|
|
||||||
read -n 1 -s -p "Press any key..."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Capture the arguments
|
|
||||||
download_url="$1"
|
|
||||||
download_filename="$2"
|
|
||||||
|
|
||||||
# Download the item to the tmp directory
|
|
||||||
debug_print continue "Downloading $download_url into $tmp_dir/$download_filename..."
|
|
||||||
if [ "$use_zenity" -eq 1 ]; then
|
|
||||||
# Format the curl progress bar for zenity
|
|
||||||
mkfifo "$tmp_dir/lugpipe"
|
|
||||||
cd "$tmp_dir" && curl -#LO "$download_url" > "$tmp_dir/lugpipe" 2>&1 & curlpid="$!"
|
|
||||||
stdbuf -oL tr '\r' '\n' < "$tmp_dir/lugpipe" | \
|
|
||||||
grep --line-buffered -ve "100" | grep --line-buffered -o "[0-9]*\.[0-9]" | \
|
|
||||||
(
|
|
||||||
trap 'kill "$curlpid"' ERR
|
|
||||||
zenity --progress --auto-close --title="Star Citizen LUG Helper" --text="Downloading ${download_type}. This might take a moment.\n" 2>/dev/null
|
|
||||||
)
|
|
||||||
|
|
||||||
if [ "$?" -eq 1 ]; then
|
|
||||||
# User clicked cancel
|
|
||||||
debug_print continue "Download aborted. Removing $tmp_dir/$download_filename..."
|
|
||||||
rm --interactive=never "${tmp_dir:?}/$download_filename"
|
|
||||||
rm --interactive=never "${tmp_dir:?}/lugpipe"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
rm --interactive=never "${tmp_dir:?}/lugpipe"
|
|
||||||
else
|
|
||||||
# Standard curl progress bar
|
|
||||||
(cd "$tmp_dir" && curl -LO "$download_url")
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Detect which version of Lutris is running and restart it
|
# Detect which version of Lutris is running and restart it
|
||||||
lutris_restart() {
|
lutris_restart() {
|
||||||
# Detect the installed versions of Lutris
|
# Detect the installed versions of Lutris
|
||||||
|
Loading…
Reference in New Issue
Block a user