Created
April 17, 2022 03:14
-
-
Save dwn64/68a9198b699210b3e713d7bffcb2eaf3 to your computer and use it in GitHub Desktop.
A simple shell script to check and update gallery-dl.bin from the official repository
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| curl -sSL https://api.github.com/repos/mikf/gallery-dl/releases/latest > /tmp/gallery-dl-latest-github | |
| echo 'Current gallery-dl version is v'$(/usr/local/bin/gallery-dl --version) | |
| echo 'Most recent gallery-dl version is v'$(sed -n 's/.*"tag_name": "\(.*\)",.*/\1/p'</tmp/gallery-dl-latest-github|tr -d v) | |
| read -p 'Do you want to update? [y/N] ' input | |
| case "$(echo $input| tr '[:upper:]' '[:lower:]')" in | |
| [yY]) | |
| echo 'Downloading latest version of gallery-dl...' | |
| cat /tmp/gallery-dl-latest-github|grep -e 'browser_download_url.*bin[^.]'|cut -d : -f 2,3|tr -d '" '|xargs wget -q -O /tmp/gallery-dl&&echo 'Successfully downloaded latest version of gallery-dl to /tmp/gallery-dl.' | |
| echo 'Attempting to move to /usr/local/bin/gallery-dl...'&&sudo /bin/sh -c 'mv /tmp/gallery-dl /usr/local/bin/gallery-dl&&chown root:root /usr/local/bin/gallery-dl&&chmod 755 /usr/local/bin/gallery-dl'&&echo "Successfully updated gallery-dl!" | |
| ;; | |
| *) | |
| echo 'Aborted.' | |
| ;; | |
| esac | |
| rm /tmp/gallery-dl-latest-github |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment