chbrown / overdrive

Bash script to download mp3s from the OverDrive audiobook service
451 stars 66 forks source link

Added update functionality #59

Closed mgobrain closed 1 year ago

mgobrain commented 1 year ago

Added self-update functionality. overdrive.sh --update grabs the latest version from a static link, writes it to a temporary file, mirrors the permissions from the original script, then finally overwrites the original script. It is based on this question from Stack Overflow. Hope someone finds it useful, issuing the command from CLI might be easier than firing up the browser and checking GitHub for new versions.

crakerjac commented 1 year ago

How would this play for those who are running from your cloned repo here? I use git fetch/git pull to update my script... but maybe adding cron task to update would be useful for others.

mgobrain commented 1 year ago

I would say that the self updater is a complement to existing upgrade methods. If you wish to continue using the Git suite, or downloading the script directly from GitHub, those will still be available; this is just another option.

chbrown commented 1 year ago

I appreciate the interest, but I'm not going to merge this. I update this script like, twice a year? And it's liable to go completely obsolete anytime now. Besides, it's only two commands to (re)install the latest version, which is only one more than overdrive --update would be.

It is not the habit of shell scripts to tell you how to update them, much less update themselves... which seems like a security risk, especially if you set up a cronjob to do so. Periodically download code from the web that someone else owns and can change anytime, and automatically execute it? Not a good idea 😱

I might consider embedding the 2-line installation incantation in the usage string (what prints out when you call overdrive --help), but I don't know who really wants/needs that :/