- chdir "/etc/sysconfig";
- sh "mv network network.saved";
- sh "mv networking networking.saved";
- sh "mv network-scripts network-scripts.saved";
- chdir "/etc/init.d";
- sh "mv network network.saved";
- sh "mv functions functions.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.
+ let bind dir =
+ if is_dir dir = Some true then
+ sh ("mount -o bind " ^ quote dir ^ " " ^ quote ("/mnt/root" ^ dir))
+ in
+ let unbind dir =
+ if is_dir dir = Some true then sh ("umount -l " ^ quote ("/mnt/root" ^ dir))
+ in
+ let dirs = [
+ "/bin"; "/sbin"; "/lib"; "/lib64";
+ "/usr/bin"; "/usr/sbin"; "/usr/lib"; "/usr/lib64";
+ "/proc"; "/sys"
+ ] in
+ List.iter bind dirs;
+ let status = shwithstatus "chroot /mnt/root /etc/init.d/network start" in
+ List.iter unbind dirs;
+*)
+
+ (* Simpler way to do the above.
+ * NB. Lazy unmount is required because dhclient keeps its current
+ * directory open on /etc/sysconfig/network-scripts/