+# return list of all network devices in array "${niclist[@]}"
+get_network_devices() {
+ local interface
+ niclist=()
+ for interface in /sys/class/net/* ; do
+ [ -e "${interface}" ] || continue
+ interface=$(basename "${interface}")
+ # [ "${interface}" = "lo" ] && continue
+ niclist+=("${interface}")
+ done
+}
+
+# Check if X server is running
+#
+# If xset is missing, we rely on the existence of the $DISPLAY variable.
+NO_DISPLAY=0
+if exectest xset ; then
+ if ! timeout 1s xset q &>/dev/null ; then
+ NO_DISPLAY=1
+ fi
+elif [ -z "${DISPLAY}" ] ; then
+ NO_DISPLAY=1
+fi
+
+if [ "${NO_DISPLAY}" -eq 1 ] ; then
+ $_opt_quiet || echo "W: Running without X server. Not all data will be collected."
+fi