diff options
-rw-r--r-- | archiso-mkinitcpio.conf | 4 | ||||
-rw-r--r-- | archiso_hook (renamed from archlive_hook) | 29 | ||||
-rw-r--r-- | archiso_install (renamed from archlive_install) | 1 | ||||
-rw-r--r-- | boot-cd_hook | 30 | ||||
-rw-r--r-- | boot-cd_install | 8 | ||||
-rw-r--r-- | boot-usb_hook | 30 | ||||
-rw-r--r-- | boot-usb_install | 15 |
7 files changed, 92 insertions, 25 deletions
diff --git a/archiso-mkinitcpio.conf b/archiso-mkinitcpio.conf index d9bcc88..55ae9f3 100644 --- a/archiso-mkinitcpio.conf +++ b/archiso-mkinitcpio.conf @@ -3,4 +3,6 @@ MODULES="" BINARIES="" FILES="" -HOOKS="base udev archlive ide scsi sata usb fw filesystems" + +HOOKS="base udev boot-cd archiso ide scsi sata usb fw filesystems" +#HOOKS="base udev boot-usb archiso ide scsi sata usb fw filesystems" diff --git a/archlive_hook b/archiso_hook index 0b3ea1b..c60df2b 100644 --- a/archlive_hook +++ b/archiso_hook @@ -9,33 +9,16 @@ run_hook () mkdir /tmpfs/bootcd msg "done." - squashfound=0 - #TODO check for usb devices as well... - msg -n ":: Scanning for boot cdrom device..." - squashimg="/tmpfs/bootcd/archlive.sqfs" - - /bin/modprobe -q isofs >/dev/null 2>&1 - for cdrom in /dev/cd/*; do - if mount -r -t iso9660 "${cdrom}" /tmpfs/bootcd >/dev/null 2>&1; then - if [ -e "${squashimg}" ]; then - squashfound=1 - msg "${cdrom}" - break - fi - else - echo "Failed to mount ${cdrom}" - fi - [ ${squashfound} -eq 0 ] && umount /tmpfs/bootcd >/dev/null 2>&1 - done - - if [ ${squashfound} -eq 0 ]; then - echo "ERROR: cannot find booted cdrom device, cannot continue..." + if [ "x${BOOT_MOUNT}" -eq "x" ]; then + echo "ERROR: BOOT_MOUNT is not set. The boot-cd or boot-usb hook MUST" + echo " be run before this one. This image was improperly built" exit 1 fi + squashimg="${BOOT_MOUNT}/archiso.sqfs" if [ "${copytoram}" = "y" ]; then - /bin/cat /tmpfs/bootcd/archlive.sqfs > /tmpfs/archlive.sqfs - squashimg="/tmpfs/archlive.sqfs" + /bin/cat ${squashimg} > /tmpfs/archiso.sqfs + squashimg="/tmpfs/archiso.sqfs" fi msg ":: Mounting squashfs image" diff --git a/archlive_install b/archiso_install index bdb5857..d75a57e 100644 --- a/archlive_install +++ b/archiso_install @@ -4,7 +4,6 @@ install () MODULES="cdrom ide-cd ide-core ide-generic unionfs squashfs isofs $(all_modules '/kernel/fs' | grep -v "nls") " BINARIES="" FILES="" - add_binary /bin/mount /bin/mount.full add_dir /real_root add_dir /tmpfs SCRIPT="archlive" diff --git a/boot-cd_hook b/boot-cd_hook new file mode 100644 index 0000000..d6d9da6 --- /dev/null +++ b/boot-cd_hook @@ -0,0 +1,30 @@ +# vim: set ft=sh: +run_hook () +{ + msg ":: Scanning for boot cdrom device..." + + /bin/mkdir -p /tmpfs/bootmnt + bootmnt="/tmpfs/bootmnt/" + found=0 + + /bin/modprobe -q isofs >/dev/null 2>&1 + for cdrom in /dev/cd/*; do + if mount -r -t iso9660 "${cdrom}" ${bootmnt} >/dev/null 2>&1; then + if [ -e "${bootmnt}/archiso.sqfs" ]; then + found=1 + msg "${cdrom}" + break + fi + else + echo "Failed to mount ${cdrom}" + fi + [ ${found} -eq 0 ] && umount ${bootmnt} >/dev/null 2>&1 + done + + if [ ${found} -eq 0 ]; then + echo "ERROR: cannot find booted cdrom device, cannot continue..." + exit 1 + else + export BOOT_MOUNT="${bootmnt}" + fi +} diff --git a/boot-cd_install b/boot-cd_install new file mode 100644 index 0000000..b7e82ae --- /dev/null +++ b/boot-cd_install @@ -0,0 +1,8 @@ +# vim: set ft=sh: +install () +{ + MODULES="cdrom ide-cd ide-core ide-generic unionfs squashfs isofs $(all_modules '/kernel/fs' | grep -v "nls") " + BINARIES="" + FILES="" + SCRIPT="from-cd" +} diff --git a/boot-usb_hook b/boot-usb_hook new file mode 100644 index 0000000..9898ff6 --- /dev/null +++ b/boot-usb_hook @@ -0,0 +1,30 @@ +# vim: set ft=sh: +run_hook () +{ + msg ":: Scanning for boot usb device..." + + /bin/mkdir -p /tmpfs/bootmnt + bootmnt="/tmpfs/bootmnt/" + found=0 + + for usb in /dev/sd[a-z][0-9]; do + if mount -r -t vfat "${usb}" ${bootmnt} >/dev/null 2>&1 ||\ + mount -r -t ext2 "${usb}" ${bootmnt} >/dev/null 2>&1; then + if [ -e "${bootmnt}/archiso.sqfs" ]; then + found=1 + msg "${usb}" + break + fi + else + echo "Failed to mount ${usb}" + fi + [ ${found} -eq 0 ] && umount ${bootmnt} >/dev/null 2>&1 + done + + if [ ${found} -eq 0 ]; then + echo "ERROR: cannot find booted usb device, cannot continue..." + exit 1 + else + export BOOT_MOUNT="${bootmnt}" + fi +} diff --git a/boot-usb_install b/boot-usb_install new file mode 100644 index 0000000..a1296f9 --- /dev/null +++ b/boot-usb_install @@ -0,0 +1,15 @@ +# vim: set ft=sh: +install () +{ + MODULES="cdrom ide-cd ide-core ide-generic unionfs squashfs $(all_modules '/kernel/fs' | grep -v "nls") " + + MODULES="${MODULES} $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl1811-hcd" -e "isp116x-hcd")" + + MODULES=$(echo ${MODULES}) #trim whitespace + if [ "x${MODULES}" != "x" ]; then + MODULES="${MODULES} usb_storage sd_mod sr_mod" + fi + BINARIES="" + FILES="" + SCRIPT="boot-usb" +} |