diff --git a/installers/common.sh b/installers/common.sh index bd389178..abd7e7d9 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -638,12 +638,19 @@ function _download_latest_files() { exit 1 fi + if [ "$upgrade" == 1 ] || [ "$update" == 1 ]; then + if [ -d "$source_dir/plugins" ]; then + find "$source_dir/plugins" -mindepth 1 -maxdepth 1 -type d ! -name '.git*' -exec rm -rf {} + 2>/dev/null + fi + fi + if [ -d "$webroot_dir" ] && [ "$update" == 0 ]; then sudo mv $webroot_dir "$webroot_dir.`date +%F-%R`" || _install_status 1 "Unable to move existing webroot directory" elif [ "$upgrade" == 1 ] || [ "$update" == 1 ]; then exclude='--exclude=ajax/system/sys_read_logfile.php' shopt -s extglob - sudo find "$webroot_dir" ! -path "${webroot_dir}/ajax/system/sys_read_logfile.php" -delete 2>/dev/null + sudo find "$webroot_dir" -mindepth 1 ! -path "${webroot_dir}/ajax" ! -path "${webroot_dir}/ajax/*" ! -path "${webroot_dir}/plugins" ! -path "${webroot_dir}/plugins/*" -delete 2>/dev/null + sudo find "$webroot_dir/ajax" ! -path "${webroot_dir}/ajax/system/sys_read_logfile.php" -delete 2>/dev/null fi _install_log "Installing application to $webroot_dir" @@ -652,7 +659,7 @@ function _download_latest_files() { if [ "$update" == 1 ]; then _install_log "Applying existing configuration to ${webroot_dir}/includes" sudo mv /tmp/config.php $webroot_dir/includes || _install_status 1 "Unable to move config.php to ${webroot_dir}/includes" - + if [ -f /tmp/raspap.auth ]; then _install_log "Applying existing authentication file to ${raspap_dir}" sudo mv /tmp/raspap.auth $raspap_dir || _install_status 1 "Unable to restore authentification credentials file to ${raspap_dir}"