Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 53 additions & 8 deletions plugin/plugins/dynamix.unraid.net.plg
Original file line number Diff line number Diff line change
Expand Up @@ -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 "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
echo "No dynamix.unraid.net package found. Trying with basic package name."
removepkg --terse "${MAINNAME}"
# 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
Expand Down