Use the archisolabel= command line option to mount the archiso device.
If the archisolabel= option is specified on the kernel commandline, a device /dev/archiso will be created and will be used to boot the live system. Patch from brain0 <thomas@archlinux.org> Signed-off-by: Gerhard Brauer <gerbra@archlinux.de> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
This commit is contained in:
parent
73dc6b4b1b
commit
9794a6fb7c
2 changed files with 25 additions and 52 deletions
|
@ -50,61 +50,34 @@ run_hook ()
|
||||||
ramdisk_size="75%"
|
ramdisk_size="75%"
|
||||||
fi
|
fi
|
||||||
msg -n ":: Mounting tmpfs, size=${ramdisk_size}..."
|
msg -n ":: Mounting tmpfs, size=${ramdisk_size}..."
|
||||||
mount -t tmpfs -o "size=${ramdisk_size}" tmpfs /tmpfs
|
mount -t tmpfs -o "size=${ramdisk_size}" tmpfs /tmpfs
|
||||||
msg "done."
|
msg "done."
|
||||||
|
|
||||||
# external drives may need to settle
|
msg ":: Waiting for boot device..."
|
||||||
msg ":: Waiting for devices to settle..."
|
|
||||||
/sbin/udevadm trigger --subsystem-match=usb
|
|
||||||
/sbin/udevadm settle
|
|
||||||
usbdelay=$(( ${usbdelay:-0} + 1 ))
|
|
||||||
msg ":: Waiting ${usbdelay}s for USB devices"
|
|
||||||
/bin/sleep "${usbdelay}"
|
|
||||||
|
|
||||||
msg ":: Scanning for boot device..."
|
|
||||||
|
|
||||||
/bin/mkdir -p /bootmnt
|
/bin/mkdir -p /bootmnt
|
||||||
found=0
|
while ! poll_device /dev/archiso 30; do
|
||||||
|
echo "ERROR: boot device didn't show up after 30 seconds..."
|
||||||
/bin/modprobe -q isofs >/dev/null 2>&1
|
echo " Falling back to interactive prompt"
|
||||||
msg ":: Scanning cd drives..."
|
echo " You can try to fix the problem manually, log out when you are finished"
|
||||||
for cdrom in /dev/hd[a-z] /dev/sr[0-9]* /dev/scd[a-z] /dev/sg[0-9]*; do
|
PS1="ramfs$ " /bin/sh -i
|
||||||
[ ! -e "${cdrom}" ] && continue
|
|
||||||
if mount -r -t iso9660 "${cdrom}" /bootmnt >/dev/null 2>&1; then
|
|
||||||
if [ -e "/bootmnt/isomounts" ]; then
|
|
||||||
found=1
|
|
||||||
msg "${cdrom}"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Failed to mount ${cdrom}"
|
|
||||||
fi
|
|
||||||
[ ${found} -eq 0 ] && umount /bootmnt >/dev/null 2>&1
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ${found} -eq 0 ]; then
|
eval $(fstype < /dev/archiso 2>/dev/null)
|
||||||
msg ":: Scanning usb drives..."
|
if [ -n "${FSTYPE}" -a "${FSTYPE}" != "unknown" ]; then
|
||||||
for usb in /dev/sd[a-z][0-9]; do
|
if mount -r -t "${FSTYPE}" /dev/archiso /bootmnt >/dev/null 2>&1; then
|
||||||
[ ! -e "${usb}" ] && continue
|
if [ -e "/bootmnt/isomounts" ]; then
|
||||||
if mount -r -t vfat "${usb}" /bootmnt >/dev/null 2>&1 ||\
|
echo "SUCCESS: Mounted archiso volume successfully."
|
||||||
mount -r -t ext2 "${usb}" /bootmnt >/dev/null 2>&1; then
|
else
|
||||||
if [ -e "/bootmnt/isomounts" ]; then
|
echo "ERROR: Mounting was successful, but the isomounts file does not exist."
|
||||||
found=1
|
exit 1
|
||||||
msg "${usb}"
|
fi
|
||||||
break
|
else
|
||||||
fi
|
echo "ERROR: Failed to mount /dev/archiso"
|
||||||
else
|
|
||||||
echo "Failed to mount ${usb}"
|
|
||||||
fi
|
|
||||||
[ ${found} -eq 0 ] && umount /bootmnt >/dev/null 2>&1
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${found} -eq 0 ]; then
|
|
||||||
echo "ERROR: cannot find boot device, cannot continue..."
|
|
||||||
echo " Falling back to interactive prompt"
|
|
||||||
PS1="ramfs$ " /bin/sh -i
|
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "ERROR: /dev/archiso found, but the filesystem type is unknown."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
/bin/modprobe -q squashfs >/dev/null 2>&1
|
/bin/modprobe -q squashfs >/dev/null 2>&1
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# vim: set ft=sh:
|
# vim: set ft=sh:
|
||||||
run_hook ()
|
run_hook ()
|
||||||
{
|
{
|
||||||
# Set our usbdelay time. Default: 0
|
if [ -n "${archisolabel}" ]; then
|
||||||
cd /
|
echo "ACTION==\"add|change\", SUBSYSTEM==\"block\", IMPORT{program}=\"vol_id --export \$tempnode\"" > /lib/udev/rules.d/00-archiso-device.rules
|
||||||
/bin/mkdir -p etc/modprobe.d/
|
echo "ENV{ID_FS_LABEL_ENC}==\"${archisolabel}\", SYMLINK+=\"archiso\"" >> /lib/udev/rules.d/00-archiso-device.rules
|
||||||
echo "options usb-storage delay_use=${usbdelay:-0}" > /etc/modprobe.d/usb-delay
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue