Skip to content

Commit 172e3b8

Browse files
committed
Change $VESTA to $HESTIA var.
1 parent f051a1c commit 172e3b8

File tree

6 files changed

+81
-81
lines changed

6 files changed

+81
-81
lines changed

func/db.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# MySQL
22
mysql_connect() {
3-
host_str=$(grep "HOST='$1'" $VESTA/conf/mysql.conf)
3+
host_str=$(grep "HOST='$1'" $HESTIA/conf/mysql.conf)
44
eval $host_str
55
if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ]; then
66
echo "Error: mysql config parsing failed"
77
log_event "$E_PARSING" "$ARGUMENTS"
88
exit $E_PARSING
99
fi
1010

11-
mycnf="$VESTA/conf/.mysql.$HOST"
11+
mycnf="$HESTIA/conf/.mysql.$HOST"
1212
if [ ! -e "$mycnf" ]; then
1313
echo "[client]">$mycnf
1414
echo "host='$HOST'" >> $mycnf
@@ -70,7 +70,7 @@ mysql_dump() {
7070

7171
# PostgreSQL
7272
psql_connect() {
73-
host_str=$(grep "HOST='$1'" $VESTA/conf/pgsql.conf)
73+
host_str=$(grep "HOST='$1'" $HESTIA/conf/pgsql.conf)
7474
eval $host_str
7575
export PGPASSWORD="$PASSWORD"
7676
if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $TPL ]; then
@@ -117,7 +117,7 @@ get_next_dbhost() {
117117
if [ -z "$host" ] || [ "$host" == 'default' ]; then
118118
IFS=$'\n'
119119
host='EMPTY_DB_HOST'
120-
config="$VESTA/conf/$type.conf"
120+
config="$HESTIA/conf/$type.conf"
121121
host_str=$(grep "SUSPENDED='no'" $config)
122122
check_row=$(echo "$host_str"|wc -l)
123123

@@ -146,7 +146,7 @@ get_next_dbhost() {
146146

147147
# Database charset validation
148148
is_charset_valid() {
149-
host_str=$(grep "HOST='$host'" $VESTA/conf/$type.conf)
149+
host_str=$(grep "HOST='$host'" $HESTIA/conf/$type.conf)
150150
eval $host_str
151151

152152
if [ -z "$(echo $CHARSETS | grep -wi $charset )" ]; then
@@ -158,7 +158,7 @@ is_charset_valid() {
158158

159159
# Increase database host value
160160
increase_dbhost_values() {
161-
host_str=$(grep "HOST='$host'" $VESTA/conf/$type.conf)
161+
host_str=$(grep "HOST='$host'" $HESTIA/conf/$type.conf)
162162
eval $host_str
163163

164164
old_dbbases="U_DB_BASES='$U_DB_BASES'"
@@ -175,13 +175,13 @@ increase_dbhost_values() {
175175
fi
176176
fi
177177

178-
sed -i "s/$old_dbbases/$new_dbbases/g" $VESTA/conf/$type.conf
179-
sed -i "s/$old_users/$new_users/g" $VESTA/conf/$type.conf
178+
sed -i "s/$old_dbbases/$new_dbbases/g" $HESTIA/conf/$type.conf
179+
sed -i "s/$old_users/$new_users/g" $HESTIA/conf/$type.conf
180180
}
181181

182182
# Decrease database host value
183183
decrease_dbhost_values() {
184-
host_str=$(grep "HOST='$HOST'" $VESTA/conf/$TYPE.conf)
184+
host_str=$(grep "HOST='$HOST'" $HESTIA/conf/$TYPE.conf)
185185
eval $host_str
186186

187187
old_dbbases="U_DB_BASES='$U_DB_BASES'"
@@ -194,8 +194,8 @@ decrease_dbhost_values() {
194194
sed ':a;N;$!ba;s/\n/,/g')
195195
new_users="U_SYS_USERS='$U_SYS_USERS'"
196196

197-
sed -i "s/$old_dbbases/$new_dbbases/g" $VESTA/conf/$TYPE.conf
198-
sed -i "s/$old_users/$new_users/g" $VESTA/conf/$TYPE.conf
197+
sed -i "s/$old_dbbases/$new_dbbases/g" $HESTIA/conf/$TYPE.conf
198+
sed -i "s/$old_users/$new_users/g" $HESTIA/conf/$TYPE.conf
199199
}
200200

201201
# Create MySQL database
@@ -249,8 +249,8 @@ add_pgsql_database() {
249249

250250
# Check if database host do not exist in config
251251
is_dbhost_new() {
252-
if [ -e "$VESTA/conf/$type.conf" ]; then
253-
check_host=$(grep "HOST='$host'" $VESTA/conf/$type.conf)
252+
if [ -e "$HESTIA/conf/$type.conf" ]; then
253+
check_host=$(grep "HOST='$host'" $HESTIA/conf/$type.conf)
254254
if [ ! -z "$check_host" ]; then
255255
echo "Error: db host exist"
256256
log_event "$E_EXISTS" "$ARGUMENTS"
@@ -363,7 +363,7 @@ dump_pgsql_database() {
363363

364364
# Check if database server is in use
365365
is_dbhost_free() {
366-
host_str=$(grep "HOST='$host'" $VESTA/conf/$type.conf)
366+
host_str=$(grep "HOST='$host'" $HESTIA/conf/$type.conf)
367367
eval $host_str
368368
if [ 0 -ne "$U_DB_BASES" ]; then
369369
echo "Error: host $HOST is used"

func/domain.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ is_backend_template_valid() {
3535

3636
# Web domain existence check
3737
is_web_domain_new() {
38-
web=$(grep -F -H "DOMAIN='$1'" $VESTA/data/users/*/web.conf)
38+
web=$(grep -F -H "DOMAIN='$1'" $HESTIA/data/users/*/web.conf)
3939
if [ ! -z "$web" ]; then
4040
if [ "$type" == 'web' ]; then
4141
check_result $E_EXISTS "Web domain $1 exist"
@@ -49,7 +49,7 @@ is_web_domain_new() {
4949

5050
# Web alias existence check
5151
is_web_alias_new() {
52-
web_alias=$(grep -wH "$1" $VESTA/data/users/*/web.conf)
52+
web_alias=$(grep -wH "$1" $HESTIA/data/users/*/web.conf)
5353
if [ ! -z "$web_alias" ]; then
5454
a1=$(echo "$web_alias" |grep -F "'$1'" |cut -f 7 -d /)
5555
if [ ! -z "$a1" ] && [ "$2" == "web" ]; then
@@ -160,8 +160,8 @@ prepare_web_domain_values() {
160160
ssl_ca_str='#'
161161
fi
162162
if [ "$SUSPENDED" = 'yes' ]; then
163-
docroot="$VESTA/data/templates/web/suspend"
164-
sdocroot="$VESTA/data/templates/web/suspend"
163+
docroot="$HESTIA/data/templates/web/suspend"
164+
sdocroot="$HESTIA/data/templates/web/suspend"
165165
fi
166166
}
167167

@@ -360,7 +360,7 @@ is_dns_template_valid() {
360360

361361
# DNS domain existence check
362362
is_dns_domain_new() {
363-
dns=$(ls $VESTA/data/users/*/dns/$1.conf 2>/dev/null)
363+
dns=$(ls $HESTIA/data/users/*/dns/$1.conf 2>/dev/null)
364364
if [ ! -z "$dns" ]; then
365365
if [ "$2" == 'dns' ]; then
366366
check_result $E_EXISTS "DNS domain $1 exists"
@@ -515,7 +515,7 @@ is_dns_nameserver_valid() {
515515

516516
# Mail domain existence check
517517
is_mail_domain_new() {
518-
mail=$(ls $VESTA/data/users/*/mail/$1.conf 2>/dev/null)
518+
mail=$(ls $HESTIA/data/users/*/mail/$1.conf 2>/dev/null)
519519
if [ ! -z "$mail" ]; then
520520
if [ "$2" == 'mail' ]; then
521521
check_result $E_EXISTS "Mail domain $1 exists"

func/ip.sh

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Check ip ownership
22
is_ip_owner() {
3-
owner=$(grep 'OWNER=' $VESTA/data/ips/$ip |cut -f 2 -d \')
3+
owner=$(grep 'OWNER=' $HESTIA/data/ips/$ip |cut -f 2 -d \')
44
if [ "$owner" != "$user" ]; then
55
check_result $E_FORBIDEN "$ip is not owned by $user"
66
fi
77
}
88

99
# Check if ip address is free
1010
is_ip_free() {
11-
if [ -e "$VESTA/data/ips/$ip" ]; then
11+
if [ -e "$HESTIA/data/ips/$ip" ]; then
1212
check_result $E_EXISTS "$ip is already exists"
1313
fi
1414
}
@@ -29,7 +29,7 @@ get_ip_iface() {
2929
# Check ip address specific value
3030
is_ip_key_empty() {
3131
key="$1"
32-
string=$(cat $VESTA/data/ips/$ip)
32+
string=$(cat $HESTIA/data/ips/$ip)
3333
eval $string
3434
eval value="$key"
3535
if [ ! -z "$value" ] && [ "$value" != '0' ]; then
@@ -42,7 +42,7 @@ is_ip_key_empty() {
4242
update_ip_value() {
4343
key="$1"
4444
value="$2"
45-
conf="$VESTA/data/ips/$ip"
45+
conf="$HESTIA/data/ips/$ip"
4646
str=$(cat $conf)
4747
eval $str
4848
c_key=$(echo "${key//$/}")
@@ -55,7 +55,7 @@ update_ip_value() {
5555

5656
# Get ip name
5757
get_ip_alias() {
58-
ip_name=$(grep "NAME=" $VESTA/data/ips/$local_ip |cut -f 2 -d \')
58+
ip_name=$(grep "NAME=" $HESTIA/data/ips/$local_ip |cut -f 2 -d \')
5959
if [ ! -z "$ip_name" ]; then
6060
echo "${1//./-}.$ip_name"
6161
fi
@@ -67,8 +67,8 @@ increase_ip_value() {
6767
USER=$user
6868
web_key='U_WEB_DOMAINS'
6969
usr_key='U_SYS_USERS'
70-
current_web=$(grep "$web_key=" $VESTA/data/ips/$sip |cut -f 2 -d \')
71-
current_usr=$(grep "$usr_key=" $VESTA/data/ips/$sip |cut -f 2 -d \')
70+
current_web=$(grep "$web_key=" $HESTIA/data/ips/$sip |cut -f 2 -d \')
71+
current_usr=$(grep "$usr_key=" $HESTIA/data/ips/$sip |cut -f 2 -d \')
7272
if [ -z "$current_web" ]; then
7373
echo "Error: Parsing error"
7474
log_event "$E_PARSING" "$ARGUMENTS"
@@ -87,9 +87,9 @@ increase_ip_value() {
8787
fi
8888

8989
sed -i "s/$web_key='$current_web'/$web_key='$new_web'/g" \
90-
$VESTA/data/ips/$sip
90+
$HESTIA/data/ips/$sip
9191
sed -i "s/$usr_key='$current_usr'/$usr_key='$new_usr'/g" \
92-
$VESTA/data/ips/$sip
92+
$HESTIA/data/ips/$sip
9393
}
9494

9595
# Decrease ip value
@@ -99,8 +99,8 @@ decrease_ip_value() {
9999
web_key='U_WEB_DOMAINS'
100100
usr_key='U_SYS_USERS'
101101

102-
current_web=$(grep "$web_key=" $VESTA/data/ips/$sip |cut -f 2 -d \')
103-
current_usr=$(grep "$usr_key=" $VESTA/data/ips/$sip |cut -f 2 -d \')
102+
current_web=$(grep "$web_key=" $HESTIA/data/ips/$sip |cut -f 2 -d \')
103+
current_usr=$(grep "$usr_key=" $HESTIA/data/ips/$sip |cut -f 2 -d \')
104104

105105
if [ -z "$current_web" ]; then
106106
check_result $E_PARSING "Parsing error"
@@ -119,15 +119,15 @@ decrease_ip_value() {
119119
fi
120120

121121
sed -i "s/$web_key='$current_web'/$web_key='$new_web'/g" \
122-
$VESTA/data/ips/$sip
122+
$HESTIA/data/ips/$sip
123123
sed -i "s/$usr_key='$current_usr'/$usr_key='$new_usr'/g" \
124-
$VESTA/data/ips/$sip
124+
$HESTIA/data/ips/$sip
125125
}
126126

127127
# Get ip address value
128128
get_ip_value() {
129129
key="$1"
130-
string=$(cat $VESTA/data/ips/$ip)
130+
string=$(cat $HESTIA/data/ips/$ip)
131131
eval $string
132132
eval value="$key"
133133
echo "$value"
@@ -136,10 +136,10 @@ get_ip_value() {
136136

137137
# Get real ip address
138138
get_real_ip() {
139-
if [ -e "$VESTA/data/ips/$1" ]; then
139+
if [ -e "$HESTIA/data/ips/$1" ]; then
140140
echo $1
141141
else
142-
nat=$(grep -H "^NAT='$1'" $VESTA/data/ips/*)
142+
nat=$(grep -H "^NAT='$1'" $HESTIA/data/ips/*)
143143
if [ ! -z "$nat" ]; then
144144
echo "$nat" |cut -f 1 -d : |cut -f 7 -d /
145145
fi
@@ -195,9 +195,9 @@ get_broadcast() {
195195

196196
# Get user ips
197197
get_user_ips() {
198-
dedicated=$(grep -H "OWNER='$user'" $VESTA/data/ips/*)
198+
dedicated=$(grep -H "OWNER='$user'" $HESTIA/data/ips/*)
199199
dedicated=$(echo "$dedicated" |cut -f 1 -d : |sed 's=.*/==')
200-
shared=$(grep -H -A1 "OWNER='admin'" $VESTA/data/ips/* |grep shared)
200+
shared=$(grep -H -A1 "OWNER='admin'" $HESTIA/data/ips/* |grep shared)
201201
shared=$(echo "$shared" |cut -f 1 -d : |sed 's=.*/==' |cut -f 1 -d \-)
202202
for dedicated_ip in $dedicated; do
203203
shared=$(echo "$shared" |grep -v $dedicated_ip)
@@ -212,7 +212,7 @@ get_user_ip() {
212212
check_result $E_NOTEXIST "no IP is available"
213213
fi
214214
local_ip=$ip
215-
nat=$(grep "^NAT" $VESTA/data/ips/$ip |cut -f 2 -d \')
215+
nat=$(grep "^NAT" $HESTIA/data/ips/$ip |cut -f 2 -d \')
216216
if [ ! -z "$nat" ]; then
217217
ip=$nat
218218
fi
@@ -221,8 +221,8 @@ get_user_ip() {
221221
# Validate ip address
222222
is_ip_valid() {
223223
local_ip="$1"
224-
if [ ! -e "$VESTA/data/ips/$1" ]; then
225-
nat=$(grep -H "^NAT='$1'" $VESTA/data/ips/*)
224+
if [ ! -e "$HESTIA/data/ips/$1" ]; then
225+
nat=$(grep -H "^NAT='$1'" $HESTIA/data/ips/*)
226226
if [ -z "$nat" ]; then
227227
check_result $E_NOTEXIST "IP $1 doesn't exist"
228228
else
@@ -232,9 +232,9 @@ is_ip_valid() {
232232
fi
233233
if [ ! -z $2 ]; then
234234
if [ -z "$nat" ]; then
235-
ip_data=$(cat $VESTA/data/ips/$1)
235+
ip_data=$(cat $HESTIA/data/ips/$1)
236236
else
237-
ip_data=$(cat $VESTA/data/ips/$nat)
237+
ip_data=$(cat $HESTIA/data/ips/$nat)
238238
fi
239239
ip_owner=$(echo "$ip_data" |grep OWNER= |cut -f2 -d \')
240240
ip_status=$(echo "$ip_data" |grep STATUS= |cut -f2 -d \')

0 commit comments

Comments
 (0)