Skip to content

Commit 0e9d9bb

Browse files
author
Kristan Kenney
committed
Allow deletion of packages if in use
1 parent bb0507f commit 0e9d9bb

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

bin/v-delete-user-package

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
#
66
# example: v-delete-user-package admin palegreen
77
#
8-
# The function for deleting user package. It does not allow to delete package
9-
# if it is in use.
8+
# The function for deleting user package.
9+
#
10+
# If the package is in use, users will be updated to
11+
# use the default package.
1012

1113

1214
#----------------------------------------------------------#
@@ -22,11 +24,11 @@ source $HESTIA/conf/hestia.conf
2224

2325
# Functions
2426
is_package_in_use() {
25-
check_package=$(grep "PACKAGE='$package'" $USER_DATA/*/user.conf)
27+
check_package=$(grep "PACKAGE='default" $HESTIA/data/users/*/user.conf | cut -d'/' -f7)
2628
if [ ! -z "$check_package" ]; then
27-
echo "Error: package $package is in use"
28-
log_event "$E_INUSE" "$ARGUMENTS"
29-
exit $E_INUSE
29+
for user in $check_package; do
30+
$BIN/v-change-user-package "$user" 'default'
31+
done
3032
fi
3133
}
3234

0 commit comments

Comments
 (0)