Parameterize LiveOS so that we can support multiple images on a stick

Booting with live_dir=foo will now look in foo/ rather than LiveOS/
for the live image bits and pieces
This commit is contained in:
Jeremy Katz 2009-03-06 16:54:17 -05:00
parent cafd01a101
commit c153a50c0b

View File

@ -121,6 +121,14 @@ if [ -b \`readlink -f /dev/live\` ]; then
mount -o ro /dev/live /mnt/live 2>/dev/null || mount /dev/live /mnt/live mount -o ro /dev/live /mnt/live 2>/dev/null || mount /dev/live /mnt/live
fi fi
livedir="LiveOS"
for arg in \`cat /proc/cmdline\` ; do
if [ "\${arg##live_dir=}" != "\${arg}" ]; then
livedir=\${arg##live_dir=}
return
fi
done
# enable swaps unless requested otherwise # enable swaps unless requested otherwise
swaps=\`blkid -t TYPE=swap -o device\` swaps=\`blkid -t TYPE=swap -o device\`
if ! strstr "\`cat /proc/cmdline\`" noswap && [ -n "\$swaps" ] ; then if ! strstr "\`cat /proc/cmdline\`" noswap && [ -n "\$swaps" ] ; then
@ -128,8 +136,8 @@ if ! strstr "\`cat /proc/cmdline\`" noswap && [ -n "\$swaps" ] ; then
action "Enabling swap partition \$s" swapon \$s action "Enabling swap partition \$s" swapon \$s
done done
fi fi
if ! strstr "\`cat /proc/cmdline\`" noswap && [ -f /mnt/live/LiveOS/swap.img ] ; then if ! strstr "\`cat /proc/cmdline\`" noswap && [ -f /mnt/live/\${livedir}/swap.img ] ; then
action "Enabling swap file" swapon /mnt/live/LiveOS/swap.img action "Enabling swap file" swapon /mnt/live/\${livedir}/swap.img
fi fi
mountPersistentHome() { mountPersistentHome() {
@ -179,8 +187,8 @@ findPersistentHome() {
if strstr "\`cat /proc/cmdline\`" persistenthome= ; then if strstr "\`cat /proc/cmdline\`" persistenthome= ; then
findPersistentHome findPersistentHome
elif [ -e /mnt/live/LiveOS/home.img ]; then elif [ -e /mnt/live/\${livedir}/home.img ]; then
homedev=/mnt/live/LiveOS/home.img homedev=/mnt/live/\${livedir}/home.img
fi fi
# if we have a persistent /home, then we want to go ahead and mount it # if we have a persistent /home, then we want to go ahead and mount it