Compare commits

...

4 Commits

Author SHA1 Message Date
Eli Bosley
2f8cd96677 Merge abcf56d987 into 0379845618 2025-07-08 15:31:24 -04:00
Eli Bosley
abcf56d987 chore: better message 2025-07-08 15:31:20 -04:00
Eli Bosley
7ff5db5573 chore: check for file existence when removing 2025-07-08 15:29:27 -04:00
Eli Bosley
318d9e35d6 fix: do not uninstall fully on 7.2 2025-07-08 15:23:09 -04:00

View File

@@ -144,15 +144,60 @@ exit 0
<![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"
# Check Unraid version
UNRAID_VERSION=""
is_7_2_or_higher=false
# Check if version file exists and is readable
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
echo "No dynamix.unraid.net package found. Trying with basic package name."
removepkg --terse "${MAINNAME}"
echo "Warning: /etc/unraid-version file not found or not readable"
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
# File restoration function