[arch-projects] [PATCH mkinitcpio v2] hooks: add usr hook

Tom Gundersen teg at jklm.no
Tue Aug 2 16:06:30 EDT 2011


This allows /usr to be mounted from within the initrd. Advanced setups
might not work. It is recommended to move /usr to the rootfs.

Signed-off-by: Tom Gundersen <teg at jklm.no>
---

v2: add 'install' and help text
 hooks/usr   |   17 +++++++++++++++++
 install/usr |   15 +++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)
 create mode 100644 hooks/usr
 create mode 100644 install/usr

diff --git a/hooks/usr b/hooks/usr
new file mode 100644
index 0000000..52e9dc7
--- /dev/null
+++ b/hooks/usr
@@ -0,0 +1,17 @@
+# vim: set ft=sh:
+run_hook ()
+{
+    mount_handler=usr_mount_handler
+}
+
+usr_mount_handler () {
+    # mount /
+    default_mount_handler "$@"
+
+    # mount /usr
+    msg -n ":: Mounting /usr..."
+    cp /new_root/etc/fstab /etc/fstab
+    mount /usr
+    mount --move /usr /new_root/usr
+    msg "done."
+}
diff --git a/install/usr b/install/usr
new file mode 100644
index 0000000..96d857d
--- /dev/null
+++ b/install/usr
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+build() {
+    SCRIPT="shutdown"
+}
+
+help () {
+    cat <<HELPEOF
+This hook will try to mount /usr before starting init.
+In order for this to work, /usr needs to be in your /etc/fstab and it
+should be marked for not being fsck'ed (the last option should be 0).
+HELPEOF
+}
+
+# vim: set ft=sh ts=4 sw=4 et:
-- 
1.7.6



More information about the arch-projects mailing list