Explorar el Código

debootstrap debian scripts

Bob Mottram hace 8 años
padre
commit
b4ce259ebe
Se han modificado 2 ficheros con 422 adiciones y 0 borrados
  1. 211
    0
      image_build/debootstrap/scripts/jessie
  2. 211
    0
      image_build/debootstrap/scripts/stretch

+ 211
- 0
image_build/debootstrap/scripts/jessie Ver fichero

@@ -0,0 +1,211 @@
1
+mirror_style release
2
+download_style apt
3
+finddebs_style from-indices
4
+variants - buildd fakechroot minbase scratchbox
5
+keyring /usr/share/keyrings/debian-archive-keyring.gpg
6
+
7
+if doing_variant fakechroot; then
8
+	test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
9
+fi
10
+
11
+case $ARCH in
12
+	alpha|ia64) LIBC="libc6.1" ;;
13
+	kfreebsd-*) LIBC="libc0.1" ;;
14
+	hurd-*)     LIBC="libc0.3" ;;
15
+	*)          LIBC="libc6" ;;
16
+esac
17
+
18
+work_out_debs () {
19
+	required="$(get_debs Priority: required)"
20
+
21
+	if doing_variant - || doing_variant fakechroot; then
22
+		#required="$required $(get_debs Priority: important)"
23
+		#  ^^ should be getting debconf here somehow maybe
24
+		base="$(get_debs Priority: important)"
25
+	elif doing_variant buildd || doing_variant scratchbox; then
26
+		base="apt build-essential"
27
+	elif doing_variant minbase; then
28
+		base="apt"
29
+	fi
30
+
31
+	if doing_variant fakechroot; then
32
+		# ldd.fake needs binutils
33
+		required="$required binutils"
34
+	fi
35
+
36
+	case $MIRRORS in
37
+	    https://*)
38
+		base="$base apt-transport-https ca-certificates"
39
+		;;
40
+	esac
41
+}
42
+
43
+first_stage_install () {
44
+	case "$CODENAME" in
45
+		etch|etch-m68k|jessie|lenny|squeeze|wheezy) ;;
46
+		*) setup_merged_usr ;;
47
+	esac
48
+
49
+	extract $required
50
+
51
+	mkdir -p "$TARGET/var/lib/dpkg"
52
+	: >"$TARGET/var/lib/dpkg/status"
53
+	: >"$TARGET/var/lib/dpkg/available"
54
+
55
+	setup_etc
56
+	if [ ! -e "$TARGET/etc/fstab" ]; then
57
+		echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
58
+		chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
59
+	fi
60
+
61
+	setup_devices
62
+}
63
+
64
+second_stage_install () {
65
+	setup_dynamic_devices
66
+
67
+	x_feign_install () {
68
+		local pkg="$1"
69
+		local deb="$(debfor $pkg)"
70
+		local ver="$(in_target dpkg-deb -f "$deb" Version)"
71
+
72
+		mkdir -p "$TARGET/var/lib/dpkg/info"
73
+
74
+		echo \
75
+"Package: $pkg
76
+Version: $ver
77
+Maintainer: unknown
78
+Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
79
+
80
+		touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
81
+	}
82
+
83
+	x_feign_install dpkg
84
+
85
+	x_core_install () {
86
+		smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
87
+	}
88
+
89
+	p () {
90
+		baseprog="$(($baseprog + ${1:-1}))"
91
+	}
92
+
93
+	if doing_variant fakechroot; then
94
+		setup_proc_fakechroot
95
+	elif doing_variant scratchbox; then
96
+		true
97
+	else
98
+		setup_proc
99
+		in_target /sbin/ldconfig
100
+	fi
101
+
102
+	DEBIAN_FRONTEND=noninteractive
103
+	DEBCONF_NONINTERACTIVE_SEEN=true
104
+	export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
105
+
106
+	baseprog=0
107
+	bases=7
108
+
109
+	p; progress $baseprog $bases INSTCORE "Installing core packages" #1
110
+	info INSTCORE "Installing core packages..."
111
+
112
+	p; progress $baseprog $bases INSTCORE "Installing core packages" #2
113
+	ln -sf mawk "$TARGET/usr/bin/awk"
114
+	x_core_install base-passwd
115
+	x_core_install base-files
116
+	p; progress $baseprog $bases INSTCORE "Installing core packages" #3
117
+	x_core_install dpkg
118
+
119
+	if [ ! -e "$TARGET/etc/localtime" ]; then
120
+		ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
121
+	fi
122
+
123
+	if doing_variant fakechroot; then
124
+		install_fakechroot_tools
125
+	fi
126
+
127
+	p; progress $baseprog $bases INSTCORE "Installing core packages" #4
128
+	x_core_install $LIBC
129
+
130
+	p; progress $baseprog $bases INSTCORE "Installing core packages" #5
131
+	x_core_install perl-base
132
+
133
+	p; progress $baseprog $bases INSTCORE "Installing core packages" #6
134
+	rm "$TARGET/usr/bin/awk"
135
+	x_core_install mawk
136
+
137
+	p; progress $baseprog $bases INSTCORE "Installing core packages" #7
138
+	if doing_variant -; then
139
+		x_core_install debconf
140
+	fi
141
+
142
+	baseprog=0
143
+	bases=$(set -- $required; echo $#)
144
+
145
+	info UNPACKREQ "Unpacking required packages..."
146
+
147
+	exec 7>&1
148
+
149
+	smallyes '' |
150
+		(repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages.  This will be attempted up to five times." "" \
151
+		dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) |
152
+		dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING
153
+
154
+	info CONFREQ "Configuring required packages..."
155
+
156
+	echo \
157
+"#!/bin/sh
158
+exit 101" > "$TARGET/usr/sbin/policy-rc.d"
159
+	chmod 755 "$TARGET/usr/sbin/policy-rc.d"
160
+
161
+	mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
162
+	echo \
163
+"#!/bin/sh
164
+echo
165
+echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
166
+	chmod 755 "$TARGET/sbin/start-stop-daemon"
167
+
168
+	setup_dselect_method apt
169
+
170
+	smallyes '' |
171
+		(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
172
+		dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) |
173
+		dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING
174
+
175
+	baseprog=0
176
+	bases="$(set -- $base; echo $#)"
177
+
178
+	info UNPACKBASE "Unpacking the base system..."
179
+
180
+	setup_available $required $base
181
+	done_predeps=
182
+	while predep=$(get_next_predep); do
183
+		# We have to resolve dependencies of pre-dependencies manually because
184
+		# dpkg --predep-package doesn't handle this.
185
+		predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps")
186
+		# XXX: progress is tricky due to how dpkg_progress works
187
+		# -- cjwatson 2009-07-29
188
+		p; smallyes '' |
189
+		in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep)
190
+		base=$(without "$base" "$predep")
191
+		done_predeps="$done_predeps $predep"
192
+	done
193
+
194
+	smallyes '' |
195
+		(repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages.  This will be re-attempted up to five times." "" \
196
+		dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) |
197
+		dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING
198
+
199
+	info CONFBASE "Configuring the base system..."
200
+
201
+	smallyes '' |
202
+		(repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages.  This will be re-attempted up to five times." "" \
203
+		dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) |
204
+		dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING
205
+
206
+	mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
207
+	rm -f "$TARGET/usr/sbin/policy-rc.d"
208
+
209
+	progress $bases $bases CONFBASE "Configuring base system"
210
+	info BASESUCCESS "Base system installed successfully."
211
+}

+ 211
- 0
image_build/debootstrap/scripts/stretch Ver fichero

@@ -0,0 +1,211 @@
1
+mirror_style release
2
+download_style apt
3
+finddebs_style from-indices
4
+variants - buildd fakechroot minbase scratchbox
5
+keyring /usr/share/keyrings/debian-archive-keyring.gpg
6
+
7
+if doing_variant fakechroot; then
8
+	test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
9
+fi
10
+
11
+case $ARCH in
12
+	alpha|ia64) LIBC="libc6.1" ;;
13
+	kfreebsd-*) LIBC="libc0.1" ;;
14
+	hurd-*)     LIBC="libc0.3" ;;
15
+	*)          LIBC="libc6" ;;
16
+esac
17
+
18
+work_out_debs () {
19
+	required="$(get_debs Priority: required)"
20
+
21
+	if doing_variant - || doing_variant fakechroot; then
22
+		#required="$required $(get_debs Priority: important)"
23
+		#  ^^ should be getting debconf here somehow maybe
24
+		base="$(get_debs Priority: important)"
25
+	elif doing_variant buildd || doing_variant scratchbox; then
26
+		base="apt build-essential"
27
+	elif doing_variant minbase; then
28
+		base="apt"
29
+	fi
30
+
31
+	if doing_variant fakechroot; then
32
+		# ldd.fake needs binutils
33
+		required="$required binutils"
34
+	fi
35
+
36
+	case $MIRRORS in
37
+	    https://*)
38
+		base="$base apt-transport-https ca-certificates"
39
+		;;
40
+	esac
41
+}
42
+
43
+first_stage_install () {
44
+	case "$CODENAME" in
45
+		etch|etch-m68k|jessie|lenny|squeeze|wheezy) ;;
46
+		*) setup_merged_usr ;;
47
+	esac
48
+
49
+	extract $required
50
+
51
+	mkdir -p "$TARGET/var/lib/dpkg"
52
+	: >"$TARGET/var/lib/dpkg/status"
53
+	: >"$TARGET/var/lib/dpkg/available"
54
+
55
+	setup_etc
56
+	if [ ! -e "$TARGET/etc/fstab" ]; then
57
+		echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
58
+		chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
59
+	fi
60
+
61
+	setup_devices
62
+}
63
+
64
+second_stage_install () {
65
+	setup_dynamic_devices
66
+
67
+	x_feign_install () {
68
+		local pkg="$1"
69
+		local deb="$(debfor $pkg)"
70
+		local ver="$(in_target dpkg-deb -f "$deb" Version)"
71
+
72
+		mkdir -p "$TARGET/var/lib/dpkg/info"
73
+
74
+		echo \
75
+"Package: $pkg
76
+Version: $ver
77
+Maintainer: unknown
78
+Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
79
+
80
+		touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
81
+	}
82
+
83
+	x_feign_install dpkg
84
+
85
+	x_core_install () {
86
+		smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
87
+	}
88
+
89
+	p () {
90
+		baseprog="$(($baseprog + ${1:-1}))"
91
+	}
92
+
93
+	if doing_variant fakechroot; then
94
+		setup_proc_fakechroot
95
+	elif doing_variant scratchbox; then
96
+		true
97
+	else
98
+		setup_proc
99
+		in_target /sbin/ldconfig
100
+	fi
101
+
102
+	DEBIAN_FRONTEND=noninteractive
103
+	DEBCONF_NONINTERACTIVE_SEEN=true
104
+	export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
105
+
106
+	baseprog=0
107
+	bases=7
108
+
109
+	p; progress $baseprog $bases INSTCORE "Installing core packages" #1
110
+	info INSTCORE "Installing core packages..."
111
+
112
+	p; progress $baseprog $bases INSTCORE "Installing core packages" #2
113
+	ln -sf mawk "$TARGET/usr/bin/awk"
114
+	x_core_install base-passwd
115
+	x_core_install base-files
116
+	p; progress $baseprog $bases INSTCORE "Installing core packages" #3
117
+	x_core_install dpkg
118
+
119
+	if [ ! -e "$TARGET/etc/localtime" ]; then
120
+		ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
121
+	fi
122
+
123
+	if doing_variant fakechroot; then
124
+		install_fakechroot_tools
125
+	fi
126
+
127
+	p; progress $baseprog $bases INSTCORE "Installing core packages" #4
128
+	x_core_install $LIBC
129
+
130
+	p; progress $baseprog $bases INSTCORE "Installing core packages" #5
131
+	x_core_install perl-base
132
+
133
+	p; progress $baseprog $bases INSTCORE "Installing core packages" #6
134
+	rm "$TARGET/usr/bin/awk"
135
+	x_core_install mawk
136
+
137
+	p; progress $baseprog $bases INSTCORE "Installing core packages" #7
138
+	if doing_variant -; then
139
+		x_core_install debconf
140
+	fi
141
+
142
+	baseprog=0
143
+	bases=$(set -- $required; echo $#)
144
+
145
+	info UNPACKREQ "Unpacking required packages..."
146
+
147
+	exec 7>&1
148
+
149
+	smallyes '' |
150
+		(repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages.  This will be attempted up to five times." "" \
151
+		dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) |
152
+		dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING
153
+
154
+	info CONFREQ "Configuring required packages..."
155
+
156
+	echo \
157
+"#!/bin/sh
158
+exit 101" > "$TARGET/usr/sbin/policy-rc.d"
159
+	chmod 755 "$TARGET/usr/sbin/policy-rc.d"
160
+
161
+	mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
162
+	echo \
163
+"#!/bin/sh
164
+echo
165
+echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
166
+	chmod 755 "$TARGET/sbin/start-stop-daemon"
167
+
168
+	setup_dselect_method apt
169
+
170
+	smallyes '' |
171
+		(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
172
+		dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) |
173
+		dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING
174
+
175
+	baseprog=0
176
+	bases="$(set -- $base; echo $#)"
177
+
178
+	info UNPACKBASE "Unpacking the base system..."
179
+
180
+	setup_available $required $base
181
+	done_predeps=
182
+	while predep=$(get_next_predep); do
183
+		# We have to resolve dependencies of pre-dependencies manually because
184
+		# dpkg --predep-package doesn't handle this.
185
+		predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps")
186
+		# XXX: progress is tricky due to how dpkg_progress works
187
+		# -- cjwatson 2009-07-29
188
+		p; smallyes '' |
189
+		in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep)
190
+		base=$(without "$base" "$predep")
191
+		done_predeps="$done_predeps $predep"
192
+	done
193
+
194
+	smallyes '' |
195
+		(repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages.  This will be re-attempted up to five times." "" \
196
+		dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) |
197
+		dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING
198
+
199
+	info CONFBASE "Configuring the base system..."
200
+
201
+	smallyes '' |
202
+		(repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages.  This will be re-attempted up to five times." "" \
203
+		dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) |
204
+		dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING
205
+
206
+	mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
207
+	rm -f "$TARGET/usr/sbin/policy-rc.d"
208
+
209
+	progress $bases $bases CONFBASE "Configuring base system"
210
+	info BASESUCCESS "Base system installed successfully."
211
+}