File: git_build_tar.sh

package info (click to toggle)
logwatch 7.5.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 3,300 kB
  • sloc: perl: 7,281; sh: 250; makefile: 38
file content (35 lines) | stat: -rwxr-xr-x 675 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
#!/bin/bash
set -e
set -o pipefail

# call as ./build_tar.sh $path_to_local_git_repo $last_upstream_version_number

UPSDIR=$1
VERSION=$2

test -d "$UPSDIR" || ( echo "No upstream directory"; exit 1 )
test -z "$VERSION" && ( echo "No Version"; exit 1 )

CURDIR=$PWD

#Determine GIT repositories' state
cd $UPSDIR
DATE=$( git log --pretty="%ci" HEAD^..HEAD | awk '{print $1}' | sed -e 's/-//g' )
cd $CURDIR

tmpdir=$(mktemp --tmpdir -d logwatch.XXXXXXX)
logwatch_dir=logwatch-$VERSION+git${DATE}
target_dir=$tmpdir/$logwatch_dir

mkdir -p $target_dir

rsync -av --exclude=.svn --exclude=.git $UPSDIR/ $target_dir

tar -C $tmpdir -cavf $logwatch_dir.tar.xz $logwatch_dir