X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fsystem%2Fadd_domain.sh;h=80ebb2f37d0563e6d0d9b0d768d1e9b80a0797c3;hb=f3e2e0d8a7bb96505d0dded3bfab99f1cd2a4a99;hp=48d5495c5409bd8b4d410e18aee2d63c4dbb5183;hpb=a5d77db4a9c1e15ef835977abe1a5f71fc93c7fd;p=feisty_meow.git diff --git a/scripts/system/add_domain.sh b/scripts/system/add_domain.sh index 48d5495c..80ebb2f3 100644 --- a/scripts/system/add_domain.sh +++ b/scripts/system/add_domain.sh @@ -8,6 +8,11 @@ # # Author: Chris Koeritz +export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory. +export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )" + +source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh" + # some defaults that are convenient for current purposes. # hmmm: !!! these would need to be parameterized somehow for this script to become really general. @@ -58,6 +63,10 @@ function write_new_domain_file() ${domain_name}. IN A ${IP_ADDRESS} IN HINFO \"linux server\" \"${DISTRO}\" " >"$domain_file" + + # our personalized configuration approach wants the real owner to own the file. + chown "$(logname):$(logname)" $domain_file + test_or_die "setting ownership on: $domain_file" } # hooks up a new config file into bind's list of zones. @@ -81,6 +90,11 @@ zone \"${domain_name}\" in { //////////////////////////////////////////////////////////////////////////// " >> /etc/bind/named.conf.local + + # keep ownership for the real user. + chown "$(logname):$(logname)" /etc/bind/named.conf.local + test_or_die "setting ownership on: /etc/bind/named.conf.local" + } # adds a new subdomain under a containing domain. @@ -118,6 +132,9 @@ ${subdomain}.${containing_domain}. IN A ${IP_ADDRESS} IN HINFO \"linux server\" \"${DISTRO}\" " >> /etc/bind/${containing_domain}.conf + # keep ownership for real user. + chown "$(logname):$(logname)" "/etc/bind/${containing_domain}.conf" + test_or_die "setting ownership on: /etc/bind/${containing_domain}.conf" } function restart_bind()