function port_settings_read() {
local port="${1}"
assert isset port
- shift
# Save the HOOK variable.
local hook="${HOOK}"
- settings_read "$(port_file "${port}")" "$@"
+ settings_read "$(port_file "${port}")" ${HOOK_SETTINGS}
# Restore hook.
HOOK="${hook}"
assert isset port
shift
- settings_write "$(port_file "${port}")" "$@"
+ local args
+ if function_exists "hook_check_settings"; then
+ list_append args "--check=\"hook_check_settings\""
+ fi
+ list_append args ${HOOK_SETTINGS}
+
+ settings_write "$(port_file "${port}")" ${args}
}
function ports_get_all() {
return ${EXIT_ERROR}
}
-function port_create() {
+function port_new() {
#local port=${1}
#shift
#
# port_destroy ${port}
#fi
- hook_exec port ${hook} create $@
+ hook_exec port ${hook} new $@
}
function port_destroy() {
rm -f $(port_file ${port})
}
+function port_create() {
+ port_cmd "create" $@
+}
+
function port_remove() {
- port_destroy $@
+ local port="${1}"
+ assert isset port
+
+ # If the device is still up, we need to bring it down first.
+ if device_is_up "${port}"; then
+ port_down "${port}"
+ fi
+
+ port_cmd "remove" "${port}"
}
function port_edit() {