summaryrefslogtreecommitdiffstats
path: root/hooks
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-04-22 01:00:28 +0200
committerAaron Griffin <aaron@archlinux.org>2006-04-22 01:00:28 +0200
commitea20a441f8fecc9fa84e0e1f12c4b71bf436f872 (patch)
tree1f2ff1cec1b0629f4ba5639729c9438bcdaf7d44 /hooks
parentacc783c8af5514083e542fe7d91be6a1c5920ad7 (diff)
downloadmkinitcpio-ea20a441f8fecc9fa84e0e1f12c4b71bf436f872.tar.gz
mkinitcpio-ea20a441f8fecc9fa84e0e1f12c4b71bf436f872.tar.xz
Hook updates and changes...
git-svn-id: http://projects.archlinux.org/svn/initramfs/mkinitcpio@7 880c04e9-e011-0410-abf7-b926e227c9cd
Diffstat (limited to 'hooks')
-rw-r--r--hooks/base9
-rw-r--r--hooks/encrypt17
-rw-r--r--hooks/filesystems25
-rw-r--r--hooks/ide23
-rw-r--r--hooks/raid17
-rw-r--r--hooks/resume13
-rw-r--r--hooks/sata34
-rw-r--r--hooks/scsi34
-rw-r--r--hooks/usb7
9 files changed, 179 insertions, 0 deletions
diff --git a/hooks/base b/hooks/base
new file mode 100644
index 0000000..706fb85
--- /dev/null
+++ b/hooks/base
@@ -0,0 +1,9 @@
+# vim:set ft=sh:
+run_hook ()
+{
+ if [ -e "/sys/bus/pci" ]; then
+ msg -n "Loading base modules..."
+ /bin/modprobe -a -q $(/bin/cat /sys/bus/pci/devices/*/modalias) >/dev/null 2>&1 &
+ msg "done."
+ fi
+}
diff --git a/hooks/encrypt b/hooks/encrypt
new file mode 100644
index 0000000..8b4c80b
--- /dev/null
+++ b/hooks/encrypt
@@ -0,0 +1,17 @@
+# vim: set ft=sh:
+run_hook ()
+{
+ echo ""
+ echo "A password is required to access the root filesystem:"
+ echo -n "password: "
+ if /bin/cryptsetup.static isLuks ${root} >/dev/null 2>&1; then
+ /bin/cryptsetup.static luksOpen ${root} root
+ else
+ /bin/cryptsetup create root ${root}
+ fi
+
+ if [ $? != 0 ]; then
+ echo "ERROR: Password Verification Failed"
+ exit 1
+ fi
+}
diff --git a/hooks/filesystems b/hooks/filesystems
new file mode 100644
index 0000000..c676832
--- /dev/null
+++ b/hooks/filesystems
@@ -0,0 +1,25 @@
+# vim: set ft=sh:
+run_hook ()
+{
+ msg -n ":: Loading root filesystem module..."
+ if [ "x${rootfstype}" != "x" ]; then
+ FSTYPE="${rootfstype}"
+ else
+ if [ "x${root}" != "x" ]; then
+ msg "Attempting to create root device '${root}'"
+ dev_t=$( /bin/parseblock "${root}" )
+ if [ "x${dev_t}" != "x" ]; then
+ /bin/mknod "${root}" b ${dev_t}
+ eval $( /bin/fstype < "${root}" )
+ else
+ FSTYPE="unknown"
+ echo "ERROR: Failed to parse block device '${root}'"
+ fi
+ else
+ FSTYPE="unknown"
+ echo "ERROR: root fs cannot be detected. Try using the rootfstype= kernel parameter."
+ fi
+ fi
+ msg " ${FSTYPE}"
+ /bin/modprobe -q "${FSTYPE}" >/dev/null 2>&1
+}
diff --git a/hooks/ide b/hooks/ide
new file mode 100644
index 0000000..0a81062
--- /dev/null
+++ b/hooks/ide
@@ -0,0 +1,23 @@
+# vim: set ft=sh:
+run_hook ()
+{
+ if [ -e /proc/ide ]; then
+ msg -n "Loading ide modules..."
+ /bin/modprobe -q ide-generic >/dev/null 2>&1
+ for d in /proc/ide/*; do
+ unit=${d#/proc/ide/}
+ if [ -e "${d}/media" -a ! -d "/sys/block/${unit}" ]; then
+ read m < "${d}/media"
+ case "${m}" in
+ disk) /bin/modprobe -q ide-disk >/dev/null 2>&1;;
+ cdrom) /bin/modprobe -q ide-cd >/dev/null 2>&1;;
+ tape) /bin/modprobe -q ide-tape >/dev/null 2>&1;;
+ floppy) /bin/modprobe -q ide-floppy >/dev/null 2>&1;;
+ esac
+ fi
+ done
+ msg "done"
+ else
+ msg "No ide devices detected..."
+ fi
+}
diff --git a/hooks/raid b/hooks/raid
new file mode 100644
index 0000000..a81c172
--- /dev/null
+++ b/hooks/raid
@@ -0,0 +1,17 @@
+# vim: set ft=sh:
+
+# kinit handles md/raid assembly
+# we just need modules
+
+install ()
+{
+ MODULES=" $(find "${MODULEDIR}/kernel/drivers/md/" -name *.ko) md raid0 raid1 raid2 raid5 raid6"
+ BINARIES=""
+ FILES=""
+}
+
+run_hook ()
+{
+ #TODO
+ /bin/modprobe -aq raid0 raid1 raid2 raid5 raid6
+}
diff --git a/hooks/resume b/hooks/resume
new file mode 100644
index 0000000..bec926e
--- /dev/null
+++ b/hooks/resume
@@ -0,0 +1,13 @@
+# vim:set ft=sh:
+run_hook ()
+{
+ fmtdevice () { echo "${1}:${2}"; }
+ if [ -e /sys/power/resume ]; then
+ if [ -e "${resume}" ]; then
+ dev_t=$( /bin/parseblock "${resume}" )
+ fmtdevice ${dev_t} > /sys/power/resume
+ fi
+
+ [ -e /proc/suspend2 ] && echo "" > /proc/suspend2/do_resume
+ fi
+}
diff --git a/hooks/sata b/hooks/sata
new file mode 100644
index 0000000..fb6ed90
--- /dev/null
+++ b/hooks/sata
@@ -0,0 +1,34 @@
+# vim: set ft=sh:
+run_hook ()
+{
+ if [ -e /sys/bus/scsi/devices/ ]; then
+ msg -n "Loading scsi modules..."
+ for d in /sys/bus/scsi/devices/*; do
+ if [ -e "${d}/type" ]; then
+ read m < "${d}/type"
+ case "$m" in
+ 0) /bin/modprobe -q sd_mod 2>&1 >/dev/null ;;
+ # this below is take from the Arch udev rules
+ 1) read vendor < "${d}/vendor"
+ if [ "${vendor}" = "Onstream" ]; then
+ read model < "${d}/model"
+ case "$model" in
+ ADR*) /bin/modprobe -q st >/dev/null 2>&1;;
+ *) /bin/modprobe -q osst >/dev/null 2>&1;;
+ esac
+ else
+ /bin/modprobe -q st >/dev/null 2>&1
+ fi
+ ;;
+ 2|3) /bin/modprobe -q sg >/dev/null 2>&1;;
+ 4|5) /bin/modprobe -q sr_mod >/dev/null 2>&1;;
+ 6) /bin/modprobe -q sg >/dev/null 2>&1;;
+ 7) /bin/modprobe -q sd_mod >/dev/null 2>&1;;
+ 8|9) /bin/modprobe -q sg >/dev/null 2>&1;;
+ 14) /bin/modprobe -q sd_mod >/dev/null 2>&1;;
+ esac
+ fi
+ done
+ msg "done."
+ fi
+}
diff --git a/hooks/scsi b/hooks/scsi
new file mode 100644
index 0000000..fb6ed90
--- /dev/null
+++ b/hooks/scsi
@@ -0,0 +1,34 @@
+# vim: set ft=sh:
+run_hook ()
+{
+ if [ -e /sys/bus/scsi/devices/ ]; then
+ msg -n "Loading scsi modules..."
+ for d in /sys/bus/scsi/devices/*; do
+ if [ -e "${d}/type" ]; then
+ read m < "${d}/type"
+ case "$m" in
+ 0) /bin/modprobe -q sd_mod 2>&1 >/dev/null ;;
+ # this below is take from the Arch udev rules
+ 1) read vendor < "${d}/vendor"
+ if [ "${vendor}" = "Onstream" ]; then
+ read model < "${d}/model"
+ case "$model" in
+ ADR*) /bin/modprobe -q st >/dev/null 2>&1;;
+ *) /bin/modprobe -q osst >/dev/null 2>&1;;
+ esac
+ else
+ /bin/modprobe -q st >/dev/null 2>&1
+ fi
+ ;;
+ 2|3) /bin/modprobe -q sg >/dev/null 2>&1;;
+ 4|5) /bin/modprobe -q sr_mod >/dev/null 2>&1;;
+ 6) /bin/modprobe -q sg >/dev/null 2>&1;;
+ 7) /bin/modprobe -q sd_mod >/dev/null 2>&1;;
+ 8|9) /bin/modprobe -q sg >/dev/null 2>&1;;
+ 14) /bin/modprobe -q sd_mod >/dev/null 2>&1;;
+ esac
+ fi
+ done
+ msg "done."
+ fi
+}
diff --git a/hooks/usb b/hooks/usb
new file mode 100644
index 0000000..5766ef9
--- /dev/null
+++ b/hooks/usb
@@ -0,0 +1,7 @@
+# vim: set ft=sh:
+run_hook ()
+{
+ msg -n "Loading usb modules..."
+ /bin/modprobe -aq $(/bin/cat /sys/bus/usb/devices/*/modalias) >/dev/null 2>&1
+ msg "done."
+}