Johannes Schauer Marin Rodrigues
4c3fddcd54
- multiple individual shell scripts instead of one 3.5k line monster - tests driven by Python script allowing: * declarative test description in coverage.txt * collecting errors instead of aborting on first error * skipping tests * running specific tests
39 lines
1.3 KiB
Bash
39 lines
1.3 KiB
Bash
#!/bin/sh
|
|
set -eu
|
|
export LC_ALL=C.UTF-8
|
|
cat << SCRIPT > /tmp/checkeatmydata.sh
|
|
#!/bin/sh
|
|
set -exu
|
|
cat << EOF | diff - "\$1"/usr/bin/dpkg
|
|
#!/bin/sh
|
|
exec /usr/bin/eatmydata /usr/bin/dpkg.distrib "\\\$@"
|
|
EOF
|
|
[ -e "\$1"/usr/bin/eatmydata ]
|
|
SCRIPT
|
|
chmod +x /tmp/checkeatmydata.sh
|
|
# first four bytes: magic
|
|
elfheader="\\177ELF"
|
|
# fifth byte: bits
|
|
case "$(dpkg-architecture -qDEB_HOST_ARCH_BITS)" in
|
|
32) elfheader="$elfheader\\001";;
|
|
64) elfheader="$elfheader\\002";;
|
|
*) echo "bits not supported"; exit 1;;
|
|
esac
|
|
# sixth byte: endian
|
|
case "$(dpkg-architecture -qDEB_HOST_ARCH_ENDIAN)" in
|
|
little) elfheader="$elfheader\\001";;
|
|
big) elfheader="$elfheader\\002";;
|
|
*) echo "endian not supported"; exit 1;;
|
|
esac
|
|
# seventh and eigth byte: elf version (1) and abi (unset)
|
|
elfheader="$elfheader\\001\\000"
|
|
{{ CMD }} --mode=root --variant=apt \
|
|
--customize-hook=/tmp/checkeatmydata.sh \
|
|
--essential-hook=/tmp/checkeatmydata.sh \
|
|
--extract-hook='printf "'"$elfheader"'" | cmp --bytes=8 - "$1"/usr/bin/dpkg' \
|
|
--hook-dir=./hooks/eatmydata \
|
|
--customize-hook='printf "'"$elfheader"'" | cmp --bytes=8 - "$1"/usr/bin/dpkg' \
|
|
{{ DIST }} /tmp/debian-chroot {{ MIRROR }}
|
|
tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt -
|
|
rm /tmp/checkeatmydata.sh
|
|
rm -r /tmp/debian-chroot
|