mirror of
https://github.com/unraid/api.git
synced 2026-01-04 23:50:37 -06:00
fix: do not uninstall fully on 7.2 (#1484)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Uninstallation process now adapts based on Unraid version: for version 7.2 or higher, users receive a notification and are prompted to reboot to complete plugin removal. * **Bug Fixes** * Improved handling of plugin removal to ensure compatibility with different Unraid versions and prevent unintended reinstalls. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -144,15 +144,60 @@ exit 0
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
echo "Removing Plugin"
|
echo "Removing Plugin"
|
||||||
|
|
||||||
# Find any installed dynamix.unraid.net package
|
# Check Unraid version
|
||||||
pkg_installed=$(ls -1 /var/log/packages/dynamix.unraid.net* 2>/dev/null | head -1)
|
UNRAID_VERSION=""
|
||||||
if [ -n "$pkg_installed" ]; then
|
is_7_2_or_higher=false
|
||||||
pkg_basename=$(basename "$pkg_installed")
|
|
||||||
echo "Removing package: $pkg_basename"
|
# Check if version file exists and is readable
|
||||||
removepkg --terse "$pkg_basename"
|
if [ -f "/etc/unraid-version" ] && [ -r "/etc/unraid-version" ]; then
|
||||||
|
UNRAID_VERSION=$(cat /etc/unraid-version | grep "^version=" | cut -d'"' -f2 2>/dev/null)
|
||||||
|
|
||||||
|
if [ -z "$UNRAID_VERSION" ]; then
|
||||||
|
echo "Warning: Unable to parse version from /etc/unraid-version"
|
||||||
|
echo "Using safe removal method (plugin file removal + reboot)"
|
||||||
|
is_7_2_or_higher=true # Default to safe method
|
||||||
|
else
|
||||||
|
# Check if this is Unraid 7.2 or higher (including RCs and prereleases)
|
||||||
|
if [[ "$UNRAID_VERSION" =~ ^7\.([2-9]|[1-9][0-9]+)\. ]] || [[ "$UNRAID_VERSION" =~ ^([8-9]|[1-9][0-9]+)\. ]]; then
|
||||||
|
is_7_2_or_higher=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "No dynamix.unraid.net package found. Trying with basic package name."
|
echo "Warning: /etc/unraid-version file not found or not readable"
|
||||||
removepkg --terse "${MAINNAME}"
|
echo "Using safe removal method (plugin file removal + reboot)"
|
||||||
|
is_7_2_or_higher=true # Default to safe method
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$is_7_2_or_higher" = true ]; then
|
||||||
|
echo "Unraid 7.2+ detected. Using safe removal method."
|
||||||
|
|
||||||
|
# Send notification to user
|
||||||
|
/usr/local/emhttp/webGui/scripts/notify \
|
||||||
|
-e "Unraid Connect" \
|
||||||
|
-s "Reboot Required for Unraid Connect Removal" \
|
||||||
|
-d "Unraid Connect plugin has been marked for removal. Please reboot your server to complete the uninstallation." \
|
||||||
|
-i "warning"
|
||||||
|
|
||||||
|
# Remove the plugin file so it won't be installed on reboot
|
||||||
|
PLUGIN_FILE="/boot/config/plugins/${MAINNAME}.plg"
|
||||||
|
if [ -f "$PLUGIN_FILE" ]; then
|
||||||
|
echo "Removing plugin file: $PLUGIN_FILE"
|
||||||
|
rm -f "$PLUGIN_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Plugin marked for removal. Reboot required to complete uninstallation."
|
||||||
|
else
|
||||||
|
# Original removal method for older versions
|
||||||
|
# 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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# File restoration function
|
# File restoration function
|
||||||
|
|||||||
Reference in New Issue
Block a user