load-install-cd 891 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
#!/bin/sh
set -e

. /usr/share/debconf/confmodule

ROOT="$1"
[ "$ROOT" ] || exit 1

[ -e /var/lib/install-cd.id ] || exit 0

logoutput="log-output -t load-install-cd"

check_id() {
14
	cd_ids=$(LC_ALL=C $logoutput --pass-stdout chroot $ROOT \
15
		 apt-cdrom ident < /dev/null | grep "^Identifying" | cut -d" " -f2)
16

17 18 19 20 21
	for cd_id in $cd_ids; do
		if [ "$cd_id" = "$(head -n1 /var/lib/install-cd.id)" ]; then
			return 0
		fi
	done
22 23 24 25
	return 1
}

cd_label=$(tail -n1 /var/lib/install-cd.id)
26
db_subst apt-setup/cdrom/media-change LABEL "$cd_label"
27
while ! check_id; do
28
	db_input critical apt-setup/cdrom/media-change || true
29 30 31
	db_go || exit 10
done

32 33 34 35 36 37 38 39 40 41 42 43 44
fs=iso9660
if db_get cdrom-detect/cdrom_fs && [ "$RET" ]; then
	fs="$RET"
fi
OS=$(udpkg --print-os)
case "$OS" in
	hurd)
		OPTIONS=ro
		;;
	*)
		OPTIONS=ro,exec
		;;
esac
45
db_get cdrom-detect/cdrom_device
46
$logoutput mount -t "$fs" -o $OPTIONS $RET /cdrom