2013-01-23 17:28:19 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# fetch-kickstart-disk - fetch kickstart from a block device
|
|
|
|
|
|
|
|
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
|
|
|
. /lib/anaconda-lib.sh
|
|
|
|
|
|
|
|
dev="$1"
|
|
|
|
path="${2:-/ks.cfg}"
|
|
|
|
|
|
|
|
[ -e /tmp/ks.cfg.done ] && exit 1
|
|
|
|
[ -b "$dev" ] || exit 1
|
|
|
|
|
|
|
|
info "anaconda: fetching kickstart from $dev:$path"
|
|
|
|
mnt="$(find_mount $dev)"
|
|
|
|
|
|
|
|
if [ -n "$mnt" ]; then
|
2015-05-30 11:20:59 +00:00
|
|
|
cp $mnt$path /tmp/ks.cfg 2>&1
|
2013-01-23 17:28:19 +00:00
|
|
|
else
|
|
|
|
tmpmnt="$(mkuniqdir /run/install tmpmnt)"
|
|
|
|
if mount -o ro $dev $tmpmnt; then
|
2015-05-30 11:20:59 +00:00
|
|
|
cp $tmpmnt/$path /tmp/ks.cfg 2>&1
|
2013-01-23 17:28:19 +00:00
|
|
|
umount $tmpmnt
|
|
|
|
rmdir $tmpmnt
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2015-05-30 11:20:59 +00:00
|
|
|
|
|
|
|
# if we're waiting for a cdrom kickstart, tell the user so they can swap discs
|
|
|
|
if str_starts "$kickstart" "cdrom"; then
|
|
|
|
if [ ! -f /tmp/ks.cfg ]; then
|
|
|
|
tell_user "Please insert CDROM containing '$path'..."
|
|
|
|
exit 0
|
|
|
|
elif [ -f /tmp/anaconda-on-cdrom ]; then
|
|
|
|
tell_user "Kickstart loaded. Please re-insert installation media."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2013-01-23 17:28:19 +00:00
|
|
|
if [ -f /tmp/ks.cfg ]; then
|
|
|
|
parse_kickstart /tmp/ks.cfg
|
|
|
|
run_kickstart
|
|
|
|
else
|
|
|
|
warn "Can't get kickstart from $dev:$path"
|
|
|
|
fi
|