Skip to content

Commit

Permalink
chore: linux update script improvements (#978)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rolznz authored Jan 17, 2025
1 parent c133cdc commit 39a0fce
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions scripts/linux-x86_64/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 39a0fce

Please sign in to comment.