From: Jonatan Schlag Date: Fri, 14 Jul 2017 12:19:41 +0000 (+0200) Subject: zone: new function zone_config_settings_destroy X-Git-Tag: 009~115 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea96cf52fc2fc18e65cc4b21b0ebeb50dd2bfaff;p=network.git zone: new function zone_config_settings_destroy Similar to zone_config_settings_write and zone_config_settings_read this function provides an easy way to delete a config file. Signed-off-by: Jonatan Schlag Signed-off-by: Michael Tremer --- diff --git a/src/functions/functions.zone b/src/functions/functions.zone index bba17055..f46fc84f 100644 --- a/src/functions/functions.zone +++ b/src/functions/functions.zone @@ -1287,6 +1287,24 @@ zone_config_settings_write() { settings_write "${path}" ${args} } +zone_config_settings_destroy() { + # This function deletes the config file for a given zone and config + assert [ $# -ge 2 ] + local zone="${1}" + local config="${2}" + + local path="$(zone_dir "${zone}")/configs/${config}" + + # Check if path is valid + if [ ! -f ${path} ]; then + log ERROR "Path: '${path}' is not valid" + return ${EXIT_ERROR} + fi + + log DEBUG "Deleting config file ${path}" + rm -f "${path}" + +} zone_port_settings_read() { assert [ $# -ge 2 ]