-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: linux update script improvements #978
Conversation
rolznz
commented
Jan 12, 2025
- add missing newlines
- use pwd to get current absolute directory, remove /albyhub suffix
- add file check to test if user is running in correct directory
- add missing newlines - use pwd to get current absolute directory, remove /albyhub suffix - add file check to test if user is running in correct directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would need to be changed in the other install scripts, too.
scripts/linux-x86_64/update.sh
Outdated
@@ -28,10 +29,17 @@ then | |||
pkill -f albyhub | |||
fi | |||
|
|||
SCRIPT_DIR=$(dirname "$0") | |||
read -p "Absolute install directory path (default: $SCRIPT_DIR/albyhub): " USER_INSTALL_DIR | |||
SCRIPT_DIR=$(pwd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is wrong. pwd
gives you the current directory. so for example:
I am in /home/foo
(cd /home/foo
) the update.sh
is in /home/bar/update.sh
.
If I now run /home/bar/update.sh
the /home/foo
directory will be used. which is wrong.
you need to have the directory of the script here.
maybe we can also remove this and always expect that update.sh is in the install directory. (as we write it also during installation)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, thanks. I was wrong, and your SCRIPT_DIR change works in all console environments I tested.
So:
- change
SCRIPT_DIR
toSCRIPT_DIR=$(dirname "$(readlink -f "$0")");
- keep removal of
/albyhub
inINSTALL_DIR
(to me it seems wrong it is appended)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if I can follow.
it needs to be in sync with what we do here: https://github.com/getAlby/hub/blob/master/scripts/linux-x86_64/install.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think any changes need to be made in the install script.
We just need to make sure the update script runs in the correct folder.
- The SCRIPT_DIR change above ensures that it picks the folder of the executing update script, as an absolute path rather than a relative one:
SCRIPT_DIR=$(dirname "$(readlink -f "$0")");
- I think the
/albyhub
suffix has always been a bug and is just ignores that it cannot CD into a non-existent albyhub folder.
+
we have the small addition to check if we are in the right folder before proceeding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will apply the fix only to this install script for now. The other 2 install scripts are at least specified for RPI (which I do not this is right, at least the arm64 one) and expect the script is run from within the albyhub directory.
I will make a new issue to review that and reference this PR.