Fix cPanel plugin registration: correct install.json format and include icon
- install.json: use cPanel's required fields (type, id, group_id, uri) instead of incorrect keys (target_type, category, url) - Include icon SVG in tar.gz archive (install_plugin validates icon exists) - Without correct fields, install_plugin silently skipped registration Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"target_type": "link",
|
"type": "link",
|
||||||
|
"id": "gniza",
|
||||||
"name": "gniza Restore",
|
"name": "gniza Restore",
|
||||||
"category": "files",
|
"group_id": "files",
|
||||||
"description": "Restore files, databases, email, and more from gniza backups",
|
"description": "Restore files, databases, email, and more from gniza backups",
|
||||||
"url": "gniza/index.live.cgi",
|
"uri": "gniza/index.live.cgi",
|
||||||
"feature": "gniza_restore",
|
"feature": "gniza_restore",
|
||||||
"order": 1,
|
"order": 1,
|
||||||
"icon": "gniza/assets/gniza-logo.svg"
|
"icon": "gniza/assets/gniza-logo.svg"
|
||||||
|
|||||||
@@ -112,10 +112,13 @@ if [[ -d "$CPANEL_BASE" ]]; then
|
|||||||
cp "$SOURCE_DIR/cpanel/admin/Gniza/Restore.conf" "$ADMINBIN_DIR/"
|
cp "$SOURCE_DIR/cpanel/admin/Gniza/Restore.conf" "$ADMINBIN_DIR/"
|
||||||
chmod 0700 "$ADMINBIN_DIR/Restore"
|
chmod 0700 "$ADMINBIN_DIR/Restore"
|
||||||
chmod 0600 "$ADMINBIN_DIR/Restore.conf"
|
chmod 0600 "$ADMINBIN_DIR/Restore.conf"
|
||||||
# Register plugin in cPanel interface (install_plugin expects a tar.gz archive)
|
# Register plugin in cPanel interface (install_plugin expects a tar.gz archive
|
||||||
|
# containing install.json + the icon file referenced in it)
|
||||||
PLUGIN_TMPDIR="$(mktemp -d)"
|
PLUGIN_TMPDIR="$(mktemp -d)"
|
||||||
|
mkdir -p "$PLUGIN_TMPDIR/gniza/assets"
|
||||||
cp "$SOURCE_DIR/cpanel/gniza/install.json" "$PLUGIN_TMPDIR/"
|
cp "$SOURCE_DIR/cpanel/gniza/install.json" "$PLUGIN_TMPDIR/"
|
||||||
tar -czf "$PLUGIN_TMPDIR/gniza-cpanel.tar.gz" -C "$PLUGIN_TMPDIR" install.json
|
cp "$SOURCE_DIR/cpanel/gniza/assets/gniza-logo.svg" "$PLUGIN_TMPDIR/gniza/assets/"
|
||||||
|
tar -czf "$PLUGIN_TMPDIR/gniza-cpanel.tar.gz" -C "$PLUGIN_TMPDIR" install.json gniza/assets/gniza-logo.svg
|
||||||
/usr/local/cpanel/scripts/install_plugin "$PLUGIN_TMPDIR/gniza-cpanel.tar.gz" 2>/dev/null || true
|
/usr/local/cpanel/scripts/install_plugin "$PLUGIN_TMPDIR/gniza-cpanel.tar.gz" 2>/dev/null || true
|
||||||
rm -rf "$PLUGIN_TMPDIR"
|
rm -rf "$PLUGIN_TMPDIR"
|
||||||
echo "cPanel user plugin installed — users will see gniza Restore in Files section"
|
echo "cPanel user plugin installed — users will see gniza Restore in Files section"
|
||||||
|
|||||||
@@ -46,10 +46,13 @@ CPANEL_BASE="/usr/local/cpanel/base/frontend/jupiter"
|
|||||||
ADMINBIN_DIR="/usr/local/cpanel/bin/admin/Gniza"
|
ADMINBIN_DIR="/usr/local/cpanel/bin/admin/Gniza"
|
||||||
if [[ -d "$CPANEL_BASE/gniza" ]]; then
|
if [[ -d "$CPANEL_BASE/gniza" ]]; then
|
||||||
echo "Removing cPanel user plugin..."
|
echo "Removing cPanel user plugin..."
|
||||||
# uninstall_plugin expects a tar.gz archive
|
# uninstall_plugin expects a tar.gz archive with install.json + icon
|
||||||
if [[ -f "$CPANEL_BASE/gniza/install.json" ]]; then
|
if [[ -f "$CPANEL_BASE/gniza/install.json" ]]; then
|
||||||
PLUGIN_TMPDIR="$(mktemp -d)"
|
PLUGIN_TMPDIR="$(mktemp -d)"
|
||||||
|
mkdir -p "$PLUGIN_TMPDIR/gniza/assets"
|
||||||
cp "$CPANEL_BASE/gniza/install.json" "$PLUGIN_TMPDIR/"
|
cp "$CPANEL_BASE/gniza/install.json" "$PLUGIN_TMPDIR/"
|
||||||
|
cp "$CPANEL_BASE/gniza/assets/gniza-logo.svg" "$PLUGIN_TMPDIR/gniza/assets/" 2>/dev/null || true
|
||||||
|
tar -czf "$PLUGIN_TMPDIR/gniza-cpanel.tar.gz" -C "$PLUGIN_TMPDIR" install.json gniza/assets/gniza-logo.svg 2>/dev/null || \
|
||||||
tar -czf "$PLUGIN_TMPDIR/gniza-cpanel.tar.gz" -C "$PLUGIN_TMPDIR" install.json
|
tar -czf "$PLUGIN_TMPDIR/gniza-cpanel.tar.gz" -C "$PLUGIN_TMPDIR" install.json
|
||||||
/usr/local/cpanel/scripts/uninstall_plugin "$PLUGIN_TMPDIR/gniza-cpanel.tar.gz" 2>/dev/null || true
|
/usr/local/cpanel/scripts/uninstall_plugin "$PLUGIN_TMPDIR/gniza-cpanel.tar.gz" 2>/dev/null || true
|
||||||
rm -rf "$PLUGIN_TMPDIR"
|
rm -rf "$PLUGIN_TMPDIR"
|
||||||
|
|||||||
Reference in New Issue
Block a user