Debian Codegraph @

scripts/.debootstrap-scripts/slink

raw
1 #
2 # This script was taken from debootstrap version 0.2.45-0.2, adapted with several changes to match the corresponding changes to "potato" since it was removed, and then hacked to avoid invoking "init u" in postinst scripts (which tries to send SIGHUP to PID 1).
3 #
4
5 mirror_style main
6 download_style apt var-state
7 default_mirror http://archive.debian.org/debian
8 force_md5
9
10 work_out_debs () {
11 required="base-files base-passwd bash bsdutils debianutils diff dpkg e2fsprogs fileutils findutils grep gzip hostname ldso libdb2 libgdbmg1 libncurses4 ncurses3.4 libpam0g libpam0g-util libpwdb0g libreadlineg2 libstdc++2.9 login makedev mawk modutils mount ncurses-base ncurses-bin newt0.25 passwd perl-base procps sed shellutils slang1 sysklogd sysvinit tar textutils update util-linux whiptail"
12
13 base="adduser ae apt elvis-tiny fbset fdutils console-tools console-tools-libs libdb2 locales modconf netbase textutils telnet"
14
15 case $ARCH in
16 "i386")
17 required="$required libc6"
18 base="$base fdflush isapnptools lilo mbr pciutils psmisc setserial syslinux"
19 ;;
20 esac
21 }
22
23 first_stage_install () {
24 extract $required
25
26 :> "$TARGET/var/lib/dpkg/status"
27 echo > "$TARGET/var/lib/dpkg/available"
28
29 setup_etc
30 echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
31 chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
32
33 x_feign_install () {
34 local pkg=$1
35 local deb="$(debfor $pkg)"
36 local ver="$(extract_deb_field "$TARGET/$deb" Version)"
37
38 mkdir -p "$TARGET/var/lib/dpkg/info"
39
40 echo \
41 "Package: $pkg
42 Version: $ver
43 Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
44
45 touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
46 }
47
48 setup_devices
49
50 x_feign_install dpkg
51
52 mv "$TARGET/usr/bin/perl.dist" "$TARGET/usr/bin/perl"
53 }
54
55 second_stage_install () {
56 x_core_install () {
57 in_target dpkg --force-depends --install $(debfor "$@")
58 }
59
60 setup_proc
61 ln "$TARGET/sbin/ldconfig.new" "$TARGET/sbin/ldconfig"
62 in_target /sbin/ldconfig
63
64 x_core_install base-files base-passwd ldso
65 x_core_install dpkg
66
67 ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
68
69 # the libc6 and sysvinit postinst scripts want to run "init u" to re-exec sysvinit, but that sends SIGHUP to PID 1, which is undesirable (for hopefully obvious reasons), so we have to get a little bit clever while installing libc6 and later before configuring the rest of the system
70 x_hack_avoid_postinst_init() {
71 local postinst
72 for postinst in "$TARGET"/var/lib/dpkg/info/*.postinst; do
73 if grep -qE '^[[:space:]]*init[[:space:]]' "$postinst" 2>/dev/null; then
74 sed -ri -e 's/^([[:space:]]*)(init[[:space:]])/\1: # \2/' "$postinst"
75 fi
76 done
77 }
78 in_target dpkg --force-depends --unpack $(debfor libc6)
79 x_hack_avoid_postinst_init
80 in_target dpkg --force-depends --configure libc6
81
82 x_core_install perl-base
83 x_core_install mawk
84
85 repeatn 5 in_target dpkg --force-depends --unpack $(debfor $required)
86
87 # see above
88 x_hack_avoid_postinst_init
89
90 mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
91 cp "$TARGET/bin/true" "$TARGET/sbin/start-stop-daemon"
92
93 setup_dselect_method apt
94
95 in_target dpkg --configure --pending --force-configure-any --force-depends
96
97 smallyes '' | repeatn 5 in_target dpkg --force-auto-select --force-overwrite \
98 --skip-same-version --install $(debfor $base)
99
100 mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
101 }