2013-01-23 17:28:19 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# anaconda-diskroot: find our root image on the given disk device
|
|
|
|
# usage: anaconda-diskroot DEVICE [PATH]
|
|
|
|
|
|
|
|
. /lib/anaconda-lib.sh
|
|
|
|
command -v getargbool >/dev/null || . /lib/dracut-lib.sh
|
|
|
|
|
|
|
|
# Run checkisomd5 on a device
|
|
|
|
run_checkisomd5() {
|
|
|
|
livedev=$1
|
|
|
|
if getargbool 0 rd.live.check -d check; then
|
|
|
|
[ -b $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
|
|
|
|
if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
|
|
|
|
[ -x /bin/plymouth ] && /bin/plymouth --hide-splash
|
|
|
|
if [ -n "$DRACUT_SYSTEMD" ]; then
|
|
|
|
p=$(str_replace "$livedev" "-" '\x2d')
|
|
|
|
systemctl start checkisomd5@${p}.service
|
2014-04-07 12:38:09 +00:00
|
|
|
status=$(systemctl -p ExecMainStatus show checkisomd5@${p}.service)
|
|
|
|
splitsep "=" "$status" ignore rc
|
2013-01-23 17:28:19 +00:00
|
|
|
else
|
|
|
|
checkisomd5 --verbose $livedev
|
2014-04-07 12:38:09 +00:00
|
|
|
rc=$?
|
2013-01-23 17:28:19 +00:00
|
|
|
fi
|
2014-04-07 12:38:09 +00:00
|
|
|
if [ "$rc" == "1" ]; then
|
2013-01-23 17:28:19 +00:00
|
|
|
die "CD check failed!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
[ -x /bin/plymouth ] && /bin/plymouth --show-splash
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
dev="$1"
|
|
|
|
path="$2" # optional, could be empty
|
|
|
|
|
|
|
|
[ -e "/dev/root" ] && exit 1 # we already have a root device!
|
|
|
|
|
2015-09-18 01:56:09 +00:00
|
|
|
modprobe -q loop
|
|
|
|
|
2015-05-30 11:20:59 +00:00
|
|
|
# If we're waiting for a cdrom kickstart, the user might need to swap discs.
|
|
|
|
# So if this is a CDROM drive, make a note of it, but don't mount it (yet).
|
|
|
|
# Once we get the kickstart either the udev trigger or disk-reinsertion will
|
|
|
|
# retrigger this script, and we'll mount the disk as normal.
|
|
|
|
if str_starts "$kickstart" "cdrom" && [ ! -e /tmp/ks.cfg.done ]; then
|
|
|
|
if dev_is_cdrom "$dev"; then
|
|
|
|
> /tmp/anaconda-on-cdrom
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2013-01-23 17:28:19 +00:00
|
|
|
info "anaconda using disk root at $dev"
|
|
|
|
mount $dev $repodir || warn "Couldn't mount $dev"
|
|
|
|
anaconda_live_root_dir $repodir $path
|
|
|
|
run_checkisomd5 $dev
|