/usr/share/bootcd/bootcdproberoot is in bootcd-mkinitramfs 3.27.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | #!/bin/sh
#
# $Source: /home/bs/src/bootcd/backupcvs/bootcd/bootcd/bootcdproberoot,v $
# $Id: bootcdproberoot,v 1.8 2010-07-15 13:57:47 bs Exp $
# author: Bernd Schumacher <bernd.schumacher@hp.com>
# new start: 14.07.2010
# topic: try to detect the root device and set it as new
# wait for usb, but stop waiting if device is recognized
# uses /sys/block/<name>/dev
#
# search for this file on the cd
bootcdfile="/etc.ro/bootcd/bootcd2disk.conf"
cmdlinedev=$(cat /proc/cmdline | sed "s/^.*\<root=\([^ ]*\)\>.*$/\1/")
ROOT=""
mkdir -p /mnt /dev2
for try in 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1; do
[ $try -eq 20 ] && echo "bootcdproberoot: searching ..." >&2
if [ "$cmdlinedev" = "auto" ]; then
devnames="$(ls /sys/block | /bin/grep -e "^sr" -e "^hd")"
else
[ $try -eq 20 ] && echo "bootcdproberoot: only check device from commandline" >&2
devnames="$(basename $cmdlinedev)"
fi
for devname in $devnames; do
echo "bootcdproberoot: searching on devices $devname" >&2
if [ ! -e "/sys/block/$devname/dev" ]; then
echo "bootcdproberoot: /sys/block/$devname/dev not found." >&2
else
major=$(cat /sys/block/$devname/dev| cut -d":" -f1)
minor=$(cat /sys/block/$devname/dev| cut -d":" -f2)
# try to mount the selected devices to /mnt and look for bootcdfile
# create device
rm -f /dev2/$devname
mknod /dev2/$devname b $major $minor
ret=$(mount -o ro -t iso9660 -n /dev2/$devname /mnt >/dev/null 2>&1; echo $?)
if [ $ret != 0 ]; then
echo "bootcdproberoot: $devname ($major:$minor) is not mountable." >&2
else
if [ ! -e "/mnt/$bootcdfile" ]; then
echo "bootcdproberoot: bootcd files not found on $devname" >&2
umount /mnt
else
echo "bootcdproberoot: found bootcd on $devname" >&2
ROOT=/dev2/$devname
echo "ROOT=$ROOT" >/conf/param.conf
umount /mnt
break 2
fi
fi
fi
done
[ $try -eq 20 ] && echo "bootcdproberoot: waiting max 20 sec for usb" >&2
echo -n "$try " >&2
sleep 1
done
echo "" >&2
if [ ! "$ROOT" ]; then
echo "bootcdproberoot: could not find new root device" >&2
echo "bootcdproberoot: search yourself, try to mount, umount, write result and exit" >&2
echo "bootcdproberoot: exp: echo \"ROOT=/dev/sr0\" > /conf/param.conf" >&2
# For DEBUG /bin/sh is enabled
/bin/sh
fi
|