Broke out boot-device locator for usb and cd booting seperatly.

git-svn-id: http://phraktured.net/archiso@14 00a9fe69-e71b-0410-bb23-df0e5024db41
This commit is contained in:
Aaron Griffin 2006-09-28 04:36:34 +00:00
parent c464db5951
commit 2b5cd0819f
7 changed files with 92 additions and 25 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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"

30
boot-cd_hook Normal file
View File

@ -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
}

8
boot-cd_install Normal file
View File

@ -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"
}

30
boot-usb_hook Normal file
View File

@ -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
}

15
boot-usb_install Normal file
View File

@ -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"
}