domain + subdomain

This commit is contained in:
pvincent
2024-10-09 11:38:59 +04:00
parent 5ac2e4842d
commit ac7268731a
10 changed files with 179 additions and 28 deletions
+10 -7
View File
@@ -1,9 +1,5 @@
#!/bin/bash
function check_database_exists() {
db-maria list | grep -q "$longname"
}
function check_port_used() {
# shellcheck disable=SC2034
usedport=$(lxc exec "$container" -- bash -c "grep Listen /etc/apache2/sites-enabled/$longname.conf | cut -d' ' -f2")
@@ -21,7 +17,7 @@ function check_config_defined() {
function _read() {
disable_trace
check_database_exists
check_db_maria_exists "$longname"
check_container "$container"
check_port_used
check_config_defined
@@ -139,11 +135,12 @@ function usage() {
# init_strict
source "$(dirname "$0")/../base/common.sh"
COMMAND_NAME=$(basename "$0")
# read the options
TEMP=$(getopt -n "$COMMAND_NAME" -o crud --long port:,container:,name:,fqdn: -- "$@")
TEMP=$(getopt -n "$COMMAND_NAME" -o crud --long port:,container:,name:,fqdn:,domain:,subdomain: -- "$@")
# shellcheck disable=SC2181
[[ "$?" -eq 0 ]] || usage
eval set -- "$TEMP"
@@ -175,6 +172,12 @@ while true; do
longname="cagettepei-$shortname"
shift 2
;;
--domain)
shift 2
;;
--subdomain)
shift 2
;;
-c)
[[ "$action" == "unset" ]] || usage
action="_create"
@@ -200,7 +203,7 @@ while true; do
break
;;
*)
echo "Internal error!"
echo "Internal error: unrecognized option: <$1>"
exit 1
;;
esac