File: 10apt-cdrom-setup

package info (click to toggle)
apt-setup 1%3A0.166
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,588 kB
  • sloc: sh: 1,185; makefile: 12
file content (38 lines) | stat: -rwxr-xr-x 1,323 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /bin/sh
set -e

. /usr/share/debconf/confmodule

# Can be preseed to true to force cdrom entries to be disabled
db_get apt-setup/disable-cdrom-entries
disable_cdrom_entries="$RET"

# Always disable various sources in sources.list after installation,
# if any other sources are present:
# 1. netinst
# 2. live image
# 3. single-desktop CD image
if [ -e /cdrom/.disk/base_installable ] && \
   [ -e /cdrom/.disk/cd_type ] && \
   ( [ "$(cat /cdrom/.disk/cd_type)" = not_complete ] || \
     [ "$(cat /cdrom/.disk/cd_type)" = live ] || \
     [ "$(cat /cdrom/.disk/cd_type)" = "full_cd/single" ]
   ) && \
   grep -q "^deb \(ht\|f\)tp" /target/etc/apt/sources.list; then
	disable_cdrom_entries="true"
fi

# Comment out the cdrom entries and update APT's cache
if [ "$disable_cdrom_entries" = "true" ]; then
	logger -t finish-install "Disabling CDROM entries in sources.list"
	sed -i "/^deb cdrom:/s/^/#/" /target/etc/apt/sources.list
	cat >> /target/etc/apt/sources.list <<EOF

# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.
EOF
	log-output -t finish-install chroot /target apt-get update
fi