source: debian/repack.sh @ 5d1796b

Last change on this file since 5d1796b was 8c13d32, checked in by kytv <kytv@…>, 8 years ago

debian: add repack script and update watch file to use repack.sh

  • Property mode set to 100755
File size: 1.1 KB
Line 
1#!/bin/sh
2
3# Strip out binaries from the official upstream I2P source tarballs that are
4# not required to build the Debian packages.
5
6# Script mostly borrowed from Raphael Geissert's dfsg-repack.sh
7
8
9set -e
10
11if [ ! -f "$3" ] && [ ! -f "$1" ]; then
12    echo "ERROR: This script must be run via uscan or by manually specifying the input tarball." >&2
13    exit 1
14fi
15
16tarball=
17
18[ -f "$3" ] && tarball="$3"
19[ -z "$tarball" -a -f "$1" ] && tarball="$1"
20
21fname=$(basename "$tarball" .bz2)
22tarball=$(readlink -f "$tarball")
23
24tdir=$(mktemp -d)
25trap '[ ! -d "$tdir" ] || rm -r "$tdir"' EXIT
26
27cp -f ${tarball} "$tarball.bkp"
28echo "Filtering tarball contents..."
29bzcat "$tarball" | tar --wildcards --delete '*/installer/lib/*' \
30                        --delete '*/Slackware/*' \
31                        --delete '*/debian/*' > "$tdir/${fname}"
32
33echo "Compressing filtered tarball..."
34bzip2 -9 "$tdir/${fname}"
35
36repackedtarball=$(echo $tarball|sed -e 's/i2psource/i2p/' -e 's/\.orig\.tar\.bz2/+repack.orig.tar.bz2/')
37mv "$tdir/${fname}.bz2" "$repackedtarball"
38echo "Repacked tarball saved to $repackedtarball."
Note: See TracBrowser for help on using the repository browser.