summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
8707df4)
There is now one implementation for various types of devices
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
done < ${PROC_NET_VLAN_CONFIG}
}
done < ${PROC_NET_VLAN_CONFIG}
}
+__device_type_matches() {
+ local device="${1}"
+ local type="${2}"
+
+ local _type="$(__device_get_file "${device}" "type")"
+
+ if [ "${type}" = "${_type}" ]; then
+ return ${EXIT_TRUE}
+ fi
+
+ return ${EXIT_FALSE}
+}
+
# Check if the device is a ppp device
device_is_ppp() {
# Check if the device is a ppp device
device_is_ppp() {
- local device=${1}
-
- local type=$(__device_get_file ${device} type)
+ local device="${1}"
+ assert isset device
- [ "${type}" = "512" ] && return ${EXIT_OK} || return ${EXIT_ERROR}
+ __device_type_matches "${device}" 512
}
# Check if the device is a pointopoint device.
}
# Check if the device is a pointopoint device.
- local device=${1}
-
- local type=$(__device_get_file ${device} type)
+ local device="${1}"
+ assert isset device
- [ "${type}" = "768" ] && return ${EXIT_OK} || return ${EXIT_ERROR}
+ __device_type_matches "${device}" 768
- local device=${1}
-
- local type=$(__device_get_file ${device} type)
+ local device="${1}"
+ assert isset device
- [ "${type}" = "769" ] && return ${EXIT_OK} || return ${EXIT_ERROR}
+ __device_type_matches "${device}" 769