mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 18:49:17 -07:00
Merge changes from upstream
This commit is contained in:
parent
8fb1fa5482
commit
c094d8582d
54 changed files with 4981 additions and 5671 deletions
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
#!/bin/bash
|
||||
# info: add dns domain or dns record based on web domain alias restart
|
||||
# options: USER DOMAIN
|
||||
|
@ -50,15 +49,21 @@ get_domain_values 'web'
|
|||
# Check if it a simple domain
|
||||
if [ $(echo -e "${dom_alias//\./\n}" | wc -l) -le 2 ]; then
|
||||
if [ ! -e "$USER_DATA/dns/$dom_alias.conf" ]; then
|
||||
$BIN/v-add-dns-domain $user $dom_alias $IP '' '' '' '' '' $restart
|
||||
$BIN/v-add-dns-domain \
|
||||
$user $dom_alias $IP '' '' '' '' '' $restart > /dev/null
|
||||
fi
|
||||
else
|
||||
# Check subdomain
|
||||
sub=$(echo "$dom_alias" | cut -f1 -d . -s)
|
||||
dom=$(echo "$dom_alias" | sed -e "s/^$sub.//" )
|
||||
if [ ! -e "$USER_DATA/dns/$dom.conf" ]; then
|
||||
$BIN/v-add-dns-domain $user $dom $IP '' '' '' '' '' $restart
|
||||
$BIN/v-add-dns-domain-record $user $dom "$sub" A $IP '' '' $restart
|
||||
$BIN/v-add-dns-domain \
|
||||
$user $dom $IP '' '' '' '' '' $restart > /dev/null
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
$BIN/v-add-dns-domain-record \
|
||||
$user $dom "$sub" A $IP '' '' $restart
|
||||
fi
|
||||
else
|
||||
if [ "$sub" == '*' ]; then
|
||||
rec=$(grep -w "RECORD='\*'" $USER_DATA/dns/$dom.conf)
|
||||
|
@ -66,7 +71,8 @@ else
|
|||
rec=$(grep -w "RECORD='$sub'" $USER_DATA/dns/$dom.conf)
|
||||
fi
|
||||
if [ -z "$rec" ]; then
|
||||
$BIN/v-add-dns-domain-record $user $dom "$sub" A $IP '' '' $restart
|
||||
$BIN/v-add-dns-domain-record \
|
||||
$user $dom "$sub" A $IP '' '' $restart > /dev/null
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -79,92 +85,3 @@ fi
|
|||
# No Logging
|
||||
|
||||
exit
|
||||
=======
|
||||
#!/bin/bash
|
||||
# info: add dns domain or dns record based on web domain alias restart
|
||||
# options: USER DOMAIN
|
||||
#
|
||||
# The function adds dns domain or dns record based on web domain alias.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
user=$1
|
||||
domain=$(echo $2 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
||||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
dom_alias=$(idn -t --quiet -u "$3" )
|
||||
dom_alias=$(echo $dom_alias | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
||||
dom_alias=$(echo $dom_alias | tr '[:upper:]' '[:lower:]')
|
||||
dom_alias_idn=$(idn -t --quiet -a "$dom_alias" )
|
||||
restart="$4"
|
||||
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/main.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
check_args '3' "$#" 'USER DOMAIN ALIAS'
|
||||
validate_format 'user' 'domain'
|
||||
is_system_enabled "$WEB_SYSTEM"
|
||||
is_system_enabled "$DNS_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
is_object_valid 'web' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'web' 'DOMAIN' "$domain"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Parsing domain values
|
||||
get_domain_values 'web'
|
||||
|
||||
# Check if it a simple domain
|
||||
if [ $(echo -e "${dom_alias//\./\n}" | wc -l) -le 2 ]; then
|
||||
if [ ! -e "$USER_DATA/dns/$dom_alias.conf" ]; then
|
||||
$BIN/v-add-dns-domain \
|
||||
$user $dom_alias $IP '' '' '' '' '' $restart > /dev/null
|
||||
fi
|
||||
else
|
||||
# Check subdomain
|
||||
sub=$(echo "$dom_alias" | cut -f1 -d . -s)
|
||||
dom=$(echo "$dom_alias" | sed -e "s/^$sub.//" )
|
||||
if [ ! -e "$USER_DATA/dns/$dom.conf" ]; then
|
||||
$BIN/v-add-dns-domain \
|
||||
$user $dom $IP '' '' '' '' '' $restart > /dev/null
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
$BIN/v-add-dns-domain-record \
|
||||
$user $dom "$sub" A $IP '' '' $restart
|
||||
fi
|
||||
else
|
||||
if [ "$sub" == '*' ]; then
|
||||
rec=$(grep -w "RECORD='\*'" $USER_DATA/dns/$dom.conf)
|
||||
else
|
||||
rec=$(grep -w "RECORD='$sub'" $USER_DATA/dns/$dom.conf)
|
||||
fi
|
||||
if [ -z "$rec" ]; then
|
||||
$BIN/v-add-dns-domain-record \
|
||||
$user $dom "$sub" A $IP '' '' $restart > /dev/null
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# No Logging
|
||||
|
||||
exit
|
||||
>>>>>>> 994c40901078e48fe939536f7b366e29c2e44a1d
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue