From b8b3fd1d31321a59802fd46db86053ac7a48a452 Mon Sep 17 00:00:00 2001 From: Joe Haig Date: Fri, 21 Oct 2016 22:28:00 +0100 Subject: [PATCH] Move old install directory if it exists --- installers/common.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 1d00ab80..a7dad944 100644 --- a/installers/common.sh +++ b/installers/common.sh @@ -64,9 +64,10 @@ function enable_php_lighttpd() { # Verifies existence and permissions of RaspAP directory function create_raspap_directories() { install_log "Creating RaspAP directories" - if [ ! -d "$raspap_dir" ]; then - sudo mkdir -p "$raspap_dir" || install_error "Unable to create directory '$raspap_dir'" + if [ -d "$raspap_dir" ]; then + sudo mv $raspap_dir $raspap_dir.original || install_error "Unable to move old directory out of the way" fi + sudo mkdir -p "$raspap_dir" || install_error "Unable to create directory '$raspap_dir'" sudo chown -R $raspap_user:$raspap_user "$raspap_dir" || install_error "Unable to change file ownership for '$raspap_dir'" }