]> git.ipfire.org Git - people/stevee/network.git/blame - src/functions/functions.config
Rename all "config" to "settings"
[people/stevee/network.git] / src / functions / functions.config
CommitLineData
3647b19f
MT
1#!/bin/bash
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
5# Copyright (C) 2012 IPFire Network Development Team #
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation, either version 3 of the License, or #
10# (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
21
97cb552e
MT
22function config_header() {
23 local what=${1}
24 assert isset what
25
26 # Print the header.
27 echo "#"
28 echo "# This is a ${what}."
cd464143
MT
29 echo "# THIS FILE IS AUTOMATICALLY GENERATED AND"
30 echo "# ANY CUSTOM CHANGES WILL BE OVERWRITTEN!"
97cb552e
MT
31 echo "#"
32 echo "# $(date -u)"
33 echo "#"
34 echo
35}
36
3647b19f
MT
37function config_hostname() {
38 local hostname=${1}
39
40 if [ -n "${hostname}" ]; then
41 echo "${hostname}" > ${CONFIG_HOSTNAME}
42 else
43 echo "$(<${CONFIG_HOSTNAME})"
44 fi
45}
46
144a8f96
MT
47function config_domainname() {
48 local hostname=$(config_hostname)
49
50 # Strip off the hostname part and just return
51 # the domain part.
52 print "${hostname#*.}"
53}