Merge branch 'eatmydata-fixes' into 'master'

Fix apt-helper invocation for older versions.

Fix apt-helper invocation for older versions.
Set up dpkg-divert of dpkg to avoid overwrite when dpkg is properly installed.

See merge request !1
This commit is contained in:
josch 2020-08-24 16:44:54 +00:00
commit cd87402a18
2 changed files with 11 additions and 4 deletions

View file

@ -20,6 +20,7 @@ if ! chroot "$rootdir" dpkg-query --list libeatmydata1; then
rm "$rootdir$libdir"/libeatmydata.so*
fi
mv "$rootdir/usr/bin/dpkg.orig" "$rootdir/usr/bin/dpkg"
rm "$rootdir/usr/bin/dpkg"
chroot "$rootdir" dpkg-divert --local --rename --remove /usr/bin/dpkg
sync

View file

@ -32,7 +32,8 @@ env --chdir="$tmpdir" APT_CONFIG="$tmpfile" apt-get download --print-uris eatmyd
echo "$tmpdir/$fname already exists" >&2
exit 1
fi
env --chdir="$tmpdir" APT_CONFIG="$tmpfile" /usr/lib/apt/apt-helper download-file "$uri" "$fname" Checksum-FileSize:"$size" "$hash"
[ -z "$hash" ] && hash="Checksum-FileSize:$size"
env --chdir="$tmpdir" APT_CONFIG="$tmpfile" /usr/lib/apt/apt-helper download-file "$uri" "$fname" "$hash"
case "$fname" in
eatmydata_*_all.deb)
mkdir -p "$rootdir/usr/bin"
@ -55,9 +56,14 @@ done
rm "$tmpfile"
rmdir "$tmpdir"
mv "$rootdir/usr/bin/dpkg" "$rootdir/usr/bin/dpkg.orig"
mv "$rootdir/usr/bin/dpkg" "$rootdir/usr/bin/dpkg.distrib"
cat << END > "$rootdir/usr/bin/dpkg"
#!/bin/sh
exec /usr/bin/eatmydata /usr/bin/dpkg.orig "\$@"
exec /usr/bin/eatmydata /usr/bin/dpkg.distrib "\$@"
END
chmod +x "$rootdir/usr/bin/dpkg"
cat << END >> "$rootdir/var/lib/dpkg/diversions"
/usr/bin/dpkg
/usr/bin/dpkg.distrib
:
END