mirror of
https://github.com/unraid/webgui.git
synced 2026-05-08 05:12:14 -05: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:
@@ -88,14 +88,14 @@ echo "Starting file deployment..."
|
|||||||
> "$MANIFEST"
|
> "$MANIFEST"
|
||||||
|
|
||||||
# Extract and get file list
|
# Extract and get file list
|
||||||
cd /
|
|
||||||
tar -tzf "$TARBALL" | while read -r file; do
|
tar -tzf "$TARBALL" | while read -r file; do
|
||||||
# Skip directories
|
# Skip directories
|
||||||
if [[ "$file" == */ ]]; then
|
if [[ "$file" == */ ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
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}"
|
SYSTEM_FILE="/${file}"
|
||||||
|
|
||||||
# Check if file exists and backup
|
# Check if file exists and backup
|
||||||
@@ -109,7 +109,7 @@ tar -tzf "$TARBALL" | while read -r file; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Extract the tarball
|
# Extract the tarball to root (files are already prefixed with usr/local/)
|
||||||
echo ""
|
echo ""
|
||||||
echo "Installing modified files..."
|
echo "Installing modified files..."
|
||||||
tar -xzf "$TARBALL" -C /
|
tar -xzf "$TARBALL" -C /
|
||||||
@@ -180,11 +180,21 @@ echo "✅ Plugin removed successfully"
|
|||||||
</PLUGIN>
|
</PLUGIN>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Replace placeholders
|
# Replace placeholders (compatible with both Linux and macOS)
|
||||||
sed -i "s/VERSION_PLACEHOLDER/${VERSION}/g" "$PLUGIN_NAME"
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
sed -i "s/TARBALL_PLACEHOLDER/${TARBALL_NAME}/g" "$PLUGIN_NAME"
|
# macOS requires backup extension with -i
|
||||||
sed -i "s/SHA256_PLACEHOLDER/${TARBALL_SHA256}/g" "$PLUGIN_NAME"
|
sed -i '' "s/VERSION_PLACEHOLDER/${VERSION}/g" "$PLUGIN_NAME"
|
||||||
sed -i "s/PR_PLACEHOLDER/${PR_NUMBER}/g" "$PLUGIN_NAME"
|
sed -i '' "s/TARBALL_PLACEHOLDER/${TARBALL_NAME}/g" "$PLUGIN_NAME"
|
||||||
sed -i "s/COMMIT_PLACEHOLDER/${COMMIT_SHA}/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"
|
echo "Plugin generated: $PLUGIN_NAME"
|
||||||
@@ -117,6 +117,7 @@ jobs:
|
|||||||
- Extract the downloaded ZIP file
|
- Extract the downloaded ZIP file
|
||||||
|
|
||||||
2. **Copy files to your Unraid server:**
|
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 }}.plg` → `/boot/config/plugins/`
|
||||||
- `webgui-pr-${{ steps.version.outputs.version }}.tar.gz` → `/boot/config/plugins/webgui-pr/`
|
- `webgui-pr-${{ steps.version.outputs.version }}.tar.gz` → `/boot/config/plugins/webgui-pr/`
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user