3
# helper to check if we actually have an ubuntu CD
10
# (if the returncodes change, make sure to update src/cdroms.c)
14
aptoncd_file="$mount_point/aptoncd.info"
17
if [ -z "$mount_point" ]; then
21
if [ -f "$aptoncd_file" ]; then
25
if [ ! -d "$mount_point/ubuntu" ] && [ ! -f "$mount_point/cdromupgrade" ]; then
29
# check if there are "Packages" files on the cd (and ignore the
30
# debian-installer dir)
31
find "$mount_point/dists/" -name "Packages.gz" | grep -q -v debian-installer
33
# 1 means "no lines were selected" in grep (no Packages file but the
34
# debian-installer ones)
39
# get some apt-config vars
44
apt_state_dir="var/lib/apt/"
45
apt_cdrom_list="cdrom.list"
46
eval $(apt-config shell apt_dir Dir \
47
apt_state_dir Dir::State \
48
apt_cdrom_list Dir::State::cdroms)
52
# identifying ... [afkdsjaf] line
53
line=$(apt-cdrom -d="$1" -m ident|grep "\[.*\]")
55
# remove the stuff before "Identifying... [dasjflkd]" -> "dasjflkd"
59
if [ -z "$cdrom_id" ]; then
60
# something bad happened here, we return "not yet scanned" as
61
# fallback (because we are cheap)
65
# [cdrom-id] -> cdrom-id
66
if grep -s -q "$cdrom_id" $apt_dir$apt_state_dir$apt_cdrom_list; then
67
# already in sources.list, ignore
71
# so this is a CD we don't know yet and it has packages. good!
72
THIS_VERSION=$(lsb_release -sr)
73
VERSION_ON_MEDIA=$(awk {'print $2'} "$mount_point/.disk/info")
75
# now check if it contains a signed dist-upgrader
76
for d in "$mount_point"/dists/*/main/dist-upgrader/binary-all/; do
78
# ok, we have one, now check the authentication
79
GPG="gpgv --ignore-time-conflict --keyring /etc/apt/trusted.gpg"
80
if $GPG "$d/"*.tar.gz.gpg "$d"/*.tar.gz; then
81
# verified ok, we have a valid upgrader, if it was not ok, the
82
# fallback to the end is ok because we still have packages on it
83
if dpkg --compare-versions "$THIS_VERSION" lt "$VERSION_ON_MEDIA"; then
90
# we got an ubuntu CD with packages
91
if dpkg --compare-versions "$THIS_VERSION" lt "$VERSION_ON_MEDIA"; then