From 19fdb4914dd1551e39e4fb28c0ab4552aaff64c8 Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Wed, 27 Mar 2019 11:44:45 +0100 Subject: [PATCH] coverage.sh: auto generate package list for aspcud instead of hardcoding it --- coverage.sh | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- make_mirror.sh | 2 +- mmdebstrap | 8 ++++++++ 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/coverage.sh b/coverage.sh index 908acee..6de1ee9 100755 --- a/coverage.sh +++ b/coverage.sh @@ -52,7 +52,7 @@ if [ ! -e shared/mmdebstrap ] || [ mmdebstrap -nt shared/mmdebstrap ]; then fi starttime= -total=90 +total=91 i=1 print_header() { @@ -253,6 +253,7 @@ cat << END > shared/test.sh set -eu export LC_ALL=C.UTF-8 $CMD --mode=root --variant=apt $DEFAULT_DIST /tmp/debian-chroot $mirror +chroot /tmp/debian-chroot dpkg-query --showformat '\${binary:Package}\n' --show > pkglist.txt tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort > tar1.txt rm -r /tmp/debian-chroot END @@ -496,7 +497,7 @@ cat << END > shared/test.sh set -eu export LC_ALL=C.UTF-8 $CMD --mode=$defaultmode --variant=custom \ - --include apt,base-files,base-passwd,bash,bsdutils,coreutils,dash,debianutils,diffutils,dpkg,findutils,gpgv,grep,gzip,hostname,init-system-helpers,libc-bin,login,mawk,ncurses-base,ncurses-bin,perl-base,sed,sysvinit-utils,tar,util-linux \ + --include \$(cat pkglist.txt | tr '\n' ',') \ --aptopt='APT::Solver "aspcud"' \ $DEFAULT_DIST /tmp/debian-chroot.tar $mirror tar -tf /tmp/debian-chroot.tar | sort \ @@ -1152,6 +1153,49 @@ else ./run_null.sh fi +print_header "mode=root,variant=custom: install busybox-based sub-essential system" +cat << END > shared/test.sh +#!/bin/sh +set -eu +export LC_ALL=C.UTF-8 +$CMD --mode=root --variant=custom \ + --include=dpkg,busybox,libc-bin,base-files,base-passwd,debianutils \ + --setup-hook='mkdir -p "\$1/bin"' \ + --setup-hook='for p in awk cat chmod chown cp diff echo env grep less ln mkdir mount rm rmdir sed sh sleep sort touch uname; do ln -s busybox "\$1/bin/\$p"; done' \ + --setup-hook='echo root:x:0:0:root:/root:/bin/sh > "\$1/etc/passwd"' \ + --setup-hook='printf "root:x:0:\nmail:x:8:\nutmp:x:43:\n" > "\$1/etc/group"' \ + $DEFAULT_DIST /tmp/debian-chroot $mirror +cat << FILE > expected +base-files +base-passwd +busybox +debianutils +dpkg +gcc-8-base:amd64 +libacl1:amd64 +libattr1:amd64 +libbz2-1.0:amd64 +libc-bin +libc6:amd64 +libdebconfclient0:amd64 +libgcc1:amd64 +liblzma5:amd64 +libpcre3:amd64 +libselinux1:amd64 +mawk +tar +zlib1g:amd64 +FILE +chroot /tmp/debian-chroot dpkg-query -f '\${binary:Package}\n' -W | diff -u - expected +rm expected +rm -r /tmp/debian-chroot +END +if [ "$HAVE_QEMU" = "yes" ]; then + ./run_qemu.sh +else + ./run_null.sh SUDO +fi + # test foreign architecture with all modes # create directory in sudo mode @@ -1233,4 +1277,4 @@ if [ -e shared/cover_db/runs ]; then echo fi -rm shared/tar1.txt shared/tar2.txt +rm shared/tar1.txt shared/tar2.txt shared/pkglist.txt diff --git a/make_mirror.sh b/make_mirror.sh index e77bf2f..d669ae3 100755 --- a/make_mirror.sh +++ b/make_mirror.sh @@ -160,7 +160,7 @@ END --or --field=Priority important --or --field=Priority standard \ --or --field=Package build-essential \) ) - pkgs="$(echo $pkgs) build-essential" + pkgs="$(echo $pkgs) build-essential busybox" APT_CONFIG="$rootdir/etc/apt/apt.conf" apt-get --yes install $pkgs diff --git a/mmdebstrap b/mmdebstrap index f30ccbc..1a162f4 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -2609,6 +2609,14 @@ Example: Setup merged-/usr via symlinks --setup-hook='for d in bin sbin lib; do ln -s usr/$d "$1/$d"; mkdir -p "$1/usr/$d"; done' +Example: Setup chroot for installing a sub-essential busybox-based chroot with +--variant=custom --include=dpkg,busybox,libc-bin,base-files,base-passwd,debianutils + + --setup-hook='mkdir -p "$1/bin"' + --setup-hook='for p in awk cat chmod chown cp diff echo env grep less ln mkdir mount rm rmdir sed sh sleep sort touch uname; do ln -s busybox "$1/bin/$p"; done' + --setup-hook='echo root:x:0:0:root:/root:/bin/sh > "$1/etc/passwd"' + --setup-hook='printf "root:x:0:\nmail:x:8:\nutmp:x:43:\n" > "$1/etc/group"' + =item B<--essential-hook>=I Execute arbitrary Is after the Essential:yes packages have been