Exclude root-level files (manifest.json) from plugin restore

This commit is contained in:
billz
2025-11-03 18:05:16 +01:00
parent 3bbfcba539
commit 1522cfb7e7

View File

@@ -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