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.
This commit is contained in:
Eli Bosley
2025-09-10 11:36:35 -04:00
parent 023ca6dfa5
commit 2ab444e463
2 changed files with 20 additions and 9 deletions

View File

@@ -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"
</PLUGIN>
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"

View File

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