~ubuntu-branches/ubuntu/karmic/cdrom-detect/karmic-proposed

« back to all changes in this revision

Viewing changes to debian/cdrom-detect.postinst

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2007-10-20 03:18:36 UTC
  • Revision ID: james.westby@ubuntu.com-20071020031836-cr0qsdfqrsk9449w
Tags: 1.25ubuntu1
* Resynchronise with Debian. Remaining changes:
  - Ubuntu branding (including cdrom/suite Choices and Default).
  - Allow setting default CD-ROM drive parameters using
    cdrom-detect/cdrom_hdparm.
* Set cdrom/suite default to hardy.
* Drop unsupported releases from cdrom/suite Choices.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
# Is a cdrom already mounted?  If so, assume it's the right one..
18
18
mount | grep -q 'on /cdrom' && exit 0
19
 
if [ -e /cdrom/.disk/info ] ; then
 
19
if [ -e /cdrom/.disk/info ]; then
20
20
        CDNAME=`cat /cdrom/.disk/info`
21
21
        log "Detected CD '$CDNAME'"
22
22
        exit 0
114
114
        fi
115
115
done
116
116
 
117
 
if [ -e /cdrom/.disk/info ] ; then
 
117
if [ -e /cdrom/.disk/info ]; then
118
118
        CDNAME=`cat /cdrom/.disk/info`
119
119
        log "Detected CD '$CDNAME'"
120
120
else
155
155
db_progress STOP
156
156
 
157
157
# Set the suite and codename used by base-installer and base-config
158
 
# to the suite/codename that is on the CD. This assumes that there
159
 
# will be no more than one distribution on the CD, and that one of
160
 
# the testing, stable, or unstable links will point to it. Since the
161
 
# CDs currently have many links, parse the Release file to get the
162
 
# actual suite name to use.
163
 
for distlink in stable testing unstable ; do
164
 
        relfile=/cdrom/dists/$distlink/Release
165
 
        if [ -e $relfile ] ; then
166
 
                suite=$(sed -n 's/^Suite: *//p' $relfile)
167
 
                codename=$(sed -n 's/^Codename: *//p' $relfile)
 
158
# to the suite/codename that is on the CD. In case there are multiple
 
159
# suites, prefer the one in default-release.
 
160
for dir in $(cat /etc/default-release) $(ls -1 /cdrom/dists/); do
 
161
        relfile="/cdrom/dists/$dir/Release"
 
162
        if [ -e $relfile ]; then
 
163
                suite=$(sed -n 's/^Suite: *//p' "$relfile")
 
164
                codename=$(sed -n 's/^Codename: *//p' "$relfile")
168
165
                log "Detected CD with '$suite' ($codename) distribution"
169
 
                db_set cdrom/suite $suite
170
 
                db_set cdrom/codename $codename
 
166
                db_set cdrom/suite "$suite"
 
167
                db_set cdrom/codename "$codename"
171
168
 
172
169
                break
173
170
        fi
174
171
done
175
172
 
176
 
if [ -z "$suite" ] ; then
 
173
if [ -z "$suite" ]; then
177
174
        log "Error reading Release file; unable to determine distribution"
178
175
        db_input critical cdrom-detect/no-release || [ $? -eq 30 ]
179
176
        db_go
180
177
        fail
181
178
fi
182
179
 
183
 
# Ask for eject to be installed into /target/, to be able to use it in
184
 
# the finish-install script.
185
 
apt-install eject || true
 
180
# Install eject-udeb, to be able to use it in the finish-install script.
 
181
anna-install eject-udeb || true
186
182
 
187
183
# Hey, we're done
188
184
db_subst cdrom-detect/success cdname "$CDNAME"