+verbose-message Initializing $ETH_DEVICE
+/usr/libexec/nm-ifup $ETH_DEVICE || /sbin/ifconfig $ETH_DEVICE up || {
+ verbose-message "pl_netinit: device $ETH_DEVICE does not exist, most likely"
+ verbose-message "pl_netinit: this CD does not have hardware support for your"
+ verbose-message "pl_netinit: network adapter. please send the following lines"
+ verbose-message "pl_netinit: to your PlanetLab support for further assistance"
+ net-init-failed
+}
+
+# my understanding is this is used to upload to MyPLC
+# details like mac addresses and the like
+# for backwards compatibility, in a best-effort manner,
+# we try and compensate for the disappearance of ifconfig
+( /sbin/ifconfig $ETH_DEVICE || ip address show $ETH_DEVICE ) > $IFCONFIG_OUTPUT
+
+verbose-message "pl_netinit: network online"
+
+# patch for f22 and above - if /etc/resolv.conf is empty or missing
+function pl-netinit-patch-resolv-conf () {
+ file="$1"; shift
+ needed=""
+ # missing file : patch needed
+ if ! [ -f $file ]; then
+ needed=true
+ # empty file : patch needed
+ else
+ contents=$(grep -v '^#' $file)
+ contents=$(echo $contents)
+ [ -z "$contents" ] && needed=true
+ fi
+ if [ -z "$needed" ]; then
+ echo pl_netinit has no need to patch $file
+ return
+ fi