File: load-install-cd

package info (click to toggle)
apt-setup 1%3A0.53%2Bsqueeze2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,032 kB
  • ctags: 17
  • sloc: sh: 982; makefile: 2
file content (37 lines) | stat: -rwxr-xr-x 784 bytes parent folder | download
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
#!/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() {
	cd_ids=$(LC_ALL=C $logoutput --pass-stdout chroot $ROOT \
		 apt-cdrom ident | grep "^Identifying" | cut -d" " -f2)

	for cd_id in $cd_ids; do
		if [ "$cd_id" = "$(head -n1 /var/lib/install-cd.id)" ]; then
			return 0
		fi
	done
	return 1
}

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

fs=iso9660
if db_get cdrom-detect/cdrom_fs && [ "$RET" ]; then
	fs="$RET"
fi
db_get cdrom-detect/cdrom_device
$logoutput mount -t "$fs" -o ro,exec $RET /cdrom