diff --git a/deploy.sh b/deploy.sh index 8c47f12b..1197a83a 100644 --- a/deploy.sh +++ b/deploy.sh @@ -108,7 +108,7 @@ EOF echo "LND installation and configuration completed." } -# Function to install Node.js using nvm +# Install Node.js using nvm install_nodejs() { REQUIRED_VERSION="18.0.0" if ! command -v nvm &> /dev/null; then @@ -178,6 +178,11 @@ install_lightning_pub() { exit 1 fi rm -rf lightning_pub_temp + + # Load nvm and npm + export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + cd lightning_pub npm install if [ $? -ne 0 ]; then @@ -186,7 +191,7 @@ install_lightning_pub() { fi } -# Function to create start script +# Ceate start script create_start_script() { cat < start.sh #!/bin/bash @@ -202,7 +207,6 @@ EOF echo "systemctl not available. Created start.sh. Please use this script to start the services manually." } -# Function to display animated "starting..." log display_starting_animation() { echo -n "Starting services" for i in {1..3}; do @@ -212,7 +216,7 @@ display_starting_animation() { echo } -# Function to start services +# Start services start_services() { ~/lnd/lnd & LND_PID=$! @@ -221,7 +225,7 @@ start_services() { NODE_PID=$! if [[ "$OS" == "Linux" ]]; then - if [ -x "$(command -v systemctl)" ]; then + if [ "$SYSTEMCTL_AVAILABLE" = true ]; then sudo bash -c "cat > /etc/systemd/system/lnd.service <