Skip to content

Commit e8f6228

Browse files
committed
Update Debian package builder
1 parent 17423dc commit e8f6228

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

packaging/scripts/build-deb-package.sh

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@ package_root="$out_dir/deb-root"
99
prefix="$package_root/usr"
1010
etc_dir="$package_root/etc"
1111
debian_dir="$package_root/DEBIAN"
12+
deb_build="$out_dir/deb-build"
1213
deb="$out_dir/turtle-term_${version}_${arch}.deb"
1314

1415
case "$arch" in
1516
amd64|arm64) ;;
1617
*) echo "unsupported Debian architecture: $arch" >&2; exit 2 ;;
1718
esac
1819

19-
command -v dpkg-deb >/dev/null 2>&1 || { echo "dpkg-deb is required" >&2; exit 1; }
20+
command -v ar >/dev/null 2>&1 || { echo "ar is required" >&2; exit 1; }
21+
command -v tar >/dev/null 2>&1 || { echo "tar is required" >&2; exit 1; }
22+
command -v gzip >/dev/null 2>&1 || { echo "gzip is required" >&2; exit 1; }
2023

21-
rm -rf "$package_root" "$deb" "$deb.sha256" "$deb.manifest.json"
22-
mkdir -p "$debian_dir" "$out_dir"
24+
rm -rf "$package_root" "$deb_build" "$deb" "$deb.sha256" "$deb.manifest.json"
25+
mkdir -p "$debian_dir" "$out_dir" "$deb_build"
2326

2427
TURTLE_TERM_STAGE_PREFIX="$prefix" \
2528
TURTLE_TERM_ETC_DIR="$etc_dir" \
@@ -66,7 +69,20 @@ find "$package_root" -type d -exec chmod 0755 {} +
6669
find "$package_root/usr/bin" -type f -exec chmod 0755 {} +
6770
find "$package_root/usr/libexec/turtle-term" -type f -exec chmod 0755 {} +
6871

69-
dpkg-deb -Zgzip --build --root-owner-group "$package_root" "$deb" >/dev/null
72+
printf '2.0\n' > "$deb_build/debian-binary"
73+
(
74+
cd "$debian_dir"
75+
tar --owner=0 --group=0 --numeric-owner -czf "$deb_build/control.tar.gz" .
76+
)
77+
(
78+
cd "$package_root"
79+
tar --owner=0 --group=0 --numeric-owner --exclude='./DEBIAN' -czf "$deb_build/data.tar.gz" .
80+
)
81+
(
82+
cd "$deb_build"
83+
ar rcs "$deb" debian-binary control.tar.gz data.tar.gz
84+
)
85+
7086
sha256sum "$deb" > "$deb.sha256"
7187
python3 "$repo_root/packaging/scripts/write-native-package-manifest.py" \
7288
--package "$deb" \

0 commit comments

Comments
 (0)