File: repack

package info (click to toggle)
gravit 0.5.1+dfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 10,416 kB
  • sloc: ansic: 6,841; makefile: 63; sh: 43
file content (47 lines) | stat: -rwxr-xr-x 829 bytes parent folder | download | duplicates (3)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash

set -eu

if [ ${VERBOSE:-0} = 1 ]; then
    set -x
fi

if [ $# -ne 3 ] ; then
    echo "Wrong number of arguments."
    exit 1
fi

tarball=$(readlink -f "$3")
storedir=$(dirname "${tarball}")

if [[ "${tarball}" =~ .+gravit-(.+)\.tar\.gz$ ]]; then
    version=${BASH_REMATCH[1]}
    echo "Repacking version ${version}"
else
    echo "Tarball is not in proper format"
    exit 1
fi

tmp=$(mktemp -d)

function cleanup {
  echo "Removing ${tmp}"
  rm -r "${tmp}"
}
trap cleanup EXIT

paths="AudioStreamer.m src/AudioStreamer.h Xcode VisualStudio"

(
    cd ${tmp};
    tar xf ${tarball}
    dirname=$(ls -1)
    for f in ${paths}; do
        rm -r "${dirname}/${f}"
    done
)

output="${storedir}/gravit-${version}+dsfg.tar.gz"
GZIP="--best" tar --directory "${tmp}" -czf "${output}" .

echo "Repacked in ${output}."