3
# helper to check if we actually have an ubuntu CD
11
# (if the returncodes change, make sure to update src/gdu.c)
15
addon_dir="$mount_point/app-install/"
16
aptoncd_file="$mount_point/aptoncd.info"
19
if [ -z "$mount_point" ]; then
23
if [ -f "$aptoncd_file" ]; then
27
if [ ! -d "$mount_point/ubuntu" ] && [ ! -f "$mount_point/cdromupgrade" ]; then
31
# check if there are "Packages" files on the cd (and ignore the
32
# debian-installer dir)
33
find "$mount_point/dists/" -name "Packages.gz" | grep -q -v debian-installer
35
# 1 means "no lines were selected" in grep (no Packages file but the
36
# debian-installer ones)
41
# get some apt-config vars
46
apt_state_dir="var/lib/apt/"
47
apt_cdrom_list="cdrom.list"
48
eval $(apt-config shell apt_dir Dir \
49
apt_state_dir Dir::State \
50
apt_cdrom_list Dir::State::cdroms)
54
# identifying ... [afkdsjaf] line
55
line=$(apt-cdrom -d="$1" -m ident|grep "\[.*\]")
57
# remove the stuff before "Identifying... [dasjflkd]" -> "dasjflkd"
61
if [ -z "$cdrom_id" ]; then
62
# something bad happened here, we return "not yet scanned" as
63
# fallback (because we are cheap)
67
# we always return ADDON cd regardless if we know it already or not
68
# the rationale is that it easier for people this way and less
70
if [ -d "$addon_dir" ] && [ -x /usr/bin/gnome-app-install ]; then
74
# [cdrom-id] -> cdrom-id
75
if grep -s -q "$cdrom_id" $apt_dir$apt_state_dir$apt_cdrom_list; then
76
# already in sources.list, ignore
80
# so this is a CD we don't know yet and it has packages. good!
82
# now check if it contains a signed dist-upgrader
83
for d in "$mount_point"/dists/*/main/dist-upgrader/binary-all/; do
85
# ok, we have one, now check the authentication
86
GPG="gpgv --ignore-time-conflict --keyring /etc/apt/trusted.gpg"
87
if $GPG "$d/"*.tar.gz.gpg "$d"/*.tar.gz; then
88
# verified ok, we have a valid upgrader, if it was not ok, the
89
# fallback to the end is ok because we still have packages on it
95
# we got an ubuntu CD with packages