function cli_config() {
if cli_help_requested $@; then
- cli_show_man network
+ cli_show_man network-config
exit ${EXIT_OK}
fi
function config_read() {
local config_file=${1}
+ assert isset config_file
if [ -e "${config_file}" ]; then
. ${config_file}
function config_write() {
local config_file=${1}
+ assert isset config_file
shift
# Check if all values to be written are sane
# Save state of DEBUG and restore it later.
local debug=${DEBUG}
- config_read ${CONFIG_FILE}
+ config_read ${NETWORK_CONFIG_FILE}
if [ -n "${debug}" ]; then
DEBUG=${debug}
}
function network_config_write() {
- config_write ${CONFIG_FILE} ${CONFIG_FILE_PARAMS}
+ config_write ${NETWORK_CONFIG_FILE} ${CONFIG_FILE_PARAMS}
}
function network_config_print() {
# Enable colors by default
COLOURS="auto"
-BASE_DIR=/usr/lib/network
-CONFIG_DIR=/etc/network
-HOOKS_DIR=${BASE_DIR}/hooks
LOG_DIR=/var/log/network
RUN_DIR=/run/network
-ZONE_DIR=${CONFIG_DIR}
RED_RUN=${RUN_DIR}/red
PPP_SECRETS=/etc/ppp/secrets
-CONFIG_FILE=${CONFIG_DIR}/network_config
-CONFIG_FILE_PARAMS="COLOURS DEBUG SHELL TIMEOUT_RESTART"
+# Network directory configuration.
+NETWORK_CONFIG_DIR="/etc/network"
+NETWORK_ZONE_DIR="${NETWORK_CONFIG_DIR}"
+NETWORK_HOOKS_DIR=/usr/lib/network/hooks
+
+# Network file configuration.
+NETWORK_CONFIG_FILE=${NETWORK_CONFIG_DIR}/config
+NETWORK_CONFIG_FILE_PARAMS="COLOURS DEBUG"
CONFIG_HOSTNAME="/etc/hostname"
RED_DB_DIR=${RUN_DIR}/red
FIREWALL_CONFIG_DIR="/etc/firewall"
FIREWALL_ZONES_DIR="${FIREWALL_CONFIG_DIR}/zones"
-FIREWALL_CONFIG_FILE="${FIREWALL_CONFIG_DIR}/settings"
+FIREWALL_CONFIG_FILE="${FIREWALL_CONFIG_DIR}/config"
FIREWALL_CONFIG_PORTFW="${FIREWALL_CONFIG_DIR}/portfw"
FIREWALL_CONFIG_PARAMS=""
type="/${type}s"
fi
- echo "${HOOKS_DIR}${type}"
+ echo "${NETWORK_HOOKS_DIR}${type}"
}
function hook_exists() {
function zone_dir() {
local zone=${1}
- #assert isset zone
-
- echo "${ZONE_DIR}/zones/${zone}"
+ echo "${NETWORK_ZONE_DIR}/zones/${zone}"
}
function zone_exists() {
MANPAGES8 = \
network.8 \
+ network-config.8 \
network-zone.8
.PHONY: all
--- /dev/null
+.TH network-config 8 "1 Jun 2012" "@VERSION@" "network man page"
+
+.SH NAME
+network-config \- A list of global configuration options.
+
+.SH SYNOPSIS
+\fBnetwork [OPTIONS] config\fR \- Will return a list of all possible keys and their current values.
+.P
+\fBnetwork [OPTIONS] config [KEY=VALUE ...]\fR \- Will set the variable \fBKEY\fR to \fBVALUE\fR.
+
+.SH DESCRIPTION
+The \fBnetwork config\fR command may be used to set global configuration options permanently.
+These options are mostly display options or debugging settings and do not influcence
+the behaviour of the networking code itself.
+
+.SH OPTIONS
+This is a list of possible configuration values:
+
+\fBCOLORS\fR = [\fBauto\fR|on|off]
+.RS 4
+This will control the output of the console tools. \fBon\fR will enable colorful output
+all the time, \fBoff\fR will disable colors.
+.PP
+The default setting is \fBauto\fR which will automatically detect if the console supports
+colors.
+.PP
+Colorful output is very helpful to spot important information faster.
+.RE
+.PP
+
+\fBDEBUG\fR = [\fB0\fR|1]
+.RS 4
+The \fBDEBUG\fR will control weather debug logging is enabled or not. Additionally
+to writing debug log messages to the log files, the messages will displayed on the
+console.
+.RE
+.PP
+
+.SH SEE ALSO
+network(8)
+
+.SH AUTHOR
+Michael Tremer (michael.tremer@ipfire.org)