mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

97 lines
2.5 KiB

#!/bin/bash
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/target/lvp/x86/initrd/linuxrc2
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
scan_for_lvp() {
unset lvp_drives
num_found=0
for x in /dev/cdroms/* ; do
if mount -n ${x} /mnt >/dev/null 2>&1 ; then
if grep -q LVP /mnt/etc/VERSION ; then
lvp_drives="${lvp_drives} ${x}"
num_found=$(( ${num_found} + 1 ))
fi
umount /mnt
fi
done
}
if [ ! -e /dev/cdroms/cdrom0 ] ; then
echo "EEP! I have not found any cdroms!"
echo "Can't continue."
echo
echo "Press -<enter>- to shut down"
read
echo -n o >/proc/sysrq-trigger
fi
first_pass=1
while : ; do
scan_for_lvp
if [ ${num_found} -ne 1 -o ${first_pass} -eq 0 ] ; then
echo "Found ${num_found} LVP Disks. Please choose one:"
choice=0
for x in ${lvp_drives} ; do
choice=$(( ${choice} + 1 ))
echo "${choice} ${x}"
eval "choice_${choice}=${x}"
done
echo
echo "r rescan devices"
echo "0 shut down"
read -p "> " s
if [ "${s}" == "0" ] ; then
echo "Ejecting LVP Disks"
for x in ${lvp_drives} ; do
eject -p ${x}
done
echo
echo "Press -<enter>- to turn off the machine."
read
echo -n o >/proc/sysrq-trigger
while : ; do echo -n ; done
fi
else
s=1
choice_1=${lvp_drives}
echo "Found LVP Disk in ${choice_1}. Starting ..."
fi
first_pass=0
exec 2>/dev/null
if [ ${s} -gt 0 -a ${s} -le ${num_found} ] ; then
eval "x=\${choice_${s}}"
mount -n ${x} /mnt
mount --bind /dev /mnt/dev
chroot /mnt /linuxrc
umount /mnt/dev
# man, this sucks
# sometimes the livesystem's linuxrc seems to be unable to umount everything...
for x in 1 2 3 4 5 6 7 8 9 0 ; do
umount /mnt/* >/dev/null 2>&1
done
umount /mnt
eject ${x}
fi
exec 2>&1
done