Johannes Schauer Marin Rodrigues
fd33bd2a40
This is so that users calling apt-get install from a hook only need to have APT_CONFIG=$MMDEBSTRAP_APT_CONFIG set and do not also have to pass -oDPkg::Chroot-Directory="$1". This breaks users running apt-get with DPkg::Options::=--force-script-chrootless or with Dpkg::Pre-Install-Pkgs from within a hook with APT_CONFIG=$MMDEBSTRAP_APT_CONFIG. In those situations, DPkg::Chroot-Directory has to be set to the empty string explicitly with -o to overwrite the APT_CONFIG setting. Thanks: Helmut Grohne
28 lines
1.1 KiB
Bash
Executable file
28 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
if [ "${MMDEBSTRAP_VERBOSITY:-1}" -ge 3 ]; then
|
|
set -x
|
|
fi
|
|
|
|
TARGET="$1"
|
|
|
|
if [ "${MMDEBSTRAP_MODE:-}" = "chrootless" ]; then
|
|
APT_CONFIG=$MMDEBSTRAP_APT_CONFIG apt-get --yes install \
|
|
-oDPkg::Chroot-Directory= \
|
|
-oDPkg::Options::=--force-not-root \
|
|
-oDPkg::Options::=--force-script-chrootless \
|
|
-oDPkg::Options::=--root="$TARGET" \
|
|
-oDPkg::Options::=--log="$TARGET/var/log/dpkg.log" \
|
|
usr-is-merged
|
|
export DPKG_ROOT="$TARGET"
|
|
dpkg-query --showformat '${db:Status-Status}\n' --show usr-is-merged | grep -q '^installed$'
|
|
dpkg-query --showformat '${Source}\n' --show usr-is-merged | grep -q '^usrmerge$'
|
|
dpkg --compare-versions "1" "lt" "$(dpkg-query --showformat '${Version}\n' --show usr-is-merged)"
|
|
else
|
|
APT_CONFIG=$MMDEBSTRAP_APT_CONFIG apt-get --yes install usr-is-merged
|
|
chroot "$TARGET" dpkg-query --showformat '${db:Status-Status}\n' --show usr-is-merged | grep -q '^installed$'
|
|
chroot "$TARGET" dpkg-query --showformat '${Source}\n' --show usr-is-merged | grep -q '^usrmerge$'
|
|
dpkg --compare-versions "1" "lt" "$(chroot "$TARGET" dpkg-query --showformat '${Version}\n' --show usr-is-merged)"
|
|
fi
|