From 3bbfcba539c28ebf4e75282e7f143c4021e3d0fd Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 3 Nov 2025 17:49:03 +0100 Subject: [PATCH] Backup/restore plugins to permit clean rsync --- installers/common.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/installers/common.sh b/installers/common.sh index abd7e7d9..ab686a7d 100644 --- a/installers/common.sh +++ b/installers/common.sh @@ -648,14 +648,31 @@ function _download_latest_files() { 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' + + # Preserve user plugins in /tmp + if [ -d "$webroot_dir/plugins" ]; then + sudo cp -r "$webroot_dir/plugins" "/tmp/raspap-user-plugins" + fi + shopt -s extglob + 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 + # Remove plugins to permit clean rsync + sudo rm -rf "$webroot_dir/plugins" fi _install_log "Installing application to $webroot_dir" sudo rsync -av $exclude "$source_dir"/ "$webroot_dir"/ >/dev/null 2>&1 || _install_status 1 "Unable to install files to $webroot_dir" + # Restore user plugins after rsync + if [ "$upgrade" == 1 ] || [ "$update" == 1 ]; then + if [ -d "/tmp/raspap-user-plugins" ]; then + sudo cp -r /tmp/raspap-user-plugins/* "$webroot_dir/plugins/" 2>/dev/null + sudo rm -rf "/tmp/raspap-user-plugins" + fi + fi + 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"