mirror of
https://github.com/unraid/webgui.git
synced 2025-12-30 22:20:23 -06:00
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:
28
.github/scripts/generate-pr-plugin.sh
vendored
28
.github/scripts/generate-pr-plugin.sh
vendored
@@ -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"
|
||||
1
.github/workflows/pr-plugin-build.yml
vendored
1
.github/workflows/pr-plugin-build.yml
vendored
@@ -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/`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user