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!" |