File: dfsg-repack.sh

package info (click to toggle)
armadillo 1:9.200.7+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,500 kB
  • sloc: cpp: 137,626; makefile: 75; sh: 34
file content (29 lines) | stat: -rwxr-xr-x 840 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Borrowed from Raphael Geissert's Debian PHP repack script.

set -e

if [ ! -f "$3" ] && [ ! -f "$1" ]; then
    echo "This script must be run via uscan or by manually specifying the tarball" >&2
    exit 1
fi

tarball=

[ -f "$3" ] && tarball="$3"
[ -z "$tarball" -a -f "$1" ] && tarball="$1"

fname="$(basename "$tarball")"
tarball="$(readlink -f "$tarball")"

tdir="$(mktemp -d)"
trap '[ ! -d "$tdir" ] || rm -r "$tdir"' EXIT

xzcat "$tarball" | tar --wildcards --delete '*/mex_interface/*.mat' --delete '*/examples/lib_win64' --delete '*/examples/*_win64.*' --delete '*/*pdf' > "$tdir/${fname/.xz}"
#touch -m -r "$tarball" "$tdir/${fname/.gz}"
xz "$tdir/${fname/.xz}"

mv "$tarball" "$tarball.bkp"
tarballdfsg=$(echo $3|sed 's/\.orig\.tar\.xz/+dfsg.orig.tar.xz/')
echo Writing $tarballdfsg
mv "$tdir/$fname" "$tarballdfsg"