File: repack-postbooks.sh

package info (click to toggle)
postbooks 4.9.5-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 103,120 kB
  • sloc: cpp: 288,269; sh: 607; xml: 214; awk: 104; makefile: 49
file content (45 lines) | stat: -rwxr-xr-x 751 bytes parent folder | download | duplicates (6)
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
#!/bin/bash

set -e

ORIG_TARBALL=$(readlink -f ${1})

if [ ! -e "${ORIG_TARBALL}" ];
then
  echo "${ORIG_TARBALL} does not exist"
  exit 1
fi

VERSION=`echo ${1} | cut -f2 -d-`

TMP_WS=`mktemp -d`

cd ${TMP_WS}

COMPRESSION_SCHEME=`echo "${1}" | tr '.' '\n' | tail -1`
case ${COMPRESSION_SCHEME} in
  gz)
    SYM=z
    ;;
  bz2)
    SYM=j
    ;;
  *)
    echo "Unable to recognise orig tarball compression scheme"
    exit 1
    ;;
esac

tar x${SYM}f "${ORIG_TARBALL}"

mv `ls` postbooks

find . -name '*DS_Store' -exec rm {} \;
find . -name '*.o' -exec rm {} \;
find . -name '*.a' -exec rm {} \;
find . -exec file {} \; | \
    grep -v script | grep executable | cut -f1 -d: | xargs -r rm


tar cjf /tmp/postbooks_${VERSION}.orig.tar.bz2 postbooks