Initial
This commit is contained in:
50
bin/v-update-user-package
Executable file
50
bin/v-update-user-package
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
# info: update user package
|
||||
# options: PACKAGE
|
||||
#
|
||||
# example: v-update-user-package default
|
||||
#
|
||||
# This function propagates package to connected users.
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variables & Functions #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument definition
|
||||
package=$1
|
||||
|
||||
# Includes
|
||||
# shellcheck source=/etc/hestiacp/hestia.conf
|
||||
source /etc/hestiacp/hestia.conf
|
||||
# shellcheck source=/usr/local/hestia/func/main.sh
|
||||
source $HESTIA/func/main.sh
|
||||
# load config file
|
||||
source_conf "$HESTIA/conf/hestia.conf"
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
check_args '1' "$#" 'PACKAGE'
|
||||
is_format_valid 'package'
|
||||
is_package_valid
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
for user in $($BIN/v-list-sys-users plain); do
|
||||
check_package=$(grep "PACKAGE='$package'" $USER_DATA/$user/user.conf)
|
||||
if [ -n "$check_package" ]; then
|
||||
$BIN/v-change-user-package "$user" "$package" 'yes'
|
||||
fi
|
||||
done
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Hestia #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Logging
|
||||
log_event "$OK" "$ARGUMENTS"
|
||||
|
||||
exit
|
||||
Reference in New Issue
Block a user