by mdaniel · 2y ago · 0 comments
sudo curl $DOWNLOAD_URL -Lo daytona
sudo mv daytona /usr/local/bin/daytona
sudo chmod +x /usr/local/bin/daytona
could easily be curl -fsSLo daytona "$DOWNLOAD_URL"
chmod +x daytona
if [ -d $HOME/.local/bin ]; then
mv daytona $HOME/.local/bin
elif [ $EUID == 0 ] && [ -d /usr/local/bin ]; then
mv daytona /usr/local/bin/
elif [ $EUID == 0 ] && [ -d /opt/bin ]; then
mv daytona /opt/bin/
else
echo 'Using sudo to relocate the binary to "/usr/local/bin"' >&2
sudo mv daytona /usr/local/bin/daytona
fi
and especially "curl -f for life" because there are few things more fun than chmod +x-ing an HTTP 404 response pageSince we're talking about things no one asked, it would further inspire confidence -- and also help your CDN costs! -- if they fetched from your releases page <https://github.com/daytonaio/daytona/releases>; to the best of my knowledge GH offers a "latest" URL so one need not hard-code version numbers in the shell script and at the same time says "this binary was produced from this tag" which the current shell script for sure does not. It turns out $(./daytona version) does cough up the version number but it would be more obvious if it were fetched from a release/tag URL
Thank you for attending my talk :)
Patches welcome. I'm going to be taking a pass at this script and a powershell script tomorrow. We also want to eventually get past curl and into brew/winget but we wanted to balance that with getting something out the door.
If you like packaging and scripts and want to help out we've got https://github.com/daytonaio/daytona/issues/102 tracking this at the top level.