mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 02:28:05 -07:00
replaced underscore with dash in api syscalls
This commit is contained in:
parent
7ed705cee7
commit
b6b7eacadb
283 changed files with 438 additions and 412 deletions
92
bin/v-list-user-package
Executable file
92
bin/v-list-user-package
Executable file
|
@ -0,0 +1,92 @@
|
|||
#!/bin/bash
|
||||
# info: list user package
|
||||
# options: package [format]
|
||||
#
|
||||
# The function for getting the list of system ip parameters.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
package=$1
|
||||
PACKAGE=$package
|
||||
format=${2-shell}
|
||||
|
||||
# Includes
|
||||
source $VESTA/func/main.sh
|
||||
|
||||
# Json function
|
||||
json_list_package() {
|
||||
i=1
|
||||
fileds_count=$(echo "$fields" | wc -w)
|
||||
pkg_data=$(cat $VESTA/data/packages/$PACKAGE.pkg)
|
||||
echo '{'
|
||||
eval $pkg_data
|
||||
for field in $fields; do
|
||||
eval value=$field
|
||||
if [ $i -eq 1 ]; then
|
||||
echo -e "\t\"$value\": {"
|
||||
else
|
||||
if [ $fileds_count -eq $i ]; then
|
||||
echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
|
||||
else
|
||||
echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
|
||||
fi
|
||||
fi
|
||||
(( ++i))
|
||||
done
|
||||
if [ -n "$value" ]; then
|
||||
echo -e ' }'
|
||||
fi
|
||||
echo -e '}'
|
||||
}
|
||||
|
||||
# Shell function
|
||||
shell_list_package() {
|
||||
line=$(cat $VESTA/data/packages/$PACKAGE.pkg)
|
||||
eval $line
|
||||
for field in $fields; do
|
||||
eval key="$field"
|
||||
if [ -z "$key" ]; then
|
||||
key='NULL'
|
||||
fi
|
||||
echo "${field//$/}: $key "
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking args
|
||||
check_args '1' "$#" 'package [format]'
|
||||
validate_format 'package'
|
||||
is_package_valid
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Defining fileds to select
|
||||
fields='$PACKAGE $TEMPLATE $WEB_DOMAINS $WEB_ALIASES $DNS_DOMAINS $DNS_RECORDS
|
||||
$MAIL_DOMAINS $MAIL_ACCOUNTS $DATABASES $CRON_JOBS $DISK_QUOTA $BANDWIDTH
|
||||
$NS $SHELL $BACKUPS $TIME $DATE'
|
||||
|
||||
# Listing ip
|
||||
case $format in
|
||||
json) json_list_package ;;
|
||||
plain) shell_list_package ;;
|
||||
shell) shell_list_package | column -t ;;
|
||||
*) check_args '1' '0' 'ip [format]'
|
||||
esac
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue