~ubuntu-branches/ubuntu/maverick/cdrom-detect/maverick

« back to all changes in this revision

Viewing changes to finish-install

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2006-06-30 18:30:10 UTC
  • Revision ID: james.westby@ubuntu.com-20060630183010-65rs62et74y1zsx4
Tags: 1.16ubuntu1
* Resynchronise with Debian.
* Set cdrom/suite default to edgy.
* Update Ubuntu-specific strings from Rosetta: Bulgarian, Catalan, Czech,
  Greek, Esperanto, Basque, Finnish, Hebrew, Croatian, Hungarian,
  Indonesian, Icelandic, Italian, Lithuanian, Latvian, Russian, Slovenian,
  Thai, Tagalog, Turkish, Ukrainian, Simplified Chinese.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh -e
 
2
 
 
3
. /usr/share/debconf/confmodule
 
4
 
 
5
log() {
 
6
        logger -t cdrom-detect "$@"
 
7
}
 
8
 
 
9
if test -x /target/usr/bin/eject ; then
 
10
        # Cannot just tell eject to eject /cdrom as it is not compatible
 
11
        # with busybox umount. Instead, unmount the cdrom first, and then
 
12
        # eject the device.
 
13
        CDDEV=$(mount | grep "on /cdrom" | cut -d ' ' -f 1)
 
14
        if [ -n "$CDDEV" ]; then
 
15
                log "Unmounting and ejecting '$CDDEV'"
 
16
                umount /cdrom || true
 
17
 
 
18
                db_get cdrom-detect/eject
 
19
                if [ "$RET" = false ]; then
 
20
                        log "Not ejecting CD, per debconf setting."
 
21
                else
 
22
                        /target/usr/bin/eject $CDDEV || true
 
23
                fi
 
24
        else
 
25
                log "Not ejecting CD, as nothing is mounted."
 
26
        fi
 
27
fi
 
28
 
 
29
ARCH="`udpkg --print-architecture`"
 
30
if [ "$ARCH" = i386 ]; then
 
31
    # Set CD-ROM drive parameters for post-reboot.
 
32
 
 
33
    db_get cdrom-detect/cdrom_device
 
34
    device="$RET"
 
35
 
 
36
    db_get cdrom-detect/cdrom_hdparm
 
37
    params="$RET"
 
38
 
 
39
    if [ "$device" ] && [ "$params" ]; then
 
40
        mappeddevice="`mapdevfs "$device"`"
 
41
        cat >>/target/etc/hdparm.conf <<EOF
 
42
 
 
43
# Added by debian-installer
 
44
 
 
45
$mappeddevice {
 
46
EOF
 
47
        set -- $params
 
48
        while [ "$1" ]; do
 
49
            name="$1"
 
50
            shift
 
51
            case "$name" in
 
52
                -??*)
 
53
                    value="${name#-?}"
 
54
                    name="`printf '%s' "$name" | sed 's/^\(-.\).*/\1/'`"
 
55
                    ;;
 
56
                -?*)
 
57
                    value="$1"
 
58
                    shift
 
59
                    ;;
 
60
                *)
 
61
                    continue
 
62
                    ;;
 
63
            esac
 
64
            boolvalue=no
 
65
            case "$name" in
 
66
                -a) mappedname=read_ahead_sect ;;
 
67
                -A) mappedname=lookahead;               boolvalue=yes ;;
 
68
                -b) mappedname=bus;                     boolvalue=yes ;;
 
69
                -B) mappedname=apm ;;
 
70
                -c) mappedname=io32_support ;;
 
71
                -d) mappedname=dma;                     boolvalue=yes ;;
 
72
                -D) mappedname=defect_mana;             boolvalue=yes ;;
 
73
                -E) mappedname=cd_speed ;;
 
74
                -m) mappedname=mult_sect_io ;;
 
75
                -P) mappedname=prefetch_sect ;;
 
76
                -S) mappedname=spindown_time ;;
 
77
                -u) mappedname=interrupt_unmask;        boolvalue=yes ;;
 
78
                -X) mappedname=transfer_mode ;;
 
79
                *)  continue ;;
 
80
            esac
 
81
            if [ "$boolvalue" = yes ]; then
 
82
                case "$value" in
 
83
                    0) mappedvalue=off ;;
 
84
                    1) mappedvalue=on ;;
 
85
                    *) continue ;;
 
86
                esac
 
87
            else
 
88
                mappedvalue="$value"
 
89
            fi
 
90
            printf '\t%s = %s\n' "$mappedname" "$mappedvalue" \
 
91
                >>/target/etc/hdparm.conf
 
92
        done
 
93
        echo '}' >>/target/etc/hdparm.conf
 
94
    fi
 
95
fi