From 2ab444e46352da2813b741f2cd01448bc4dccd9f Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Wed, 10 Sep 2025 11:36:35 -0400 Subject: [PATCH] fix: enhance compatibility in generate-pr-plugin.sh and update workflow instructions - Modified the sed command in `generate-pr-plugin.sh` to support both Linux and macOS environments. - Updated the `pr-plugin-build.yml` workflow documentation to include a step for creating the necessary plugin directory. --- .github/scripts/generate-pr-plugin.sh | 28 ++++++++++++++++++--------- .github/workflows/pr-plugin-build.yml | 1 + 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/scripts/generate-pr-plugin.sh b/.github/scripts/generate-pr-plugin.sh index 044072757..93727abf2 100755 --- a/.github/scripts/generate-pr-plugin.sh +++ b/.github/scripts/generate-pr-plugin.sh @@ -88,14 +88,14 @@ echo "Starting file deployment..." > "$MANIFEST" # Extract and get file list -cd / tar -tzf "$TARBALL" | while read -r file; do # Skip directories if [[ "$file" == */ ]]; then continue fi - # Convert tar path to actual system path + # The tarball contains usr/local/emhttp/... but we extract to / + # So the actual system path is /usr/local/emhttp/... SYSTEM_FILE="/${file}" # Check if file exists and backup @@ -109,7 +109,7 @@ tar -tzf "$TARBALL" | while read -r file; do fi done -# Extract the tarball +# Extract the tarball to root (files are already prefixed with usr/local/) echo "" echo "Installing modified files..." tar -xzf "$TARBALL" -C / @@ -180,11 +180,21 @@ echo "✅ Plugin removed successfully" EOF -# Replace placeholders -sed -i "s/VERSION_PLACEHOLDER/${VERSION}/g" "$PLUGIN_NAME" -sed -i "s/TARBALL_PLACEHOLDER/${TARBALL_NAME}/g" "$PLUGIN_NAME" -sed -i "s/SHA256_PLACEHOLDER/${TARBALL_SHA256}/g" "$PLUGIN_NAME" -sed -i "s/PR_PLACEHOLDER/${PR_NUMBER}/g" "$PLUGIN_NAME" -sed -i "s/COMMIT_PLACEHOLDER/${COMMIT_SHA}/g" "$PLUGIN_NAME" +# Replace placeholders (compatible with both Linux and macOS) +if [[ "$OSTYPE" == "darwin"* ]]; then + # macOS requires backup extension with -i + sed -i '' "s/VERSION_PLACEHOLDER/${VERSION}/g" "$PLUGIN_NAME" + sed -i '' "s/TARBALL_PLACEHOLDER/${TARBALL_NAME}/g" "$PLUGIN_NAME" + sed -i '' "s/SHA256_PLACEHOLDER/${TARBALL_SHA256}/g" "$PLUGIN_NAME" + sed -i '' "s/PR_PLACEHOLDER/${PR_NUMBER}/g" "$PLUGIN_NAME" + sed -i '' "s/COMMIT_PLACEHOLDER/${COMMIT_SHA}/g" "$PLUGIN_NAME" +else + # Linux sed + sed -i "s/VERSION_PLACEHOLDER/${VERSION}/g" "$PLUGIN_NAME" + sed -i "s/TARBALL_PLACEHOLDER/${TARBALL_NAME}/g" "$PLUGIN_NAME" + sed -i "s/SHA256_PLACEHOLDER/${TARBALL_SHA256}/g" "$PLUGIN_NAME" + sed -i "s/PR_PLACEHOLDER/${PR_NUMBER}/g" "$PLUGIN_NAME" + sed -i "s/COMMIT_PLACEHOLDER/${COMMIT_SHA}/g" "$PLUGIN_NAME" +fi echo "Plugin generated: $PLUGIN_NAME" \ No newline at end of file diff --git a/.github/workflows/pr-plugin-build.yml b/.github/workflows/pr-plugin-build.yml index 5e6bf6ecf..c6eecd509 100644 --- a/.github/workflows/pr-plugin-build.yml +++ b/.github/workflows/pr-plugin-build.yml @@ -117,6 +117,7 @@ jobs: - Extract the downloaded ZIP file 2. **Copy files to your Unraid server:** + - Create directory: `mkdir -p /boot/config/plugins/webgui-pr/` - `webgui-pr-${{ steps.version.outputs.version }}.plg` → `/boot/config/plugins/` - `webgui-pr-${{ steps.version.outputs.version }}.tar.gz` → `/boot/config/plugins/webgui-pr/`