###############################################################################
function port_dir() {
- echo "${CONFIG_DIR}/ports"
+ echo "${NETWORK_CONFIG_DIR}/ports"
+}
+
+function port_get_hook() {
+ local port=${1}
+ assert isset port
+
+ config_get_hook $(port_file ${port})
+}
+
+function port_config_dir() {
+ local port=${1}
+
+ print "${RUN_DIR}/ports/${port}"
+ return ${EXIT_OK}
+}
+
+function port_config_read() {
+ local port=${1}
+ assert isset port
+
+ # Save the HOOK variable.
+ local hook="${HOOK}"
+
+ config_read $(port_file ${port})
+
+ # Restore hook.
+ HOOK="${hook}"
+}
+
+function port_config_write() {
+ local port=${1}
+ assert isset port
+
+ config_write $(port_file ${port})
}
function ports_get_all() {
function port_file() {
local port=${1}
-
assert isset port
echo "$(port_dir)/${port}"
function port_exists() {
local port=${1}
- [ -f "${CONFIG_DIR}/ports/${port}" ]
+ [ -f "${NETWORK_CONFIG_DIR}/ports/${port}" ]
}
function port_get_hook() {
done
}
-# This function automatically creates the real ethernet devices
-# that do not exists in the configuration.
-# Saves some work for the administrator.
-function ports_init() {
- local device
- for device in $(devices_get_all); do
- if device_is_real ${device}; then
- if ! port_exists ${device}; then
- port_create ethernet ${device}
- fi
- fi
- done
-}
-
-init_register ports_init
-
function port_find_free() {
local pattern=${1}