File: fix-tar-ball

package info (click to toggle)
gri 2.12.26-1
  • links: PTS
  • area: main
  • in suites: buster, sid
  • size: 5,952 kB
  • ctags: 2,396
  • sloc: cpp: 36,598; sh: 4,196; lisp: 3,764; perl: 1,362; ansic: 1,046; makefile: 606
file content (29 lines) | stat: -rwxr-xr-x 693 bytes parent folder | download
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
# Usage:
#  ./fix-tar-ball gri-2.12.10.tar.gz
#
TARBALL=$1
if [ -z "$1" ] ; then
    echo "Usage: ./fix-tar-ball gri-2.12.10.tar.gz"
    echo "   Missing argument"
    exit 0
fi
DIRECTORY=$(echo ${TARBALL} | perl -ne 'if (/(gri-[0-9.]+).t/){print $1}')

# extract TARBALL into DIRECTORY
tar zxf ${TARBALL}

# fix permissions
chmod -R u+w ${DIRECTORY}

# fix debian/changelog if broken
if test -e "${DIRECTORY}/debian/ChangeLog"; then
    echo "Fixing debian/ChangeLog"
    mv -f ${DIRECTORY}/debian/ChangeLog ${DIRECTORY}/debian/changelog
fi

# rebuild tar ball
tar cf ${DIRECTORY}.tar ${DIRECTORY}/
mv -f ${TARBALL} ${TARBALL}.old
gzip --best ${DIRECTORY}.tar
rm -fR ${DIRECTORY}