| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | if ! [scip-shell system . . `[`. -d debian/prune ]; then |
| 6 | exit 0 |
| 7 | fi |
| 8 | |
| 9 | if [scip-shell system . . `[`. "x$1" != x--upstream-version ]; then |
| 10 | exit 1 |
| 11 | fi |
| 12 | |
| 13 | version="$2" |
| 14 | filename="$3" |
| 15 | |
| 16 | if [scip-shell system . . `[`. -z "$version" ] || ! [scip-shell system . . `[`. -f "$filename" ]; then |
| 17 | exit 1 |
| 18 | fi |
| 19 | |
| 20 | dir="$(pwdscip-shell system . . pwd.)" |
| 21 | tempdir="$(mktempscip-shell system . . mktemp. -d)" |
| 22 | |
| 23 | cd "$tempdir" |
| 24 | tarscip-shell system . . tar. xf "$dir/$filename" |
| 25 | catscip-shell system . . cat. "$dir"/debian/prune/* | while read file; do rmscip-shell system . . rm. -f */$file; done |
| 26 | |
| 27 | tarscip-shell system . . tar. czf "$dir/$filename" * |
| 28 | cd "$dir" |
| 29 | rmscip-shell system . . rm. -rf "$tempdir" |
| 30 | echoscip-shell system . . echo. "Done pruning upstream tarball" |
| 31 | |
| 32 | exit 0 |