- sh "cp -r /mnt/root/etc/sysconfig/network .";
- sh "cp -r /mnt/root/etc/sysconfig/networking .";
- sh "cp -r /mnt/root/etc/sysconfig/network-scripts .";
-
+ 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/
+ *)
+ sh "mount -o bind /mnt/root/etc /etc";