+# Network configuration functions.
+
+# `auto_network $fs' tries to configure the network from the
+# root filesystem. Returns true or false.
+function auto_network {
+ # Make sure this file exists, otherwise Fedora gives a warning.
+ touch /etc/resolv.conf
+
+ pushd /etc/sysconfig
+
+ mv network network.saved
+ mv networking networking.saved
+ mv network-scripts network-scripts.saved
+
+ # Originally I symlinked these, but that causes dhclient to
+ # keep open /mnt/root (as its cwd is in network-scripts subdir).
+ # So now we will copy them recursively instead.
+ cp -r /mnt/root/etc/sysconfig/network .
+ cp -r /mnt/root/etc/sysconfig/networking .
+ cp -r /mnt/root/etc/sysconfig/network-scripts .
+
+ /etc/init.d/network start
+ local status=$?
+
+ rm -rf network networking network-scripts
+ mv network.saved network
+ mv networking.saved networking
+ mv network-scripts.saved network-scripts
+
+ popd
+
+ ping -c 3 $remote_host
+
+ if [ "$greeting" != "no" ]; then
+ echo "Did automatic network configuration work?"
+ echo "(Hint: if not sure, there is a shell on console [ALT] [F2])"
+ echo -n " (y/n) "
+ local line
+ read_line line </dev/console
+ if [ "$line" = "y" -o "$line" = "yes" ]; then return 0; fi
+ return 1
+ fi
+
+ # In non-interactive mode, return the status of /etc/init.d/network.
+ return $status
+}
+
+
+#----------------------------------------------------------------------