summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-06-06 07:22:35 +0200
committerAaron Griffin <aaron@archlinux.org>2006-06-06 07:22:35 +0200
commitb31ed489b977662292aa39978ee737b94b60af14 (patch)
tree483a6bf418d8899a703ebb4dc3d199a08c8b659c
parent60d742305a5cc070f56e97bc8954a342c3180aec (diff)
downloadmkinitcpio-b31ed489b977662292aa39978ee737b94b60af14.tar.gz
mkinitcpio-b31ed489b977662292aa39978ee737b94b60af14.tar.xz
New error conditions: fail on missing hook or missing module
Filesystem hook changes (parseblock handling) Init changes to allow /arch.cmd command line parsing Misc install script cleanups git-svn-id: http://projects.archlinux.org/svn/initramfs/mkinitcpio@123 880c04e9-e011-0410-abf7-b926e227c9cd
-rw-r--r--hooks/filesystems14
-rw-r--r--init4
-rw-r--r--install/autodetect13
-rw-r--r--install/keymap2
-rw-r--r--install/pcmcia11
-rw-r--r--install/sata2
-rw-r--r--install/scsi2
-rw-r--r--mkinitcpio5
8 files changed, 29 insertions, 24 deletions
diff --git a/hooks/filesystems b/hooks/filesystems
index 12bc945..97d7d57 100644
--- a/hooks/filesystems
+++ b/hooks/filesystems
@@ -13,15 +13,19 @@ run_hook ()
/bin/sleep "${rootdelay}"
msg "done."
export rootdelay=0
- kinit_params="${kinit_params} rootdelay=0"
+ kparams "rootdelay=0"
fi
- eval $( /bin/parseblock "${root}")
- if [ "${BLOCKNAME}" = "unknown" -o "x{BLOCKDEVICE}" = "x" ]; then
+ eval $(/bin/parseblock "${root}")
+ if [ "${BLOCKNAME}" = "unknown" ]; then
FSTYPE="unknown"
- echo "ERROR: Failed to parse block device '${root}'"
+ echo "ERROR: Failed to parse block device name for '${root}'"
+ elif [ "x${BLOCKDEVICE}" = "x" ]; then
+ FSTYPE="unknown"
+ echo "ERROR: Failed to parse block device ids for '${root}'"
else
export root="${BLOCKNAME}"
+ echo "/bin/mknod \"${BLOCKNAME}\" b ${BLOCKDEVICE}"
/bin/mknod "${BLOCKNAME}" b ${BLOCKDEVICE} >/dev/null
fi
fi
@@ -37,7 +41,7 @@ run_hook ()
if [ "${FSTYPE}" = "unknown" ]; then
echo "ERROR: root fs cannot be detected. Try using the rootfstype= kernel parameter."
else
- kinit_params="${kinit_params} rootfstype=${FSTYPE}"
+ kparams "rootfstype=${FSTYPE}"
/bin/modprobe -q "${FSTYPE}" >/dev/null 2>&1
fi
}
diff --git a/init b/init
index 93fcc9a..2d8e9c8 100644
--- a/init
+++ b/init
@@ -2,6 +2,7 @@
msg () { [ "${quiet}" != "y" ] && echo $@; }
err () { echo "ERROR: $@"; }
+kparams () { echo -n "$@" >> /arch.cmd; }
msg ":: Loading Initramfs"
@@ -13,7 +14,6 @@ export CMDLINE
# Used so hooks can override params to kinit
export root=""
-export kinit_params=""
echo "/bin/modprobe" > /proc/sys/kernel/modprobe
for cmd in $CMDLINE; do
@@ -81,4 +81,4 @@ fi
msg ":: Initramfs Completed - control passing to kinit"
echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
-exec /bin/kinit "root=${root}" ${kinit_params} < /dev/console > /dev/null 2>&1
+exec /bin/kinit "root=${root}" "${CMDLINE}"
diff --git a/install/autodetect b/install/autodetect
index e3543e7..ec7e624 100644
--- a/install/autodetect
+++ b/install/autodetect
@@ -4,15 +4,16 @@ install ()
{
MODULE_FILE="$(mktemp /tmp/initcpio_modules.XXXXXX)"
#blegh, we'll let /tmp clean itself up
- AUTODETECT="$(auto_modules -e "/scsi/" -e "/block" -e "/fusion/" \
- -e "/usb/" -e "/ide/" -e "/ieee1394/" -e "/cdrom"\
- -e "/net/" -e "/pcmcia")
+ AUTODETECT="$(auto_modules -e '/scsi/' -e '/block' -e '/fusion/' \
+ -e '/usb/' -e '/ide/' -e '/ieee1394/' -e '/cdrom' \
+ -e '/net/' -e '/pcmcia')
$(cat /proc/filesystems | grep -v nodev) "
if [ -e /sbin/mdadm ]; then
- if [ $UID -eq 0 -o "$(groups | grep disk)" != "" ]; then \
- AUTODETECT="$AUTODETECT $(mdadm -E -s /dev/hd* /dev/sd* /dev/rd/* /dev/ida/* \
- /dev/cciss/* /dev/ataraid/* | awk -Flevel= '{print $2}' | awk '{print $1}')"
+ if [ $UID -eq 0 -o "$(groups | grep disk)" != "" ]; then
+ AUTODETECT="$AUTODETECT
+ $(mdadm -E -s /dev/hd* /dev/sd* /dev/rd/* /dev/ida/* /dev/cciss/* /dev/ataraid/* \
+ | awk -Flevel= '{print $2}' | awk '{print $1}')"
else
err "User does not have proper permissions to read superblocks, raid modules are not detected"
fi
diff --git a/install/keymap b/install/keymap
index 800ab47..0518802 100644
--- a/install/keymap
+++ b/install/keymap
@@ -14,7 +14,7 @@ install ()
grep "KEYMAP=" /etc/rc.conf >> ${KEYMAP_FILE}
grep "CONSOLEFONT=" /etc/rc.conf >> ${KEYMAP_FILE}
grep "CONSOLEMAP=" /etc/rc.conf >> ${KEYMAP_FILE}
- if [ "`echo $LOCALE | /bin/grep -i utf`" ]; then
+ if [ "$(echo $LOCALE | /bin/grep -i utf)" != "" ]; then
echo UTF8="yes" >> ${KEYMAP_FILE}
fi
. ${KEYMAP_FILE}
diff --git a/install/pcmcia b/install/pcmcia
index 4e419c0..b5ca7fb 100644
--- a/install/pcmcia
+++ b/install/pcmcia
@@ -2,17 +2,14 @@
install ()
{
- MODULES=" $(checked_modules "/pcmcia/" | grep -ve "sound" -e "net") $(checked_modules "/ide/legacy")"
+ MODULES=" $(checked_modules '/pcmcia/' | grep -ve 'sound' -e 'net') $(checked_modules '/ide/legacy')"
MODULES=$(echo ${MODULES}) #trim whitespace
if [ "x${MODULES}" != "x" ]; then
- MODULES="${MODULES} sd_mod\nsr_mod\nide-disk\nide-cd"
+ MODULES="${MODULES} sd_mod sr_mod ide-disk ide-cd"
fi
- BINARIES=""
- FILES=""
+ BINARIES="/sbin/pcmcia-socket-startup.static /sbin/pcmcia-check-broken-cis.static"
+ FILES="/etc/pcmcia/config.opts"
SCRIPT=""
- add_file "/sbin/pcmcia-socket-startup.static" "/sbin/pcmcia-socket-startup"
- add_file "/sbin/pcmcia-check-broken-cis.static" "/sbin/pcmcia-check-broken-cis"
- add_file "/etc/pcmcia/config.opts"
}
help ()
diff --git a/install/sata b/install/sata
index 45484c7..dc20045 100644
--- a/install/sata
+++ b/install/sata
@@ -2,7 +2,7 @@
install ()
{
- MODULES=" $(checked_modules "scsi/.*ata") $(checked_modules "block/sx8") \
+ MODULES=" $(checked_modules "scsi/.*ata") $(checked_modules "block/sx8")
$(checked_modules "scsi/ahci") $(checked_modules "scsi/pdc_adma")"
MODULES=$(echo ${MODULES}) #trim whitespace
diff --git a/install/scsi b/install/scsi
index 8e8694b..396de33 100644
--- a/install/scsi
+++ b/install/scsi
@@ -8,7 +8,7 @@ install ()
MODULES=$(echo ${MODULES}) #trim whitespace
if [ "x${MODULES}" != "x" ]; then
- MODULES="${MODULES} sd_mod\nsr_mod"
+ MODULES="${MODULES} sd_mod sr_mod"
fi
BINARIES=""
FILES=""
diff --git a/mkinitcpio b/mkinitcpio
index 291c41e..4df8c2c 100644
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -10,13 +10,14 @@
# use "x${var}" = "x" to test for nulls/empty strings
# incase of embedded spaces, quote all path names and string comarpisons
#
+#TODO trap and remove FILELIST
# Settings
BASEDIR=""
FILELIST="$(mktemp /tmp/.tmpfilelist.XXXX)"
KERNELVERSION="$(uname -r)"
-FUNCTIONS="functions" #/lib/initramfs/functions
+FUNCTIONS="functions"
CONFIG="mkinitcpio.conf"
HOOKDIR="hooks"
INSTDIR="install"
@@ -133,6 +134,8 @@ for hook in $HOOKS; do
echo ":: Parsing hook [${hook}]"
install
parse_hook
+ else
+ die "Hook '${hook}' can not be found."
fi
done