fix: install script
added dynamic backup folder (fixed #79) changed if statements
This commit is contained in:
43
install.sh
43
install.sh
@@ -64,9 +64,9 @@ if [ ! -f $envFile ]; then
|
||||
|
||||
while true; do
|
||||
if [ -z "$comment" ]; then
|
||||
printf "Value for $key - $comment (default: $default_value"
|
||||
else
|
||||
printf "Value for $key (default: $default_value"
|
||||
else
|
||||
printf "Value for $key - $comment (default: $default_value"
|
||||
fi
|
||||
if [ -n "$regex" ]; then
|
||||
printf ", must match: %s" "$regex"
|
||||
@@ -113,27 +113,12 @@ LOG_PATH=$(grep -E '^LOG_PATH=' $envFile | cut -d= -f2)
|
||||
if [ -z "$LOG_PATH" ]; then
|
||||
echo "LOG_PATH not found in .env using default $(pwd)/logs"
|
||||
LOG_PATH=$(pwd)/logs
|
||||
else
|
||||
LOG_PATH=Docker/$LOG_PATH
|
||||
fi
|
||||
mkdir -p $LOG_PATH
|
||||
echo "Created logs folder at $LOG_PATH"
|
||||
|
||||
###########################################################################
|
||||
|
||||
echo -e "\n\n"
|
||||
echo "Start containers with docker compose up -d? [y/N]"
|
||||
read -r start_containers
|
||||
if [[ "$start_containers" =~ ^[Yy]$ ]]; then
|
||||
cd Docker
|
||||
docker compose up -d
|
||||
echo "Containers started."
|
||||
else
|
||||
echo "You can start them manually with: docker compose up -d"
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
|
||||
echo -e "\n\n"
|
||||
echo "Setup Crontab for automatic logout, backup and holiday creation? [y/N]"
|
||||
read -r setup_cron
|
||||
@@ -146,13 +131,20 @@ if [[ "$setup_cron" =~ ^[Yy]$ ]]; then
|
||||
|
||||
POSTGRES_DB=$(grep -E '^POSTGRES_DB=' $envFile | cut -d= -f2)
|
||||
if [ -z "$POSTGRES_DB" ]; then
|
||||
echo "arbeitszeitmessung not found in .env using default arbeitszeitmessung"
|
||||
echo "POSTGRES_DB not found in .env using default arbeitszeitmessung"
|
||||
POSTGRES_DB="arbeitszeitmessung"
|
||||
fi
|
||||
|
||||
BACKUP_FOLDER=$(grep -E '^BACKUP_FOLDER=' $envFile | cut -d= -f2)
|
||||
if [ -z "$BACKUP_FOLDER" ]; then
|
||||
echo "BACKUP_FOLDER not found in .env using default $(pwd)/backup"
|
||||
BACKUP_FOLDER="$(pwd)/backup"
|
||||
fi
|
||||
|
||||
sed -i "s/__PORT__/$WEB_PORT/" $autoHolidaysScript
|
||||
sed -i "s/__PORT__/$WEB_PORT/" $autoLogoutScript
|
||||
sed -i "s/__DATABASE__/$POSTGRES_DB/" $autoBackupScript
|
||||
sed -i "s/__BACKUP_FOLDER__/$BACKUP_FOLDER" $autoBackupScript
|
||||
|
||||
chmod +x $autoBackupScript $autoHolidaysScript $autoLogoutScript
|
||||
|
||||
@@ -184,3 +176,18 @@ if [[ "$setup_cron" =~ ^[Yy]$ ]]; then
|
||||
else
|
||||
echo "Please setup cron manually by executing crontab -e and adding all files from inside the Cron directory!"
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
|
||||
echo -e "\n\n"
|
||||
echo "Start containers with docker compose up -d? [y/N]"
|
||||
read -r start_containers
|
||||
if [[ "$start_containers" =~ ^[Yy]$ ]]; then
|
||||
cd Docker
|
||||
docker compose up -d
|
||||
echo "Containers started."
|
||||
else
|
||||
echo "You can start them manually with: docker compose up -d"
|
||||
fi
|
||||
|
||||
echo "Installation finished, you can re-run the script any time!"
|
||||
|
||||
Reference in New Issue
Block a user