Compatible with systemd.
[ "${up}" = "1" ] || device_set_down ${device}
}
+function cli_hostname() {
+ if cli_help_requested $@; then
+ cli_usage hostname
+ exit ${EXIT_OK}
+ fi
+
+ local hostname=${1}
+
+ if [ -n "${hostname}" ]; then
+ config_hostname ${hostname}
+ log INFO "Hostname was set to '${hostname}'."
+ log INFO "Changes do only take affect after reboot."
+ exit ${EXIT_OK}
+ fi
+
+ echo "$(config_hostname)"
+ exit ${EXIT_OK}
+}
+
function cli_port() {
if cli_help_requested $@; then
cli_usage root-port
CONFIG_FILE=${CONFIG_DIR}/network_config
CONFIG_FILE_PARAMS="COLOURS DEBUG SHELL TIMEOUT_RESTART"
+CONFIG_HOSTNAME="/etc/hostname"
RED_DB_DIR=${RUN_DIR}/red
[ -n "$(type -t _check)" ] && _check
}
+function config_hostname() {
+ local hostname=${1}
+
+ if [ -n "${hostname}" ]; then
+ echo "${hostname}" > ${CONFIG_HOSTNAME}
+ else
+ echo "$(<${CONFIG_HOSTNAME})"
+ fi
+}
+
function network_config_set() {
while [ $# -gt 0 ]; do
case "${1}" in
init_run
;;
- config|port|device|zone|start|stop|restart|status|reset)
+ config|hostname|port|device|zone|start|stop|restart|status|reset)
cli_${action} $@
;;