Fix apt-helper invocation for older versions.
Set up dpkg-divert of dpkg to avoid overwrite when dpkg is properly installed.
This commit is contained in:
parent
307cbf5a41
commit
5e66a4fb7f
2 changed files with 11 additions and 4 deletions
|
@ -20,6 +20,7 @@ if ! chroot "$rootdir" dpkg-query --list libeatmydata1; then
|
||||||
rm "$rootdir$libdir"/libeatmydata.so*
|
rm "$rootdir$libdir"/libeatmydata.so*
|
||||||
fi
|
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
|
sync
|
||||||
|
|
|
@ -32,7 +32,8 @@ env --chdir="$tmpdir" APT_CONFIG="$tmpfile" apt-get download --print-uris eatmyd
|
||||||
echo "$tmpdir/$fname already exists" >&2
|
echo "$tmpdir/$fname already exists" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
case "$fname" in
|
||||||
eatmydata_*_all.deb)
|
eatmydata_*_all.deb)
|
||||||
mkdir -p "$rootdir/usr/bin"
|
mkdir -p "$rootdir/usr/bin"
|
||||||
|
@ -55,9 +56,14 @@ done
|
||||||
rm "$tmpfile"
|
rm "$tmpfile"
|
||||||
rmdir "$tmpdir"
|
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"
|
cat << END > "$rootdir/usr/bin/dpkg"
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
exec /usr/bin/eatmydata /usr/bin/dpkg.orig "\$@"
|
exec /usr/bin/eatmydata /usr/bin/dpkg.distrib "\$@"
|
||||||
END
|
END
|
||||||
chmod +x "$rootdir/usr/bin/dpkg"
|
chmod +x "$rootdir/usr/bin/dpkg"
|
||||||
|
cat << END >> "$rootdir/var/lib/dpkg/diversions"
|
||||||
|
/usr/bin/dpkg
|
||||||
|
/usr/bin/dpkg.distrib
|
||||||
|
:
|
||||||
|
END
|
||||||
|
|
Loading…
Reference in a new issue