summaryrefslogtreecommitdiff
path: root/selfstrap
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2020-10-12 13:08:14 -0400
committerAndrew Cady <d@jerkface.net>2020-10-12 13:08:14 -0400
commit757e35df1bc571cbe414b62cce1d6d3b0eca93b5 (patch)
tree448935636abdbf2ea582869c98d74f726fe282b4 /selfstrap
parent996c430fd798598e1ba4d492741fc2fadf1a3a1e (diff)
hacks and fixes, features and fixtures, axes and fackses
Diffstat (limited to 'selfstrap')
-rwxr-xr-xselfstrap35
1 files changed, 26 insertions, 9 deletions
diff --git a/selfstrap b/selfstrap
index 6766c0c..f5574f4 100755
--- a/selfstrap
+++ b/selfstrap
@@ -2,6 +2,7 @@
2debian_mirror=http://httpredir.debian.org/debian 2debian_mirror=http://httpredir.debian.org/debian
3debian_security_mirror=http://security.debian.org 3debian_security_mirror=http://security.debian.org
4EXTRA_PACKAGES='apt debian-archive-keyring locales' 4EXTRA_PACKAGES='apt debian-archive-keyring locales'
5REAL_DPKG=y
5 6
6die() { printf 'Error: %s\n' "$*"; exit 1; } 7die() { printf 'Error: %s\n' "$*"; exit 1; }
7 8
@@ -35,7 +36,8 @@ while [ $# -gt 0 ]; do
35 EXTRA_PACKAGES="$EXTRA_PACKAGES $x" 36 EXTRA_PACKAGES="$EXTRA_PACKAGES $x"
36 shift ;; 37 shift ;;
37 --chroot) CHROOT_PROG=$2; shift ;; 38 --chroot) CHROOT_PROG=$2; shift ;;
38 --real-apt) REAL_APT_INSTALL=y ;; 39 --real-apt) REAL_APT_INSTALL=y
40 REAL_DPKG=y;;
39 --) shift; break ;; 41 --) shift; break ;;
40 *) usage 1 ;; 42 *) usage 1 ;;
41 esac 43 esac
@@ -195,12 +197,22 @@ populate_rootfs()
195write_sources_list() 197write_sources_list()
196{ 198{
197 local dest="$TARGET"/etc/apt/sources.list 199 local dest="$TARGET"/etc/apt/sources.list
198 [ -e "$dest" ] && return 200 [ ! "$REWRITE_SOURCES_LIST" -a -e "$dest" ] && return
199 printf '%s\n' \ 201 printf 'APT::Default-Release "%s";\n' "$target_release" > "$TARGET"/etc/apt/apt.conf.d/default-release
200 "deb ${debian_mirror} ${target_release} main contrib non-free" \ 202 (
201 "deb ${debian_mirror} ${target_release}-backports main contrib non-free" \ 203 printf '%s\n' \
202 "deb ${debian_security_mirror} ${target_release}/updates main contrib non-free" | 204 "deb ${debian_mirror} ${target_release} main contrib non-free" \
203 column -t > "$dest" 205 "deb ${debian_mirror} ${target_release}-backports main contrib non-free" \
206 "deb ${debian_security_mirror} ${target_release}/updates main contrib non-free"
207 if [ "$target_release" = stretch ]
208 then
209 printf '%s\n' \
210 "deb ${debian_mirror} buster main contrib non-free" \
211 "deb ${debian_mirror} buster-backports main contrib non-free" \
212 "deb ${debian_security_mirror} buster/updates main contrib non-free"
213
214 fi
215 ) | column -t > "$dest"
204} 216}
205 217
206parse_apt_simul_line() 218parse_apt_simul_line()
@@ -337,6 +349,7 @@ apt_extract()
337 349
338dpkg_unpack_from_apt_actions() 350dpkg_unpack_from_apt_actions()
339{ 351{
352 set --
340 while read line; do 353 while read line; do
341 354
342 parse_apt_simul_line "$line" || die "parse_apt_simul_line: unexpected output from apt-get: $line" 355 parse_apt_simul_line "$line" || die "parse_apt_simul_line: unexpected output from apt-get: $line"
@@ -350,8 +363,8 @@ dpkg_unpack_from_apt_actions()
350 case "$action" in 363 case "$action" in
351 Inst) 364 Inst)
352 printf 'Unpacking %s\n' "${deb##*/}" >&2 365 printf 'Unpacking %s\n' "${deb##*/}" >&2
353 if [ "$REAL_APT_INSTALL" ]; then 366 if [ "$REAL_DPKG" ]; then
354 dpkg --extract "$deb" "$TARGET" || die 'dpkg' 367 set -- "$@" "$deb"
355 else 368 else
356 is_multiarch_same "$package" && multiarch=":$arch" || multiarch= 369 is_multiarch_same "$package" && multiarch=":$arch" || multiarch=
357 [ "$UNPACK_ONLY" ] && set_status=unpacked || set_status=installed 370 [ "$UNPACK_ONLY" ] && set_status=unpacked || set_status=installed
@@ -363,6 +376,10 @@ dpkg_unpack_from_apt_actions()
363 *) die "dpkg_unpack_from_apt_actions: unknown apt simul action: $action" ;; 376 *) die "dpkg_unpack_from_apt_actions: unknown apt simul action: $action" ;;
364 esac 377 esac
365 done 378 done
379 if [ $# -gt 0 ]; then
380 dpkg --no-triggers --unpack --force-unsafe-io --root="$TARGET" "$deb" || die 'dpkg'
381 # dpkg --configure --pending --root="$TARGET"
382 fi
366} 383}
367 384
368install_etc_passwd() 385install_etc_passwd()