From 3d31f7ec9b780bc4821d2d67b2ad6e7543c7aee4 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 3 Nov 2025 10:12:57 +0100 Subject: [PATCH 1/6] Fix: Fetch only plugins manifest.json on update/upgrade --- installers/common.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) mode change 100755 => 100644 installers/common.sh diff --git a/installers/common.sh b/installers/common.sh old mode 100755 new mode 100644 index bd389178..7183c751 --- a/installers/common.sh +++ b/installers/common.sh @@ -630,7 +630,17 @@ function _download_latest_files() { fi git clone --branch $branch --depth 1 --recurse-submodules -c advice.detachedHead=false $git_source_url $source_dir || clone=false - git -C $source_dir submodule update --remote plugins || clone=false + + # For updates/upgrades, fetch only the plugins manifest + if [ "$upgrade" == 1 ] || [ "$update" == 1 ]; then + # Initialize plugins submodule without checking out plugin directories + git -C $source_dir submodule update --init plugins || clone=false + git -C $source_dir/plugins sparse-checkout init --cone || clone=false + git -C $source_dir/plugins sparse-checkout set manifest.json README.md LICENSE .github || clone=false + else + # Update plugins submodule normally + git -C $source_dir submodule update --remote plugins || clone=false + fi if [ "$clone" = false ]; then _install_status 1 "Unable to download files from GitHub" @@ -641,9 +651,9 @@ function _download_latest_files() { 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' + exclude='--exclude=ajax/system/sys_read_logfile.php --exclude=plugins' shopt -s extglob - sudo find "$webroot_dir" ! -path "${webroot_dir}/ajax/system/sys_read_logfile.php" -delete 2>/dev/null + sudo find "$webroot_dir" ! -path "${webroot_dir}/ajax/system/sys_read_logfile.php" ! -path "${webroot_dir}/plugins" ! -path "${webroot_dir}/plugins/*" -delete 2>/dev/null fi _install_log "Installing application to $webroot_dir" @@ -652,7 +662,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}" From 504403a5c3d246c12465d35cd4428c563a37e288 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 3 Nov 2025 14:51:06 +0100 Subject: [PATCH 2/6] Exclude plugins during update/upgrade --- installers/common.sh | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 7183c751..abd7e7d9 100644 --- a/installers/common.sh +++ b/installers/common.sh @@ -630,17 +630,7 @@ function _download_latest_files() { fi git clone --branch $branch --depth 1 --recurse-submodules -c advice.detachedHead=false $git_source_url $source_dir || clone=false - - # For updates/upgrades, fetch only the plugins manifest - if [ "$upgrade" == 1 ] || [ "$update" == 1 ]; then - # Initialize plugins submodule without checking out plugin directories - git -C $source_dir submodule update --init plugins || clone=false - git -C $source_dir/plugins sparse-checkout init --cone || clone=false - git -C $source_dir/plugins sparse-checkout set manifest.json README.md LICENSE .github || clone=false - else - # Update plugins submodule normally - git -C $source_dir submodule update --remote plugins || clone=false - fi + git -C $source_dir submodule update --remote plugins || clone=false if [ "$clone" = false ]; then _install_status 1 "Unable to download files from GitHub" @@ -648,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 --exclude=plugins' + exclude='--exclude=ajax/system/sys_read_logfile.php' shopt -s extglob - sudo find "$webroot_dir" ! -path "${webroot_dir}/ajax/system/sys_read_logfile.php" ! -path "${webroot_dir}/plugins" ! -path "${webroot_dir}/plugins/*" -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" From 3bbfcba539c28ebf4e75282e7f143c4021e3d0fd Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 3 Nov 2025 17:49:03 +0100 Subject: [PATCH 3/6] 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" From 1522cfb7e7bb6d98f8c25061f67d3adc824914a6 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 3 Nov 2025 18:05:16 +0100 Subject: [PATCH 4/6] Exclude root-level files (manifest.json) from plugin restore --- installers/common.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index ab686a7d..4fdf9dae 100644 --- a/installers/common.sh +++ b/installers/common.sh @@ -638,18 +638,12 @@ 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' - # Preserve user plugins in /tmp + # Preserve user plugins temporarily if [ -d "$webroot_dir/plugins" ]; then sudo cp -r "$webroot_dir/plugins" "/tmp/raspap-user-plugins" fi @@ -658,6 +652,7 @@ function _download_latest_files() { 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 @@ -668,7 +663,8 @@ function _download_latest_files() { # 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 + # Exclude root-level files like manifest.json + sudo find /tmp/raspap-user-plugins -mindepth 1 -maxdepth 1 -type d -exec cp -r {} "$webroot_dir/plugins/" \; 2>/dev/null sudo rm -rf "/tmp/raspap-user-plugins" fi fi From 4667ce53bed3b30540fada8c7221454cd1d382d3 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 11 Nov 2025 11:27:31 +0100 Subject: [PATCH 5/6] Code cleanup, improve readability --- installers/common.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 4fdf9dae..5f9ccac2 100644 --- a/installers/common.sh +++ b/installers/common.sh @@ -641,17 +641,16 @@ function _download_latest_files() { 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' - # Preserve user plugins temporarily 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 + sudo find "$webroot_dir" -mindepth 1 \ + ! -path "${webroot_dir}/ajax/system/sys_read_logfile.php" \ + ! -path "${webroot_dir}/plugins" \ + ! -path "${webroot_dir}/plugins/*" \ + -delete 2>/dev/null # Remove plugins to permit clean rsync sudo rm -rf "$webroot_dir/plugins" @@ -663,7 +662,6 @@ function _download_latest_files() { # Restore user plugins after rsync if [ "$upgrade" == 1 ] || [ "$update" == 1 ]; then if [ -d "/tmp/raspap-user-plugins" ]; then - # Exclude root-level files like manifest.json sudo find /tmp/raspap-user-plugins -mindepth 1 -maxdepth 1 -type d -exec cp -r {} "$webroot_dir/plugins/" \; 2>/dev/null sudo rm -rf "/tmp/raspap-user-plugins" fi From 076c03311b7e796a49d5a573cc734a047acc9c29 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 11 Nov 2025 11:40:54 +0100 Subject: [PATCH 6/6] Fix fastcgi-php-fpm module enable error handling --- installers/common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 4fdf9dae..4d0fc67c 100644 --- a/installers/common.sh +++ b/installers/common.sh @@ -287,9 +287,9 @@ function _install_dependencies() { if [[ "$php_package" == *"-fpm" ]]; then _install_log "Enabling lighttpd fastcgi-php-fpm module for $php_package" - sudo lighty-enable-mod fastcgi-php-fpm || _install_status 1 "Unable to enable fastcgi-php-fpm module" + sudo lighty-enable-mod fastcgi-php-fpm 2>&1 | grep -qE "already enabled" || \ + _install_status 1 "Unable to enable fastcgi-php-fpm module" fi - _install_status 0 }