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'" }