File: createdist.sh

package info (click to toggle)
krusader 2:2.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 21,684 kB
  • ctags: 7,260
  • sloc: cpp: 55,337; ansic: 1,188; xml: 533; sh: 41; makefile: 3
file content (46 lines) | stat: -rwxr-xr-x 1,052 bytes parent folder | download | duplicates (4)
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
#!/bin/bash

VERSION=`cat CMakeLists.txt | grep 'set(VERSION' | awk -F '"' '{print $2; }'`
DIST_NAME="krusader-${VERSION}"
OUTPUT_FILE_NAME="${DIST_NAME}.tar.gz"

rm -rf __KrDist__
mkdir __KrDist__
mkdir __KrDist__/$DIST_NAME

echo 'try SVN listing...'
if svn status -v >__KrDist__/svnfiles; then
  FILES=`cat __KrDist__/svnfiles | grep -v '^\? ' | awk '{print $NF;}'`
fi

if [ -z "$FILES" ]; then
  echo 'try git listing...'
  if git ls-files >__KrDist__/gitfiles; then
    FILES=`cat __KrDist__/gitfiles`
  fi
fi

if [ -z "$FILES" ]; then
  echo "Something went wrong! Can't find version controlled source files"
  exit 1
fi

echo 'Copying files for disting...'
for FILE2 in $FILES;
do
   if [ ! -d $FILE2 ]; then
     target_dir="__KrDist__/$DIST_NAME/`dirname $FILE2`"
     if [ ! -d $target_dir ]; then mkdir -p $target_dir; fi
     cp -p $FILE2 $target_dir;
   fi
done

echo 'Creating the tar.gz archive...'
cd __KrDist__
tar cvfz ../$OUTPUT_FILE_NAME $DIST_NAME >/dev/null
cd ..

echo 'Removing temporary files...'
rm -rf __KrDist__

echo 'OK.'