mirror of
https://github.com/the-sane/lug-helper.git
synced 2024-12-29 07:24:18 +00:00
Kill only the curl spawned by the helper. More referral codes.
This commit is contained in:
parent
5a00c74ddc
commit
86604f2b7d
@ -819,19 +819,23 @@ runner_install() {
|
|||||||
debug_echo continue "Downloading $runner_dl_url into $tmp_dir/$runner_file..."
|
debug_echo continue "Downloading $runner_dl_url into $tmp_dir/$runner_file..."
|
||||||
if [ "$has_zen" -eq 1 ]; then
|
if [ "$has_zen" -eq 1 ]; then
|
||||||
# Format the curl progress bar for zenity
|
# Format the curl progress bar for zenity
|
||||||
cd "$tmp_dir" && curl -#LO "$runner_dl_url" 2>&1 | \
|
mkfifo "$tmp_dir/lugpipe"
|
||||||
stdbuf -oL tr '\r' '\n' | stdbuf -oL grep -ve "100" | stdbuf -oL grep -o "[0-9]*\.[0-9]" | \
|
cd "$tmp_dir" && curl -#LO "$runner_dl_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 'killall curl' ERR
|
trap 'kill "$curlpid"' ERR
|
||||||
zenity --progress --auto-close --title="Star Citizen LUG Helper" --text="Downloading Runner. This might take a moment.\n" 2>/dev/null
|
zenity --progress --auto-close --title="Star Citizen LUG Helper" --text="Downloading Runner. This might take a moment.\n" 2>/dev/null
|
||||||
)
|
)
|
||||||
|
|
||||||
if [ "$?" -eq 1 ]; then
|
if [ "$?" -eq 1 ]; then
|
||||||
# User clicked cancel
|
# User clicked cancel
|
||||||
debug_echo continue "Download aborted. Removing $tmp_dir/$runner_file..."
|
debug_echo continue "Download aborted. Removing $tmp_dir/$runner_file..."
|
||||||
rm "$tmp_dir/$runner_file"
|
rm "$tmp_dir/$runner_file"
|
||||||
|
rm "$tmp_dir/lugpipe"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
rm "$tmp_dir/lugpipe"
|
||||||
else
|
else
|
||||||
# Standard curl progress bar
|
# Standard curl progress bar
|
||||||
(cd "$tmp_dir" && curl -LO "$runner_dl_url")
|
(cd "$tmp_dir" && curl -LO "$runner_dl_url")
|
||||||
@ -1031,7 +1035,7 @@ runner_manage() {
|
|||||||
# Get a random Penguin's Star Citizen referral code
|
# Get a random Penguin's Star Citizen referral code
|
||||||
referral_randomizer() {
|
referral_randomizer() {
|
||||||
# Populate the referral codes array
|
# Populate the referral codes array
|
||||||
referral_codes=("STAR-4TZD-6KMM" "STAR-4XM2-VM99" "STAR-2NPY-FCR2" "STAR-T9Z9-7W6P" "STAR-VLBF-W2QR" "STAR-BYR6-YHMF" "STAR-3X2H-VZMX" "STAR-BRWN-FB9T" "STAR-FG6Y-N4Q4" "STAR-VLD6-VZRG" "STAR-T9KF-LV77" "STAR-4XHB-R7RF" "STAR-9NVF-MRN7" "STAR-3Q4W-9TC3" "STAR-3SBK-7QTT")
|
referral_codes=("STAR-4TZD-6KMM" "STAR-4XM2-VM99" "STAR-2NPY-FCR2" "STAR-T9Z9-7W6P" "STAR-VLBF-W2QR" "STAR-BYR6-YHMF" "STAR-3X2H-VZMX" "STAR-BRWN-FB9T" "STAR-FG6Y-N4Q4" "STAR-VLD6-VZRG" "STAR-T9KF-LV77" "STAR-4XHB-R7RF" "STAR-9NVF-MRN7" "STAR-3Q4W-9TC3" "STAR-3SBK-7QTT" "STAR-XFBT-9TTK" "STAR-F3H9-YPHN" "STAR-BYK6-RCCL" "STAR-XCKH-W6T7")
|
||||||
# Pick a random array element. Scale a floating point number for
|
# Pick a random array element. Scale a floating point number for
|
||||||
# a more random distribution than simply calling RANDOM
|
# a more random distribution than simply calling RANDOM
|
||||||
random_code="${referral_codes[$(awk '{srand($2); print int(rand()*$1)}' <<< "${#referral_codes[@]} $RANDOM")]}"
|
random_code="${referral_codes[$(awk '{srand($2); print int(rand()*$1)}' <<< "${#referral_codes[@]} $RANDOM")]}"
|
||||||
|
Loading…
Reference in New Issue
Block a user