diff options
author | Helmut Grohne <helmut@subdivi.de> | 2022-12-23 10:23:16 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2022-12-23 10:23:16 +0100 |
commit | a6b2f6ea32ca96dcca10ff9ff647d5153ab4519f (patch) | |
tree | a229106423b3e80b451a362f29849d6a05ed9dd6 | |
parent | c100114c51d2f5e9e8ed2efd58d065b0dd3b34f8 (diff) | |
parent | a2dbdff591b22d2d85cf0e41b517c41c2bb7ba3f (diff) | |
download | debvm-a6b2f6ea32ca96dcca10ff9ff647d5153ab4519f.tar.gz |
Merge branch main into branch dns
This allows using the newly added DEBVER variable.
-rw-r--r-- | .gitlab-ci.yml | 2 | ||||
-rwxr-xr-x | debvm-create | 73 | ||||
-rwxr-xr-x | debvm-run | 16 |
3 files changed, 68 insertions, 23 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ed0fc32..b2ce36c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -63,6 +63,8 @@ arch_test: - arm64 - armhf - i386 + - mips64el + - mipsel - ppc64el - s390x before_script: diff --git a/debvm-create b/debvm-create index dbf1192..8ea33fb 100755 --- a/debvm-create +++ b/debvm-create @@ -81,11 +81,43 @@ if test -n "$SSHKEY" && ! test -f "$SSHKEY"; then die "error: ssh keyfile '$SSHKEY' not found" fi +case "$SUITE" in + jessie) + DEBVER=8 + ;; + stretch) + DEBVER=9 + ;; + buster) + DEBVER=10 + ;; + bullseye|stable) + DEBVER=11 + ;; + bookworm|testing) + DEBVER=12 + ;; + trixie) + DEBVER=13 + ;; + forky) + DEBVER=14 + ;; + sid|unstable) + DEBVER=999 + ;; + *) + die "unrecognized Debian release: $SUITE" + ;; +esac + + + KERNEL_SUFFIX=-$ARCHITECTURE case "$ARCHITECTURE" in amd64|arm64) KERNEL_SUFFIX="-cloud-$ARCHITECTURE" - if test "$SUITE" = jessie || test "$SUITE" = stretch; then + if test "$DEBVER" -le 9; then KERNEL_SUFFIX="-$ARCHITECTURE" fi ;; @@ -96,10 +128,10 @@ case "$ARCHITECTURE" in KERNEL_SUFFIX=-686-pae ;; mips64el) - KERNEL_SUFFIX=-mips64r2el + KERNEL_SUFFIX=-5kc-malta ;; mipsel) - KERNEL_SUFFIX=-mips32r2el + KERNEL_SUFFIX=-4kc-malta ;; ppc64el) KERNEL_SUFFIX=-powerpc64le @@ -140,10 +172,9 @@ set -- \ --format=ext2 \ "--architecture=$ARCHITECTURE" \ "--include=$INCLUDE_PACKAGES" \ + '--customize-hook=echo "LABEL=debvm / ext4 defaults 0 1" >"$1/etc/fstab"' \ "$@" -# unless we set up a fstab, / will be read-only -set -- "--customize-hook=echo 'LABEL=debvm / ext4 defaults 0 1' >"'"$1/etc/fstab"' "$@" # set up a hostname set -- \ @@ -177,23 +208,21 @@ fi set -- --skip=cleanup/apt "$@" -case "$SUITE" in - jessie) - # Use obsolete and expired keys. - set -- '--keyring=/usr/share/keyrings/debian-archive-removed-keys.gpg' "$@" - set -- --aptopt='Apt::Key::gpgvcommand "/usr/libexec/mmdebstrap/gpgvnoexpkeysig"' "$@" - # chfn does not work, because libpam-runtime.postinst is late setting up /etc/pam.d/common-auth et al, see #1026765 - set -- --extract-hook='chroot "$1" pam-auth-update --package --force' "$@" - ;; - buster) - # We need /var/lib/dpkg/available for dpkg --set-selections to work. - set -- '--customize-hook=cat "$1"/var/lib/apt/lists/*_Packages | chroot "$1" dpkg --update-avail' "$@" - ;; - bookworm|testing|sid|unstable) - # Avoid the usrmerge package - set -- --hook-dir=/usr/share/mmdebstrap/hooks/merged-usr "$@" - ;; -esac +# We need /var/lib/dpkg/available for dpkg --set-selections to work. +set -- '--customize-hook=chroot "$1" apt-cache dumpavail | chroot "$1" dpkg --update-avail' "$@" + +if test "$DEBVER" -le 8; then + # Use obsolete and expired keys. + set -- '--keyring=/usr/share/keyrings/debian-archive-removed-keys.gpg' "$@" + set -- --aptopt='Apt::Key::gpgvcommand "/usr/libexec/mmdebstrap/gpgvnoexpkeysig"' "$@" + # chfn does not work, because libpam-runtime.postinst is late setting up /etc/pam.d/common-auth et al, see #1026765 + set -- --extract-hook='chroot "$1" pam-auth-update --package --force' "$@" +fi + +if test "$DEBVER" -ge 12; then + # Avoid the usrmerge package + set -- --hook-dir=/usr/share/mmdebstrap/hooks/merged-usr "$@" +fi # suite target mirror set -- "$@" "$SUITE" "$IMAGE" "deb $MIRROR $SUITE main" @@ -93,7 +93,6 @@ set -- \ -no-user-config \ -name "debvm-run $IMAGE" \ -m 1G \ - -smp "$(nproc)" \ -kernel "$KERNELTMP" \ -initrd "$INITRDTMP" \ -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \ @@ -101,6 +100,7 @@ set -- \ -device "virtio-net-pci,netdev=net0" \ "$@" +MAX_SMP= if test "$ARCHITECTURE" = "$VMARCH"; then QEMU=kvm # While kvm will fall back gracefully, the following options can only @@ -126,11 +126,25 @@ else ppc64el) QEMU=qemu-system-ppc64 ;; + mips64el) + QEMU="qemu-system-$VMARCH" + MAX_SMP=1 + set -- -cpu 5KEc "$@" + ;; + mipsel) + QEMU="qemu-system-$VMARCH" + MAX_SMP=1 + ;; *) QEMU="qemu-system-$VMARCH" ;; esac fi +if test "$MAX_SMP" -gt 1; then + NPROC=$(nproc) + test "$NPROC" -gt "$MAX_SMP" && NPROC=$MAX_SMP + set -- -smp "$NPROC" "$@" +fi if test -z "$GRAPHICAL"; then set -- -nographic "$@" |