}
function device_get() {
- local from_config
-
- while [ $# -gt 0 ]; do
- case "${1}" in
- --from-config)
- from_config=1
- ;;
- --no-config)
- from_config=0
- ;;
- esac
- shift
- done
-
+ local device
local devices
- if [ "${from_config}" != "0" ]; then
- devices="${devices} $(device_config_list)"
- fi
+ for device in ${SYS_CLASS_NET}/*; do
+ device=$(basename ${device})
- if [ "${from_config}" != "1" ]; then
- local device
- for device in ${SYS_CLASS_NET}/*; do
- devices="${devices} $(basename ${device})"
- done
- fi
+ # bonding_masters is no device
+ [ "${device}" = "bonding_masters" ] && continue
+
+ devices="${devices} ${device}"
+ done
echo ${devices}
return ${EXIT_OK}
fi
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