]> git.ipfire.org Git - people/stevee/network.git/commitdiff
ipsec: Move connections to /etc/network/vpn/ipsec/connections
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 30 Jul 2017 13:29:13 +0000 (15:29 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 30 Jul 2017 13:29:13 +0000 (15:29 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.constants
src/functions/functions.ipsec

index d9ece3eaaa69efb640ffe7a7bd1f90144829d37b..aa7c3ebaf25daedb3d7bdcd6722644687c4fab1d 100644 (file)
@@ -37,6 +37,8 @@ NETWORK_HOOKS_DIR=/usr/lib/network/hooks
 NETWORK_TRIGGERS_DIR=/usr/lib/network/triggers
 NETWORK_SHARE_DIR=/usr/share/network
 
+NETWORK_IPSEC_CONNS_DIR="${NETWORK_CONFIG_DIR}/vpn/ipsec/connections"
+
 # Network file configuration.
 NETWORK_SETTINGS_FILE=${NETWORK_CONFIG_DIR}/config
 NETWORK_SETTINGS_FILE_PARAMS="DEBUG"
index 11e2e9aee6f414d78ff6ae059637a367337426a7..86bbdd7355a1cbcf4608774a567af2b9d78c0ddd 100644 (file)
@@ -96,7 +96,7 @@ ipsec_connection_write_config() {
                return ${EXIT_ERROR}
        fi
 
-       local path="$(ipsec_connection_path "${connection}")/settings"
+       local path="${NETWORK_IPSEC_CONNS_DIR}/${connection}/settings"
 
        if ! settings_write "${path}" ${IPSEC_CONNECTION_CONFIG_SETTINGS}; then
                log ERROR "Could not write configuration settings for VPN IPsec connection ${connection}"
@@ -160,7 +160,7 @@ ipsec_connection_read_config() {
                list_append args $@
        fi
 
-       local path="$(ipsec_connection_path "${connection}")/settings"
+       local path="${NETWORK_IPSEC_CONNS_DIR}/${connection}/settings"
 
        if ! settings_read "${path}" ${args}; then
                log ERROR "Could not read settings for VPN IPsec connection ${connection}"
@@ -168,15 +168,6 @@ ipsec_connection_read_config() {
        fi
 }
 
-# Returns the path to a the directory for given connection
-ipsec_connection_path() {
-       assert [ $# -eq 1 ]
-
-       local connection=${1}
-
-       echo "${NETWORK_CONFIG_DIR}/vpn/ipsec/connection/${connection}"
-}
-
 # This function checks if a vpn ipsec connection exists
 # Returns True when yes and false when not
 ipsec_connection_exists() {
@@ -184,7 +175,7 @@ ipsec_connection_exists() {
 
        local connection=${1}
 
-       local path=$(ipsec_connection_path "${connection}")
+       local path="${NETWORK_IPSEC_CONNS_DIR}/${connection}"
 
        [ -d "${path}" ] && return ${EXIT_TRUE} || return ${EXIT_FALSE}
 }
@@ -595,7 +586,7 @@ ipsec_connection_new() {
 
        log DEBUG "Creating VPN IPsec connection ${connection}"
 
-       if ! mkdir -p $(ipsec_connection_path "${connection}"); then
+       if ! mkdir -p "${NETWORK_IPSEC_CONNS_DIR}/${connection}"; then
                log ERROR "Could not create config directory for ${connection}"
                return ${EXIT_ERROR}
        fi
@@ -623,7 +614,7 @@ ipsec_connection_destroy() {
                fi
 
                log DEBUG "Deleting VPN IPsec connection ${connection}"
-               if ! rm -rf $(ipsec_connection_path "${connection}"); then
+               if ! rm -rf "${NETWORK_IPSEC_CONNS_DIR}/${connection}"; then
                        log ERROR "Deleting the VPN IPsec connection ${connection} was not sucessful"
                        return ${EXIT_ERROR}
                fi