You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hestiacp/bin/v-update-user-package

51 lines
1.5 KiB

#!/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