From d2a21d01595bddad2c7ee462b4d32467302fbc55 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 31 May 2012 23:43:59 +0000 Subject: [PATCH] Add documentation about the config options. --- functions.cli | 2 +- functions.config | 6 ++++-- functions.constants | 16 ++++++++------- functions.hook | 2 +- functions.zone | 4 +--- man/Makefile | 1 + man/network-config.8.in | 43 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 60 insertions(+), 14 deletions(-) create mode 100644 man/network-config.8.in diff --git a/functions.cli b/functions.cli index e2148d6d..a9d8be51 100644 --- a/functions.cli +++ b/functions.cli @@ -21,7 +21,7 @@ function cli_config() { if cli_help_requested $@; then - cli_show_man network + cli_show_man network-config exit ${EXIT_OK} fi diff --git a/functions.config b/functions.config index 6544a3db..a0d58dd0 100644 --- a/functions.config +++ b/functions.config @@ -27,6 +27,7 @@ function config_read_globals() { function config_read() { local config_file=${1} + assert isset config_file if [ -e "${config_file}" ]; then . ${config_file} @@ -36,6 +37,7 @@ function config_read() { function config_write() { local config_file=${1} + assert isset config_file shift # Check if all values to be written are sane @@ -95,7 +97,7 @@ function network_config_read() { # 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} @@ -103,7 +105,7 @@ function network_config_read() { } function network_config_write() { - config_write ${CONFIG_FILE} ${CONFIG_FILE_PARAMS} + config_write ${NETWORK_CONFIG_FILE} ${CONFIG_FILE_PARAMS} } function network_config_print() { diff --git a/functions.constants b/functions.constants index 6acee038..6b33e866 100644 --- a/functions.constants +++ b/functions.constants @@ -25,18 +25,20 @@ TEXTDOMAIN="network" # 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 @@ -92,7 +94,7 @@ IPTABLES_TMPDIR= 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="" diff --git a/functions.hook b/functions.hook index d193266d..9a1f3523 100644 --- a/functions.hook +++ b/functions.hook @@ -26,7 +26,7 @@ function hook_dir() { type="/${type}s" fi - echo "${HOOKS_DIR}${type}" + echo "${NETWORK_HOOKS_DIR}${type}" } function hook_exists() { diff --git a/functions.zone b/functions.zone index 50dd9ccc..433275cd 100644 --- a/functions.zone +++ b/functions.zone @@ -22,9 +22,7 @@ function zone_dir() { local zone=${1} - #assert isset zone - - echo "${ZONE_DIR}/zones/${zone}" + echo "${NETWORK_ZONE_DIR}/zones/${zone}" } function zone_exists() { diff --git a/man/Makefile b/man/Makefile index 65b1a603..23ee4749 100644 --- a/man/Makefile +++ b/man/Makefile @@ -27,6 +27,7 @@ MANPAGES_IN = $(foreach file,$(MANPAGES),$(file).in) MANPAGES8 = \ network.8 \ + network-config.8 \ network-zone.8 .PHONY: all diff --git a/man/network-config.8.in b/man/network-config.8.in new file mode 100644 index 00000000..bbaa2ba5 --- /dev/null +++ b/man/network-config.8.in @@ -0,0 +1,43 @@ +.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) -- 2.39.2