mirror of
https://github.com/unraid/api.git
synced 2026-01-02 22:50:02 -06:00
chore: check for file existence when removing
This commit is contained in:
@@ -145,12 +145,27 @@ exit 0
|
||||
echo "Removing Plugin"
|
||||
|
||||
# Check Unraid version
|
||||
UNRAID_VERSION=$(cat /etc/unraid-version | grep "^version=" | cut -d'"' -f2)
|
||||
|
||||
# Check if this is Unraid 7.2 or higher (including RCs and prereleases)
|
||||
UNRAID_VERSION=""
|
||||
is_7_2_or_higher=false
|
||||
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
|
||||
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user