From 777f30b769934b549c8815b75699f438fc6c7483 Mon Sep 17 00:00:00 2001 From: mbugeia Date: Fri, 23 Oct 2015 16:24:30 +0200 Subject: [PATCH] Add set -e and proper path check --- scripts/backup | 2 ++ scripts/install | 8 ++++---- scripts/restore | 2 ++ scripts/upgrade | 2 ++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/backup b/scripts/backup index c0a1e25..5e7bb8b 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,4 +1,6 @@ #!/bin/bash + +set -e app=kanboard # The parameter $1 is the backup directory location diff --git a/scripts/install b/scripts/install index e36b41c..c7748ba 100644 --- a/scripts/install +++ b/scripts/install @@ -1,4 +1,6 @@ #!/bin/bash + +set -e app=kanboard # Retrieve arguments @@ -10,10 +12,8 @@ admin=$3 email=$(sudo yunohost user info $admin | grep mail: | sed "s/mail: //g") # Check domain/path availability -sudo yunohost app checkurl $domain$path -a $app -if [[ ! $? -eq 0 ]]; then - exit 1 -fi +sudo yunohost app checkurl $domain$path -a $app \ + || (echo "Path not available: $domain$path" && exit 1) # Generate random password db_pwd=$(openssl rand -hex 15) diff --git a/scripts/restore b/scripts/restore index 34e8abf..42db852 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,4 +1,6 @@ #!/bin/bash + +set -e app=kanboard # The parameter $1 is the uncompressed restore directory location diff --git a/scripts/upgrade b/scripts/upgrade index b9b40e8..a916d82 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,4 +1,6 @@ #!/bin/bash + +set -e app=kanboard # Retrieve settings