chore: linux update script improvements (#978)

* chore: linux update script improvements

- 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

* fix: script dir in update.sh
This commit is contained in:
Roland 2025-01-17 13:35:13 +07:00 committed by GitHub
parent c133cdcc90
commit 39a0fce839
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,11 +10,12 @@ echo "You will have to unlock Alby Hub after the update."
echo ""
echo "Make sure you have your unlock password available and a backup of your seed."
read -p "Do you want continue? (y/n): " -n 1 -r
read -p "Do you want continue? (y/n):" -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit
fi
echo ""
sudo systemctl list-units --type=service --all | grep -Fq albyhub.service
if [[ $? -eq 0 ]]; then
@ -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=$(dirname "$(readlink -f "$0")")
read -p "Absolute install directory path (default: $SCRIPT_DIR): " USER_INSTALL_DIR
echo ""
INSTALL_DIR="${USER_INSTALL_DIR:-$SCRIPT_DIR}"
if ! test -f $INSTALL_DIR/data/nwc.db; then
echo "Could not find Alby Hub in this directory"
exit 1
fi
INSTALL_DIR="${USER_INSTALL_DIR:-$SCRIPT_DIR/albyhub}"
echo "Running in $INSTALL_DIR"
# make sure we run this in the install directory