summaryrefslogtreecommitdiffstats
path: root/package/ifupdown-scripts/nfs_check
diff options
context:
space:
mode:
authorYann E. MORIN <yann.morin.1998@free.fr>2017-07-02 16:35:50 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2017-07-04 23:38:18 +0200
commit5fb1b867821b4e8968ca7f364196a5e67e80c436 (patch)
treeca663804f556dc9058c8146c170d41ecc404f10b /package/ifupdown-scripts/nfs_check
parentcaaff41ec168d4abe083eccebb534c555b816e66 (diff)
downloadbuildroot-5fb1b867821b4e8968ca7f364196a5e67e80c436.tar.gz
buildroot-5fb1b867821b4e8968ca7f364196a5e67e80c436.zip
package/ifupdown-scripts: new package
The ifupdown scripts can be used independently of the init system, be it sysv, busybox or systemd; they could even be used when there is no init system (i.e. the user is providing his own). Currently, those ifupdown scripts are bundled in the skeleton. But we soon will have a skeleton specific to systemd, so we would be missing those scripts (when systemd-networkd is not enabled). So, move those scripts to their own package. To keep the current behaviour (before it is changed in future commits), we make that package default to y, but depend on the default skeleton. Instead of being a target-finalize hook, the scripts are installed as any other package are, with a package install-target command. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Arnout Vandecappelle <arnout@mind.be> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> [Thomas: drop empty IFUPDOWN_SCRIPTS_SOURCE] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/ifupdown-scripts/nfs_check')
-rwxr-xr-xpackage/ifupdown-scripts/nfs_check20
1 files changed, 20 insertions, 0 deletions
diff --git a/package/ifupdown-scripts/nfs_check b/package/ifupdown-scripts/nfs_check
new file mode 100755
index 0000000000..dfa0cbf580
--- /dev/null
+++ b/package/ifupdown-scripts/nfs_check
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# This allows NFS booting to work while also being able to configure
+# the network interface via DHCP when not NFS booting. Otherwise, a
+# NFS booted system will likely hang during DHCP configuration.
+
+# Attempting to configure the network interface used for NFS will
+# initially bring that network down. Since the root filesystem is
+# accessed over this network, the system hangs.
+
+# This script is run by ifup and will attempt to detect if a NFS root
+# mount uses the interface to be configured (IFACE), and if so does
+# not configure it. This should allow the same build to be disk/flash
+# booted or NFS booted.
+
+nfsip=`sed -n '/^[^ ]*:.* \/ nfs.*[ ,]addr=\([0-9.]\+\).*/s//\1/p' /proc/mounts`
+if [ -n "$nfsip" ] && ip route get to "$nfsip" | grep -q "dev $IFACE"; then
+ echo Skipping $IFACE, used for NFS from $nfsip
+ exit 1
+fi
OpenPOWER on IntegriCloud