- echo "Dir::Bin::apt-key \"${BUILDDIRECTORY}/apt-key\";" >> aptconfig.conf
- fi
- echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf
- echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf
- echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf
- echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf
- echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf
- if ! command dpkg --assert-multi-arch >/dev/null 2>&1; then
- echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf # Added to test multiarch before dpkg is ready for it…
- fi
- echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
- echo 'quiet::NoUpdate "true";' >> aptconfig.conf
- echo 'quiet::NoStatistic "true";' >> aptconfig.conf
- # too distracting for users, but helpful to detect changes
- echo 'Acquire::Progress::Ignore::ShowErrorText "true";' >> aptconfig.conf
- # in testcases, it can appear as if localhost has a rotation setup,
- # hide this as we can't really deal with it properly
- echo 'Acquire::Failure::ShowIP "false";' >> aptconfig.conf
+ export LD_LIBRARY_PATH='${TMPWORKINGDIRECTORY}'
+ fi
+ if [ -n "\$LD_PRELOAD" ]; then
+ export LD_PRELOAD="noopchroot.so \${LD_PRELOAD}"
+ else
+ export LD_PRELOAD="noopchroot.so"
+ fi
+fi
+EOF
+ cp "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg"
+ cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <<EOF
+exec fakeroot '${DPKG:-dpkg}' --root='${TMPWORKINGDIRECTORY}/rootdir' \\
+ --log='${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log' \\
+ --force-not-root --force-bad-path "\$@"
+EOF
+ cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" <<EOF
+exec fakeroot gdb --quiet -ex run '${DPKG:-dpkg}' --args '${DPKG:-dpkg}' --root='${TMPWORKINGDIRECTORY}/rootdir' \\
+ --log='${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log' \\
+ --force-not-root --force-bad-path "\$@"
+EOF
+ chmod +x "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg"
+ echo "Dir::Bin::dpkg \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg\";" > rootdir/etc/apt/apt.conf.d/99dpkg
+
+ {
+ if ! command dpkg --assert-multi-arch >/dev/null 2>&1; then
+ echo "DPKG::options:: \"--force-architecture\";" # Added to test multiarch before dpkg is ready for it…
+ fi
+ echo 'quiet "0";'
+ echo 'quiet::NoUpdate "true";'
+ echo 'quiet::NoStatistic "true";'
+ # too distracting for users, but helpful to detect changes
+ echo 'Acquire::Progress::Ignore::ShowErrorText "true";'
+ echo 'Acquire::Progress::Diffpercent "true";'
+ # in testcases, it can appear as if localhost has a rotation setup,
+ # hide this as we can't really deal with it properly
+ echo 'Acquire::Failure::ShowIP "false";'
+ # fakeroot can't fake everything, so disabled in production but good for tests
+ echo 'APT::Sandbox::Verify "true";'
+ } >> aptconfig.conf