#!/bin/sh
# Correct the control file of .debs built by cargo-deb, which is made
# for Rust binaries and gets two things wrong for data-only packages:
#
# - It takes the architecture from the Rust target and has no way to
# override it, but these packages hold only images, QML and script:
# an amd64-labelled splash screen is one an arm64 device can't
# install. They are rewritten as `Architecture: all`.
# - With nothing to link against, its automatic dependencies come out
# as an empty `Depends:` line, which dpkg need not accept. Empty
# fields are dropped.
#
# Only the control member is repacked; the payload is left
# byte-for-byte alone.
#
# tools/deb-fixup.sh target/debian/*.deb
set -eu
for deb in "$@"; do
deb=$(realpath "$deb")
work=$(mktemp -d)
(
cd "$work"
ar x "$deb"
mkdir control
tar -xJf control.tar.xz -C control
sed -i -e 's/^Architecture: .*/Architecture: all/' \
-e '/^[A-Za-z-]*:[[:space:]]*$/d' control/control
tar --owner=0 --group=0 --numeric-owner -cJf control.tar.xz -C control .
rm "$deb"
# dpkg requires this member order.
ar rc "$deb" debian-binary control.tar.xz data.tar.*
)
rm -rf "$work"
out=$(echo "$deb" | sed 's/_[^_]*\.deb$/_all.deb/')
[ "$deb" = "$out" ] || mv "$deb" "$out"
echo "$out"
done
neiam
/neiam-devices
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
1.3 KiB · text
History
0fc5cce