You didn't ask me, but it seems unnecessary to sudo so many times in your curl|bash setup, doubly so when the user could be prompted for their sudo password without one shred of context what is being sudo-ed
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 page
Since 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
:wave: Hi. Thanks for taking a look. Yeah, lots of things to improve. What gets me about this script is the the if/else would read better as a case statement. Chalk it up to a small team spending a lot of time re-architecting part of a commercial product out so we could open source it. We wanted to develop in the open and that meant shipping something.
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.
Comments
You didn't ask me, but it seems unnecessary to sudo so many times in your curl|bash setup, doubly so when the user could be prompted for their sudo password without one shred of context what is being sudo-ed
could easily be 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 :)
:wave: Hi. Thanks for taking a look. Yeah, lots of things to improve. What gets me about this script is the the if/else would read better as a case statement. Chalk it up to a small team spending a lot of time re-architecting part of a commercial product out so we could open source it. We wanted to develop in the open and that meant shipping something.
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.
Thanks for the feedback! https://github.com/daytonaio/daytona/pull/105