mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 10:37:42 -07:00
Merge changes from upstream
I'm a little angry
This commit is contained in:
parent
dcf849263d
commit
2b16d9bd83
254 changed files with 24485 additions and 24094 deletions
|
@ -1,75 +1,75 @@
|
|||
#!/bin/bash
|
||||
# info: list user nameservers
|
||||
# options: user [format]
|
||||
#
|
||||
# Function for obtainig the list of user's DNS servers.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
user=$1
|
||||
format=${2-shell}
|
||||
|
||||
# Includes
|
||||
source $VESTA/func/main.sh
|
||||
|
||||
# Json function
|
||||
json_list_ns() {
|
||||
ns=$(grep "^NS='" $USER_DATA/user.conf |cut -f 2 -d \')
|
||||
echo '['
|
||||
i=1
|
||||
nslistc=$(echo -e "${ns//,/\n}"|wc -l)
|
||||
for nameserver in ${ns//,/ };do
|
||||
if [ "$i" -ne "$nslistc" ]; then
|
||||
echo -e "\t\"$nameserver\","
|
||||
else
|
||||
echo -e "\t\"$nameserver\""
|
||||
fi
|
||||
(( ++i))
|
||||
done
|
||||
echo "]"
|
||||
}
|
||||
|
||||
# Shell function
|
||||
shell_list_ns() {
|
||||
ns=$(grep "^NS='" $USER_DATA/user.conf |cut -f 2 -d \')
|
||||
if [ -z "$nohead" ]; then
|
||||
echo "NAMESERVER"
|
||||
echo "----------"
|
||||
fi
|
||||
for nameserver in ${ns//,/ };do
|
||||
echo "$nameserver"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
check_args '1' "$#" 'user [format]'
|
||||
validate_format 'user'
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Listing nameservers
|
||||
case $format in
|
||||
json) json_list_ns ;;
|
||||
plain) nohead=1; shell_list_ns ;;
|
||||
shell) shell_list_ns ;;
|
||||
*) check_args '1' '0' 'user [format]'
|
||||
esac
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
exit
|
||||
#!/bin/bash
|
||||
# info: list user nameservers
|
||||
# options: USER [FORMAT]
|
||||
#
|
||||
# Function for obtainig the list of user's DNS servers.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
user=$1
|
||||
format=${2-shell}
|
||||
|
||||
# Includes
|
||||
source $VESTA/func/main.sh
|
||||
|
||||
# Json function
|
||||
json_list_ns() {
|
||||
ns=$(grep "^NS='" $USER_DATA/user.conf |cut -f 2 -d \')
|
||||
echo '['
|
||||
i=1
|
||||
nslistc=$(echo -e "${ns//,/\n}"|wc -l)
|
||||
for nameserver in ${ns//,/ };do
|
||||
if [ "$i" -ne "$nslistc" ]; then
|
||||
echo -e "\t\"$nameserver\","
|
||||
else
|
||||
echo -e "\t\"$nameserver\""
|
||||
fi
|
||||
(( ++i))
|
||||
done
|
||||
echo "]"
|
||||
}
|
||||
|
||||
# Shell function
|
||||
shell_list_ns() {
|
||||
ns=$(grep "^NS='" $USER_DATA/user.conf |cut -f 2 -d \')
|
||||
if [ -z "$nohead" ]; then
|
||||
echo "NAMESERVER"
|
||||
echo "----------"
|
||||
fi
|
||||
for nameserver in ${ns//,/ };do
|
||||
echo "$nameserver"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
check_args '1' "$#" 'USER [FORMAT]'
|
||||
validate_format 'user'
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Listing nameservers
|
||||
case $format in
|
||||
json) json_list_ns ;;
|
||||
plain) nohead=1; shell_list_ns ;;
|
||||
shell) shell_list_ns ;;
|
||||
*) check_args '1' '0' 'USER [FORMAT]'
|
||||
esac
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
exit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue