From 33559bb84433b4ca78959c40a5de46444f5f6dc3 Mon Sep 17 00:00:00 2001 From: Teal Dulcet Date: Thu, 21 Dec 2023 07:02:42 -0800 Subject: [PATCH] Fixed SC2164: Use 'cd ... || exit' in case cd fails. --- setup/bootstrap.sh | 2 +- setup/nextcloud.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/bootstrap.sh b/setup/bootstrap.sh index 8824afe2..ace51879 100644 --- a/setup/bootstrap.sh +++ b/setup/bootstrap.sh @@ -74,7 +74,7 @@ if [ ! -d "$HOME/mailinabox" ]; then fi # Change directory to it. -cd "$HOME/mailinabox" +cd "$HOME/mailinabox" || exit # Update it. if [ "$TAG" != $(git describe --always) ]; then diff --git a/setup/nextcloud.sh b/setup/nextcloud.sh index d7b57d57..bba0ab65 100755 --- a/setup/nextcloud.sh +++ b/setup/nextcloud.sh @@ -310,7 +310,7 @@ EOF # Execute Nextcloud's setup step, which creates the Nextcloud sqlite database. # It also wipes it if it exists. And it updates config.php with database # settings and deletes the autoconfig.php file. - (cd /usr/local/lib/owncloud; sudo -u www-data php"$PHP_VER" /usr/local/lib/owncloud/index.php;) + (cd /usr/local/lib/owncloud || exit; sudo -u www-data php"$PHP_VER" /usr/local/lib/owncloud/index.php;) fi # Update config.php.