Skip to content

Commit 318d9e3

Browse files
committed
fix: do not uninstall fully on 7.2
1 parent 5a3e7a9 commit 318d9e3

File tree

1 file changed

+38
-8
lines changed

1 file changed

+38
-8
lines changed

plugin/plugins/dynamix.unraid.net.plg

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,45 @@ exit 0
144144
<![CDATA[
145145
echo "Removing Plugin"
146146
147-
# Find any installed dynamix.unraid.net package
148-
pkg_installed=$(ls -1 /var/log/packages/dynamix.unraid.net* 2>/dev/null | head -1)
149-
if [ -n "$pkg_installed" ]; then
150-
pkg_basename=$(basename "$pkg_installed")
151-
echo "Removing package: $pkg_basename"
152-
removepkg --terse "$pkg_basename"
147+
# Check Unraid version
148+
UNRAID_VERSION=$(cat /etc/unraid-version | grep "^version=" | cut -d'"' -f2)
149+
150+
# Check if this is Unraid 7.2 or higher (including RCs and prereleases)
151+
is_7_2_or_higher=false
152+
if [[ "$UNRAID_VERSION" =~ ^7\.([2-9]|[1-9][0-9]+)\. ]] || [[ "$UNRAID_VERSION" =~ ^([8-9]|[1-9][0-9]+)\. ]]; then
153+
is_7_2_or_higher=true
154+
fi
155+
156+
if [ "$is_7_2_or_higher" = true ]; then
157+
echo "Unraid 7.2+ detected. Using safe removal method."
158+
159+
# Send notification to user
160+
/usr/local/emhttp/webGui/scripts/notify \
161+
-e "Unraid Connect" \
162+
-s "Plugin Removal" \
163+
-d "Unraid Connect plugin has been marked for removal. Please reboot your server to complete the uninstallation." \
164+
-i "warning"
165+
166+
# Remove the plugin file so it won't be installed on reboot
167+
PLUGIN_FILE="/boot/config/plugins/${MAINNAME}.plg"
168+
if [ -f "$PLUGIN_FILE" ]; then
169+
echo "Removing plugin file: $PLUGIN_FILE"
170+
rm -f "$PLUGIN_FILE"
171+
fi
172+
173+
echo "Plugin marked for removal. Reboot required to complete uninstallation."
153174
else
154-
echo "No dynamix.unraid.net package found. Trying with basic package name."
155-
removepkg --terse "${MAINNAME}"
175+
# Original removal method for older versions
176+
# Find any installed dynamix.unraid.net package
177+
pkg_installed=$(ls -1 /var/log/packages/dynamix.unraid.net* 2>/dev/null | head -1)
178+
if [ -n "$pkg_installed" ]; then
179+
pkg_basename=$(basename "$pkg_installed")
180+
echo "Removing package: $pkg_basename"
181+
removepkg --terse "$pkg_basename"
182+
else
183+
echo "No dynamix.unraid.net package found. Trying with basic package name."
184+
removepkg --terse "${MAINNAME}"
185+
fi
156186
fi
157187
158188
# File restoration function

0 commit comments

Comments
 (0)