Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add extra .env exist check to install.sh (#414)

Leendert de Borst79f4749869e5
diff --git a/install.sh b/install.sh
index aeeb55e73..ce432945c 100755
--- a/install.sh
+++ b/install.sh
@@ -502,28 +502,28 @@ handle_install() {
return
fi
- # Check for existing version
- local current_version=""
- if grep -q "^ALIASVAULT_VERSION=" "$ENV_FILE"; then
- current_version=$(grep "^ALIASVAULT_VERSION=" "$ENV_FILE" | cut -d '=' -f2)
- printf "${CYAN}> Current AliasVault version: ${current_version}${NC}\n"
- printf "${YELLOW}> AliasVault is already installed.${NC}\n"
- printf "1. To reinstall the current version (${current_version}), continue with this script\n"
- printf "2. To check for updates and to install the latest version, use: ./install.sh update\n"
- printf "3. To install a specific version, use: ./install.sh install <version>\n"
- printf "\n"
+ # Check if .env exists before reading
+ if [ -f "$ENV_FILE" ]; then
+ if grep -q "^ALIASVAULT_VERSION=" "$ENV_FILE"; then
+ current_version=$(grep "^ALIASVAULT_VERSION=" "$ENV_FILE" | cut -d '=' -f2)
+ printf "${CYAN}> Current AliasVault version: ${current_version}${NC}\n"
+ printf "${YELLOW}> AliasVault is already installed.${NC}\n"
+ printf "1. To reinstall the current version (${current_version}), continue with this script\n"
+ printf "2. To check for updates and to install the latest version, use: ./install.sh update\n"
+ printf "3. To install a specific version, use: ./install.sh install <version>\n\n"
+
+ read -p "Would you like to reinstall the current version? [y/N]: " REPLY
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
+ printf "${YELLOW}> Installation cancelled.${NC}\n"
+ exit 0
+ fi
- read -p "Would you like to reinstall the current version? [y/N]: " REPLY
- if [[ ! $REPLY =~ ^[Yy]$ ]]; then
- printf "${YELLOW}> Installation cancelled.${NC}\n"
- exit 0
+ handle_install_version "$current_version"
+ return
fi
-
- handle_install_version "$current_version"
- else
- # First time installation, use latest
- handle_install_version "latest"
fi
+
+ handle_install_version "latest"
}
# Function to handle build