ip addr show ${device} | grep -q "inet6 ${addr}"
}
-function device_config_list() {
- local device
- for device in ${CONFIG_DIR}/devices/*; do
- device=$(basename ${device})
- if device_config_exists ${device}; then
- echo "${device}"
- fi
- done
-}
-
-function device_config_exists() {
- local device=${1}
-
- [ -e "${CONFIG_DIR}/devices/${device}" ]
-}
-
-function device_config_write() {
- local device=${1}
- shift
-
- config_write ${CONFIG_DIR}/devices/${device} $@
-}
-
-function device_config_read() {
- local device=${1}
-
- config_read ${CONFIG_DIR}/devices/${device}
-}
-
-function device_create() {
- local hook=${1}
- shift
-
- if ! hook_exists device ${hook}; then
- error "Hook '${hook}' does not exist."
- return ${EXIT_ERROR}
- fi
-
- hook_exec device ${hook} create $@
-}
-
-# XXX to be fixed
-function device_up() {
- local device=${1}
- shift
-
- if ! device_config_exists ${device}; then
- error "Device '${device}' does not exist."
- return ${EXIT_ERROR}
- fi
-
- local hook=$(config_get_hook ${CONFIG_DIR}/devices/${device})
-
- if ! hook_exists device ${hook}; then
- error "Hook '${hook}' does not exist."
- return ${EXIT_ERROR}
- fi
-
- hook_exec device ${hook} up ${device} $@
-}
-
-# XXX to be fixed
-function device_down() {
- local device=${1}
- shift
-
- if ! device_config_exists ${device}; then
- error "Device '${device}' does not exist."
- return ${EXIT_ERROR}
- fi
-
- local hook=$(config_get_hook ${CONFIG_DIR}/devices/${device})
-
- if ! hook_exists device ${hook}; then
- error "Hook '${hook}' does not exist."
- return ${EXIT_ERROR}
- fi
-
- hook_exec device ${hook} down ${device} $@
-}
-
-function device_print() {
- local device=${1}
- local type=$(device_get_type ${device})
-
- echo "${device}"
- printf "${DEVICE_PRINT_LINE1}" "Type:" "${type}"
-
- #device_config_exists ${device}
- #local has_config=$?
-
- # XXX need something is_function() method here
- if [ -n "$(type -t ${type}_device_print)" ]; then
- ${type}_device_print ${device}
- fi
-
- echo # Empty line
-}
-
function __device_get_file() {
local device=${1}
local file=${2}