~ubuntu-branches/ubuntu/natty/apt-setup/natty

« back to all changes in this revision

Viewing changes to generators/90services-select

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2010-11-05 12:21:55 UTC
  • mfrom: (0.2.7 sid)
  • Revision ID: james.westby@ubuntu.com-20101105122155-p8pe3yhp1s4me68o
Tags: 1:0.48ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Install the Ubuntu mirror generator instead of Debian's.
  - Set apt-setup/security_host to security.ubuntu.com, or
    ports.ubuntu.com on ports architectures; adjust directory and
    distribution to match.
  - Add security sources for restricted, universe, and multiverse,
    commented out unless the respective components are enabled. Disable
    security generator checks for contrib and non-free.
  - For CD installs, leave the sources.list created by apt-setup in
    /etc/apt/sources.list.apt-setup, and restore the sources.list created
    during base installation for the rest of the installation.
  - Honour OVERRIDE_BASE_INSTALLABLE when checking
    /cdrom/.disk/base_installable.
  - Set the mirror verification timeout to 30 seconds.
  - Disable the volatile service for Ubuntu, and don't ask the
    apt-setup/services-select question.
  - Always disable the CD at the end of installation if any mirrors are
    present, even if it's a complete CD.
  - Pre-populate apt's lists directory with signed Release files for
    archive.ubuntu.com (and mirrors) and security.ubuntu.com, to protect
    against downgrade attacks right from initial installation.
  - Run 'apt-get update' for all sources.list lines produced by a single
    generator in one go, and don't comment out sources.list lines if it
    fails.
  - Make the path to security updates configurable, as well as the host.
  - Remove restricted from cdrom entry if apt-setup/restricted is false.
  - Allow preseeding apt-setup/partner to enable the partner repository,
    and apt-setup/extras to enable extras.ubuntu.com.
  - Make sure apt-cdrom doesn't unmount the CD if cd_type ends with
    /single.
  - Enable all network sources, including security updates, even if the
    network is unconfigured.
  - Honour apt-setup/restricted, apt-setup/universe, and
    apt-setup/multiverse when writing -backports lines.
  - Check to make sure the CD filesystem is iso9660 before remounting it
    as such.  Do not write a CD identifier if we're not working with
    iso9660 so pkgsel does not try to unmount such disks.
  - Run 'apt-get update', without downloading package lists or cleaning up
    old files, after moving the sources.list generated during base system
    installation back into place.
  - If OVERRIDE_LEAVE_CD_MOUNTED is set, don't unmount /cdrom; this is a
    bad idea in a live CD environment!
  - Bail out cleanly from cdrom generator if /cdrom/.disk/info doesn't
    exist or has zero size.
* Add Release files for natty.
* Move partner and extras to the services-select framework, customised for
  Ubuntu (LP: #657176).

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
disable_service() {
13
13
        local to_disable="$1"
14
14
 
15
 
        db_get apt-setup/services-select
 
15
        db_get apt-setup/services-select-ubuntu
16
16
        local services="$RET"
17
17
 
18
18
        local new_services s
23
23
                                new_services=${new_services:+$new_services, }$s
24
24
                        fi
25
25
                done
26
 
                db_set apt-setup/services-select "$new_services"
 
26
                db_set apt-setup/services-select-ubuntu "$new_services"
27
27
                return 0
28
28
        fi
29
29
        return 1
30
30
}
31
31
 
 
32
# Returns 0 if the service was actually added
 
33
enable_service() {
 
34
        local to_enable="$1"
 
35
 
 
36
        db_get apt-setup/services-select-ubuntu
 
37
        local services="$RET"
 
38
 
 
39
        if ! echo "$services" | grep -q $to_enable; then
 
40
                db_set apt-setup/services-select-ubuntu "${services:+$services, }$to_enable"
 
41
                return 0
 
42
        fi
 
43
}
 
44
 
32
45
if ! db_get mirror/suite || [ -z "$RET" ]; then
33
46
        db_get cdrom/suite
34
47
fi
35
48
suite="$RET"
36
49
 
37
 
# No update services available for unstable
38
 
if [ "$suite" = unstable ]; then
39
 
        db_set apt-setup/services-select ""
40
 
        exit
 
50
if (! db_get apt-setup/restricted || [ "$RET" = false ]) && \
 
51
   (! db_get apt-setup/multiverse || [ "$RET" = false ]); then
 
52
        disable_service partner
41
53
fi
42
 
 
43
 
volatile=y
44
 
if [ "$suite" != stable ] && [ "$suite" != oldstable ]; then
45
 
        disable_service volatile || true
46
 
        volatile=n
 
54
if db_get apt-setup/extras && [ "$RET" = true ]; then
 
55
        enable_service extras
47
56
fi
48
57
 
49
58
db_get apt-setup/security_host
50
 
db_subst apt-setup/services-select SEC_HOST "$RET"
51
 
db_get apt-setup/volatile_host
52
 
db_subst apt-setup/services-select VOL_HOST "$RET"
53
 
 
54
 
# Don't ask this for Ubuntu.
55
 
#db_input medium apt-setup/services-select || true
56
 
#if ! db_go; then
57
 
#       exit 10 # back up
58
 
#fi
59
 
 
60
 
# Selecting volatile for testing is invalid
61
 
if [ "$volatile" = n ] && disable_service volatile; then
62
 
        logger -t apt-setup "info: invalid selection of volatile for testing disabled"
 
59
db_subst apt-setup/services-select-ubuntu SEC_HOST "$RET"
 
60
db_subst apt-setup/services-select-ubuntu PARTNER_HOST archive.canonical.com
 
61
db_subst apt-setup/services-select-ubuntu EXTRAS_HOST extras.ubuntu.com
 
62
 
 
63
db_input medium apt-setup/services-select-ubuntu || true
 
64
if ! db_go; then
 
65
        exit 10 # back up
63
66
fi
64
67
 
65
68
# No need to set up proxy here if no services were selected
66
 
db_get apt-setup/services-select
 
69
db_get apt-setup/services-select-ubuntu
67
70
[ "$RET" ] || exit 0
68
71
 
69
 
# Proxy configuration is common to both security and volatile
 
72
# Proxy configuration is common to all services
70
73
if db_get mirror/http/proxy && [ -n "$RET" ]; then
71
74
        proxy="$RET"
72
75
        if ! grep -iq "Acquire::http::Proxy" $ROOT/etc/apt/apt.conf.new; then