mirror of
https://github.com/myvesta/vesta.git
synced 2024-12-21 11:31:21 -08:00
121 lines
3.6 KiB
Bash
Executable File
121 lines
3.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# info: list user package
|
|
# options: PACKAGE [FORMAT]
|
|
#
|
|
# The function for getting the list of system ip parameters.
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Variable&Function #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument definition
|
|
package=$1
|
|
PACKAGE=$package
|
|
format=${2-shell}
|
|
|
|
# Includes
|
|
source $VESTA/func/main.sh
|
|
|
|
# JSON list function
|
|
json_list() {
|
|
echo '{'
|
|
echo ' "'$PACKAGE'": {
|
|
"WEB_TEMPLATE": "'$WEB_TEMPLATE'",
|
|
"PROXY_TEMPLATE": "'$PROXY_TEMPLATE'",
|
|
"DNS_TEMPLATE": "'$DNS_TEMPLATE'",
|
|
"WEB_DOMAINS": "'$WEB_DOMAINS'",
|
|
"WEB_ALIASES": "'$WEB_ALIASES'",
|
|
"DNS_DOMAINS": "'$DNS_DOMAINS'",
|
|
"DNS_RECORDS": "'$DNS_RECORDS'",
|
|
"MAIL_DOMAINS": "'$MAIL_DOMAINS'",
|
|
"MAIL_ACCOUNTS": "'$MAIL_ACCOUNTS'",
|
|
"DATABASES": "'$DATABASES'",
|
|
"CRON_JOBS": "'$CRON_JOBS'",
|
|
"DISK_QUOTA": "'$DISK_QUOTA'",
|
|
"BANDWIDTH": "'$BANDWIDTH'",
|
|
"NS": "'$NS'",
|
|
"SHELL": "'$SHELL'",
|
|
"BACKUPS": "'$BACKUPS'",
|
|
"TIME": "'$TIME'",
|
|
"DATE": "'$DATE'"
|
|
}'
|
|
echo '}'
|
|
}
|
|
|
|
# SHELL list function
|
|
shell_list() {
|
|
echo "PACKAGE: $PACKAGE"
|
|
echo "WEB TEMPLATE: $WEB_TEMPLATE"
|
|
echo "PROXY TEMPLATE: $PROXY_TEMPLATE"
|
|
echo "DNS TEMPLATE: $DNS_TEMPLATE"
|
|
echo "WEB DOMAINS: $WEB_DOMAINS"
|
|
echo "WEB ALIASES: $WEB_ALIASES"
|
|
echo "DNS DOMAINS: $DNS_DOMAINS"
|
|
echo "DNS RECORDS: $DNS_RECORDS"
|
|
echo "MAIL DOMAINS: $MAIL_DOMAINS"
|
|
echo "MAIL ACCOUNTS: $MAIL_ACCOUNTS"
|
|
echo "DATABASES: $DATABASES"
|
|
echo "CRON JOBS: $CRON_JOBS"
|
|
echo "DISK QUOTA: $DISK_QUOTA"
|
|
echo "BANDWIDTH: $BANDWIDTH"
|
|
echo "NS: $NS"
|
|
echo "SHELL: $SHELL"
|
|
echo "BACKUPS: $BACKUPS"
|
|
echo "TIME: $TIME"
|
|
echo "DATE: $DATE"
|
|
}
|
|
|
|
# PLAIN list function
|
|
plain_list() {
|
|
echo -ne "$PACKAGE\t$WEB_TEMPLATE\t$PROXY_TEMPLATE\t$DNS_TEMPLATE\t"
|
|
echo -ne "$WEB_DOMAINS\t$WEB_ALIASES\t$DNS_DOMAINS\t$DNS_RECORDS\t"
|
|
echo -ne "$MAIL_DOMAINS\t$MAIL_ACCOUNTS\t$DATABASES\t$CRON_JOBS\t"
|
|
echo -e "$DISK_QUOTA\t$BANDWIDTH\t$NS\t$SHELL\t$BACKUPS\t$TIME\t$DATE"
|
|
}
|
|
|
|
# CSV list function
|
|
csv_list() {
|
|
echo -n "PACKAGE,WEB_TEMPLATE,PROXY_TEMPLATE,DNS_TEMPLATE,"
|
|
echo -n "WEB_DOMAINS,WEB_ALIASES,DNS_DOMAINS,DNS_RECORDS,"
|
|
echo -n "MAIL_DOMAINS,MAIL_ACCOUNTS,DATABASES,CRON_JOBS,"
|
|
echo "DISK_QUOTA,BANDWIDTH,NS,SHELL,BACKUPS,TIME,DATE"
|
|
echo -n "$PACKAGE,$WEB_TEMPLATE,$PROXY_TEMPLATE,$DNS_TEMPLATE,"
|
|
echo -n "$WEB_DOMAINS,$WEB_ALIASES,$DNS_DOMAINS,$DNS_RECORDS,"
|
|
echo -n "$MAIL_DOMAINS,$MAIL_ACCOUNTS,$DATABASES,$CRON_JOBS,"
|
|
echo "$DISK_QUOTA,$BANDWIDTH,\"$NS\",$SHELL,$BACKUPS,$TIME,$DATE"
|
|
}
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Verifications #
|
|
#----------------------------------------------------------#
|
|
|
|
# Checking args
|
|
check_args '1' "$#" 'PACKAGE [FORMAT]'
|
|
is_format_valid 'package'
|
|
is_package_valid
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Parsing package
|
|
source $VESTA/data/packages/$PACKAGE.pkg
|
|
|
|
# Listing data
|
|
case $format in
|
|
json) json_list ;;
|
|
plain) plain_list ;;
|
|
csv) csv_list ;;
|
|
shell) shell_list ;;
|
|
esac
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
exit
|