mirror of
https://github.com/unraid/api.git
synced 2026-01-01 22:20:05 -06:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added detailed versioning for plugin packages incorporating architecture and build identifiers. - Simplified and improved install/uninstall scripts with backup and dynamic package detection. - Introduced comprehensive setup, verification, patching, and cleanup scripts for the Unraid API environment. - Enhanced service control with explicit start, stop, restart, and status commands. - Added robust dependency management scripts for restoring and archiving Node.js modules. - Implemented vendor archive metadata storage and dynamic handling during build and runtime. - Added new CLI options and environment schemas for consistent build configuration. - Introduced new shutdown scripts to gracefully stop flash-backup and unraid-api services. - Added utility scripts for API version detection and vendor archive configuration. - Added a new package description file detailing Unraid API features and homepage link. - **Bug Fixes** - Improved validation and error reporting for missing manifests, dependencies, and configuration files. - Enhanced fallback logic for locating and creating vendor archives. - Fixed iframe compatibility in UI by updating HTML and Firefox preference files. - **Chores** - Updated .gitignore with generated file patterns for Node.js binaries and archives. - Removed obsolete internal documentation and legacy cleanup scripts. - Refined Docker Compose and CI workflows to pass precise API versioning and manage build artifacts. - Centralized common environment validation and CLI option definitions across build tools. - Cleaned up plugin manifest by removing Node.js and PNPM-related entities and legacy logic. - Improved logging and error handling in build and installation scripts. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
272 lines
9.5 KiB
XML
Executable File
272 lines
9.5 KiB
XML
Executable File
<?xml version='1.0' standalone='yes'?>
|
|
<!DOCTYPE PLUGIN [
|
|
<!ENTITY name "dynamix.unraid.net">
|
|
<!ENTITY launch "Connect">
|
|
<!ENTITY author "limetech">
|
|
<!ENTITY version "">
|
|
<!ENTITY plugin_url "">
|
|
<!ENTITY source "/boot/config/plugins/dynamix.my.servers/&txz_name;">
|
|
<!ENTITY txz_sha256 "">
|
|
<!ENTITY txz_url "">
|
|
<!ENTITY txz_name "">
|
|
<!ENTITY vendor_store_url "">
|
|
<!ENTITY vendor_store_filename "">
|
|
<!ENTITY arch "x86_64">
|
|
<!ENTITY build "1">
|
|
<!ENTITY tag "">
|
|
<!ENTITY api_version "">
|
|
]>
|
|
|
|
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&plugin_url;"
|
|
launch="&launch;" min="6.9.0-rc1" icon="globe">
|
|
|
|
<CHANGES>
|
|
##a long time ago in a galaxy far far away
|
|
- initial release
|
|
</CHANGES>
|
|
|
|
<!-- Check disk space before installation -->
|
|
<FILE Run="/bin/bash" Method="install">
|
|
<INLINE>
|
|
<![CDATA[
|
|
# Check available disk space on /usr
|
|
echo -n "Checking disk space on /usr... "
|
|
FREE_SPACE=$(df -m /usr | awk 'NR==2 {print $4}')
|
|
if [ -z "$FREE_SPACE" ]; then
|
|
echo "⚠️ Error: Unable to determine free space on /usr"
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$FREE_SPACE" -lt 300 ]; then
|
|
echo "⚠️ Error: Insufficient disk space on /usr. Need at least 300MB free, only ${FREE_SPACE}MB available"
|
|
exit 1
|
|
fi
|
|
echo "ok. (${FREE_SPACE}MB free)"
|
|
|
|
exit 0
|
|
]]>
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<FILE Name="/boot/config/plugins/dynamix.my.servers/&vendor_store_filename;">
|
|
<URL>&vendor_store_url;</URL>
|
|
</FILE>
|
|
|
|
<!-- download main txz -->
|
|
<FILE Name="&source;">
|
|
<URL>&txz_url;</URL>
|
|
<SHA256>&txz_sha256;</SHA256>
|
|
</FILE>
|
|
|
|
<!-- Check for compatible Unraid version -->
|
|
<FILE Run="/usr/bin/php" Method="install">
|
|
<INLINE>
|
|
<![CDATA[
|
|
<?php
|
|
// Check Unraid version
|
|
$version = @parse_ini_file('/etc/unraid-version', true)['version'];
|
|
|
|
// Check if this is a supported version
|
|
// - Must be 6.12.0 or higher
|
|
// - Must not be a 6.12.0 beta/rc version
|
|
$is_stable_6_12_or_higher = version_compare($version, '6.12.0', '>=') && !preg_match('/^6\\.12\\.0-/', $version);
|
|
|
|
if ($is_stable_6_12_or_higher) {
|
|
echo "Running on supported version {$version}\n";
|
|
exit(0);
|
|
}
|
|
|
|
echo "Warning: Unsupported Unraid version {$version}. This plugin requires Unraid 6.12.0 or higher.\n";
|
|
echo "The plugin may not function correctly on this system.\n";
|
|
|
|
exit(0);
|
|
]]>
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<!-- Backup files before installation -->
|
|
<FILE Run="/bin/bash" Method="install">
|
|
<INLINE>
|
|
<![CDATA[
|
|
echo "Backing up original files..."
|
|
|
|
# Define files to backup in a shell variable
|
|
FILES_TO_BACKUP=(
|
|
"/usr/local/emhttp/plugins/dynamix/DisplaySettings.page"
|
|
"/usr/local/emhttp/plugins/dynamix/Registration.page"
|
|
"/usr/local/emhttp/plugins/dynamix/include/DefaultPageLayout.php"
|
|
"/usr/local/emhttp/plugins/dynamix/include/ProvisionCert.php"
|
|
"/usr/local/emhttp/plugins/dynamix/include/UpdateDNS.php"
|
|
"/usr/local/emhttp/plugins/dynamix/include/ReplaceKey.php"
|
|
"/usr/local/emhttp/plugins/dynamix/include/Wrappers.php"
|
|
"/usr/local/emhttp/plugins/dynamix.plugin.manager/Downgrade.page"
|
|
"/usr/local/emhttp/plugins/dynamix.plugin.manager/Update.page"
|
|
"/usr/local/emhttp/plugins/dynamix.plugin.manager/include/ShowChanges.php"
|
|
"/usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/showchanges"
|
|
"/usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/unraidcheck"
|
|
"/usr/local/emhttp/plugins/dynamix.plugin.manager/include/UnraidCheck.php"
|
|
"/usr/local/emhttp/plugins/dynamix.plugin.manager/include/UnraidCheckExec.php"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/Connect.page"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/MyServers.page"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/Registration.page"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/include/myservers1.php"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/include/myservers2.php"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/include/state.php"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/data/server-state.php"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/include/reboot-details.php"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/include/translations.php"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/include/web-components-extractor.php"
|
|
"/usr/local/emhttp/update.htm"
|
|
"/usr/local/emhttp/logging.htm"
|
|
"/etc/nginx/nginx.conf"
|
|
"/etc/rc.d/rc.nginx"
|
|
"/usr/share/mozilla/firefox/9n35r0i1.default/user.js"
|
|
)
|
|
|
|
# Backup each file if it exists and doesn't already have a backup
|
|
for FILE in "${FILES_TO_BACKUP[@]}"; do
|
|
if [ -f "$FILE" ] && [ ! -f "$FILE-" ]; then
|
|
cp -p "$FILE" "$FILE-"
|
|
echo "Backed up: $FILE"
|
|
fi
|
|
done
|
|
|
|
# Handle the unraid-components directory
|
|
DIR=/usr/local/emhttp/plugins/dynamix.my.servers/unraid-components
|
|
if [ -d "$DIR" ] && [ ! -d "$DIR-" ]; then
|
|
cp -rp "$DIR" "$DIR-"
|
|
echo "Backed up directory: $DIR"
|
|
fi
|
|
|
|
echo "Backup complete."
|
|
exit 0
|
|
]]>
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<FILE Run="/bin/bash" Method="remove">
|
|
<INLINE>
|
|
MAINNAME="&name;"
|
|
<![CDATA[
|
|
echo "Removing Plugin"
|
|
|
|
# Find any installed dynamix.unraid.net package
|
|
pkg_installed=$(ls -1 /var/log/packages/dynamix.unraid.net* 2>/dev/null | head -1)
|
|
if [ -n "$pkg_installed" ]; then
|
|
pkg_basename=$(basename "$pkg_installed")
|
|
echo "Removing package: $pkg_basename"
|
|
removepkg --terse "$pkg_basename"
|
|
else
|
|
echo "No dynamix.unraid.net package found. Trying with basic package name."
|
|
removepkg --terse "${MAINNAME}"
|
|
fi
|
|
|
|
# File restoration function
|
|
echo "Restoring files..."
|
|
|
|
# Define files to restore in a shell variable - must match backup list
|
|
FILES_TO_RESTORE=(
|
|
"/usr/local/emhttp/plugins/dynamix/DisplaySettings.page"
|
|
"/usr/local/emhttp/plugins/dynamix/Registration.page"
|
|
"/usr/local/emhttp/plugins/dynamix/include/DefaultPageLayout.php"
|
|
"/usr/local/emhttp/plugins/dynamix/include/ProvisionCert.php"
|
|
"/usr/local/emhttp/plugins/dynamix/include/UpdateDNS.php"
|
|
"/usr/local/emhttp/plugins/dynamix/include/ReplaceKey.php"
|
|
"/usr/local/emhttp/plugins/dynamix/include/Wrappers.php"
|
|
"/usr/local/emhttp/plugins/dynamix.plugin.manager/Downgrade.page"
|
|
"/usr/local/emhttp/plugins/dynamix.plugin.manager/Update.page"
|
|
"/usr/local/emhttp/plugins/dynamix.plugin.manager/include/ShowChanges.php"
|
|
"/usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/showchanges"
|
|
"/usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/unraidcheck"
|
|
"/usr/local/emhttp/plugins/dynamix.plugin.manager/include/UnraidCheck.php"
|
|
"/usr/local/emhttp/plugins/dynamix.plugin.manager/include/UnraidCheckExec.php"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/Connect.page"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/MyServers.page"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/Registration.page"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/include/myservers1.php"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/include/myservers2.php"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/include/state.php"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/data/server-state.php"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/include/reboot-details.php"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/include/translations.php"
|
|
"/usr/local/emhttp/plugins/dynamix.my.servers/include/web-components-extractor.php"
|
|
"/usr/local/emhttp/update.htm"
|
|
"/usr/local/emhttp/logging.htm"
|
|
"/etc/nginx/nginx.conf"
|
|
"/etc/rc.d/rc.nginx"
|
|
"/usr/share/mozilla/firefox/9n35r0i1.default/user.js"
|
|
)
|
|
|
|
# Restore each file if backup exists
|
|
for FILE in "${FILES_TO_RESTORE[@]}"; do
|
|
[ -f "$FILE-" ] && mv -f "$FILE-" "$FILE"
|
|
done
|
|
|
|
# Handle the unraid-components directory
|
|
DIR=/usr/local/emhttp/plugins/dynamix.my.servers/unraid-components
|
|
# certain instances where the directory is not present and others where it is, ensure we delete it before we restore it
|
|
if [ -d "$DIR" ]; then
|
|
rm -rf "$DIR"
|
|
fi
|
|
if [ -d "$DIR-" ]; then
|
|
mv -f "$DIR-" "$DIR"
|
|
fi
|
|
]]>
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<!-- install all the things -->
|
|
<FILE Run="/bin/bash" Method="install">
|
|
<INLINE>
|
|
TAG="&tag;"
|
|
PKG_FILE="&source;" # Full path to the package file including .txz extension
|
|
PKG_URL="&txz_url;" # URL where package was downloaded from
|
|
PKG_NAME="&txz_name;" # Name of the package file
|
|
VENDOR_ARCHIVE="/boot/config/plugins/dynamix.my.servers/&vendor_store_filename;"
|
|
<![CDATA[
|
|
# Install the Slackware package
|
|
echo "Installing package..."
|
|
# Clean up any old package txz files if they don't match our current version
|
|
for txz_file in /boot/config/plugins/dynamix.my.servers/dynamix.unraid.net-*.txz; do
|
|
if [ -f "$txz_file" ] && [ "$txz_file" != "${PKG_FILE}" ]; then
|
|
echo "Removing old package file: $txz_file"
|
|
rm -f "$txz_file"
|
|
fi
|
|
done
|
|
|
|
# Install the package using the explicit file path
|
|
upgradepkg --install-new --reinstall "${PKG_FILE}"
|
|
if [ $? -ne 0 ]; then
|
|
echo "⚠️ Package installation failed"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -n "$TAG" && "$TAG" != "" ]]; then
|
|
printf -v sedcmd 's@^\*\*Unraid Connect\*\*@**Unraid Connect (%s)**@' "$TAG"
|
|
sed -i "${sedcmd}" "/usr/local/emhttp/plugins/dynamix.unraid.net/README.md"
|
|
fi
|
|
|
|
echo
|
|
echo "✅ Installation is complete, it is safe to close this window"
|
|
echo
|
|
|
|
exit 0
|
|
]]>
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<!-- uninstall cleanup message -->
|
|
<FILE Run="/bin/bash" Method="remove">
|
|
<INLINE>
|
|
<![CDATA[
|
|
echo
|
|
echo "✅ Uninstall is complete, it is safe to close this window"
|
|
echo
|
|
|
|
exit 0
|
|
]]>
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
</PLUGIN>
|