diff options
-rwxr-xr-x | bin/debvm-create | 4 | ||||
-rwxr-xr-x | share/customize-dpkgavailable.sh | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/bin/debvm-create b/bin/debvm-create index 9d637b1..981b450 100755 --- a/bin/debvm-create +++ b/bin/debvm-create @@ -291,9 +291,7 @@ if test -n "$SSHKEY"; then fi set -- --skip=cleanup/apt/lists "$@" - -# 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' "$@" +set -- "--customize-hook=$SHARE_DIR/customize-dpkgavailable.sh" "$@" if test "$DEBVER" -le 8; then # Use obsolete and expired keys. diff --git a/share/customize-dpkgavailable.sh b/share/customize-dpkgavailable.sh new file mode 100755 index 0000000..f35b81f --- /dev/null +++ b/share/customize-dpkgavailable.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Copyright 2022 Helmut Grohne <helmut@subdivi.de> +# SPDX-License-Identifier: MIT +# +# This is a mmdebstrap customize hook that initializes dpkg's available +# database from an updated apt package list cache. +# +# Without the available database, dpkg --set-selections won't work. + +set -eu + +APT_CONFIG=$MMDEBSTRAP_APT_CONFIG apt-cache dumpavail | dpkg --root "$1" --update-avail |