Skip to content

Commit 3bd26f4

Browse files
authored
Update v-import-cpanel (hestiacp#4142)
Extract cPanel package name if its available in the Hestia it will be used otherwise default package will be used
1 parent a5916c2 commit 3bd26f4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

bin/v-import-cpanel

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ fi
4141
# Default settings
4242
# Put this to 0 if you want use bash -x to debug it
4343
debug=1
44-
# Pacakge to be used by default "default"
45-
hestia_package=default
4644

4745
if [ -f "$1" ]; then
4846
cpanel_backup="$1"
@@ -106,6 +104,16 @@ if [ -n "$check_sysuser" ] || [ -e "$HESTIA/data/users/$new_user" ]; then
106104
exit 2
107105
fi
108106

107+
# Extract cPanel package name
108+
cpanel_package_name=$(cat ./cp/$new_user | grep 'PLAN=' | cut -f2 -d'=')
109+
if /usr/local/hestia/bin/v-list-user-packages | grep -qw "$cpanel_package_name"; then
110+
hestia_package="$cpanel_package_name"
111+
echo "Package $hestia_package will be used for the user."
112+
else
113+
hestia_package="default" # Replace "default" with your default Hestia package name
114+
echo "Default package $hestia_package will be used for the user."
115+
fi
116+
109117
# Create a new user
110118
tmp_passwd=$(generate_password)
111119
email=$(cat ./cp/$new_user | grep CONTACTEMAIL= | cut -f2 -d'=')

0 commit comments

Comments
 (0)