Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- pid=
- tmpd=
- tidyUp()
- {
- # Clean up when we're done
- exec 3>&-
- [[ -n "$tmpd" ]] && rm -rf "$tmpd"
- }
- trap 'ss=$?; tidyUp; exit $ss' 1 2 15
- updateGauge()
- {
- local percent="$1" message="$2"
- printf "XXX\n%d\n%s\nXXX\n" $percent "$message" >&3
- }
- # Create the FIFO for communicating with the whiptail gauge
- tmpd=$(mktemp --tmpdir --directory "wt.XXXXXXXXXX")
- mkfifo "$tmpd/fifo"
- cd $tmpd
- # Start up the whiptail gauge and associate FD 3 with its status
- whiptail --title 'Progress meter' --gauge 'Starting examples' 6 50 0 <"$tmpd/fifo" &
- exec 3>"$tmpd/fifo"
- # Real code starts here
- percent=0
- for example in 1 2 3
- do
- updateGauge $percent "Getting example $example"
- mkdir -p ~/.steam/compatibilitytools.d;
- PROTONVERSIONNUMBER=$(curl -v --silent https://api.github.com/repos/popsUlfr/Proton/releases 2>&1 | grep "tag_name" | head -n 1 | cut -f4,4 -d"\"");
- REPLACING=$(curl -v --silent https://api.github.com/repos/popsUlfr/Proton/releases 2>&1 | grep "target_commitish" | head -n 1 | cut -f4,4 -d"\"" | sed "s/[^_]\+/\L\u&/g");
- PROTONVERSION=${REPLACING/_G/-6_G};
- PROTONNAME=$PROTONVERSION"_"${PROTONVERSIONNUMBER##*-};
- wget https://github.com/popsUlfr/Proton/releases/download/$PROTONVERSIONNUMBER/$PROTONNAME.tar.xz;
- percent=$((percent + 20))
- done
- for another in 4 5
- do
- updateGauge $percent "Doing work for another example $another"
- pv $PROTONNAME.tar.xz | tar xp -J -C ~/.steam/compatibilitytools.d
- percent=$((percent + 20))
- done
- # Done
- echo "done"
- sleep 5
- echo "closing"
- tidyUp
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement