tmp commit
[engrid.git] / makebindist.bash
blob687f5eb6d8393cd37111623d499067939a5b8809
1 #!/bin/bash
2 set -e -x -u
4 # Check if all parameters are present
5 # If no, exit
6 if [ $# -ne 3 ]
7 then
8 echo "usage :"
9 echo "`basename $0` VERSION SRCDIR ARCHITECTURE"
10 echo "You must run this script from SRCDIR/.."
11 exit 0
14 VERSION=$1
15 #SRCDIR=$(readlink -f $2)
16 SRCDIR=$2
17 ARCH=$3
19 ORIG_WD=$(pwd)
21 #define variables
22 tarname="enGrid_linux"$ARCH"bit_"$VERSION".tar"
23 gzname="enGrid_linux"$ARCH"bit_"$VERSION".tar.gz"
24 dirname="enGrid_linux"$ARCH"bit_"$VERSION
26 saferemove()
28 TARGET=$(readlink -f $1)
29 if [ -e $TARGET ]
30 then
31 echo "$TARGET already exists."
32 echo "rm -v $TARGET ?(y/n/q)"
33 read ans
34 case $ans in
35 y|Y|yes) rm -v $TARGET;;
36 q) exit 0;;
37 *) echo "proceeding without removing";;
38 esac
42 saferemove_recursive()
44 TARGET=$(readlink -f $1)
45 if [ -e $TARGET ]
46 then
47 echo "$TARGET already exists."
48 echo "rm -rfv $TARGET ?(y/n/q)"
49 read ans
50 case $ans in
51 y|Y|yes) rm -rfv $TARGET;;
52 q) exit 0;;
53 *) echo "proceeding without removing";;
54 esac
58 saferemove_recursive tmp
59 saferemove $tarname
61 #TMP=$(mktemp -d)
62 #TMP=/tmp/toto
64 #if [ -e $TMP ]
65 #then
66 # echo "$TMP already exists."
67 # echo "rm -rfv $TMP ?(y/n/q)"
68 # read ans
69 # case $ans in
70 # y|Y|yes) rm -rfv $TMP;;
71 # q) exit 0;;
72 # *) echo "proceeding without removing";;
73 # esac
74 #fi
76 #mkdir -p $TMP
78 #get all dependencies
79 cd $SRCDIR
80 ./engrid -distbin
81 #mv -v enGrid_bin.tar.gz $TMP
83 #clean up
84 #cd $SRCDIR
85 qmake
86 make clean
87 cd netgen_svn
88 qmake
89 make clean
90 cd ../..
92 #add scripts + dependencies
93 pwd
94 tar -f $tarname -r $SRCDIR/setup
95 #tar -f $tarname -r $SRCDIR/start_engrid
96 tar -f $tarname -r $SRCDIR/enGrid_bin.tar.gz
97 tar -f $tarname -r $SRCDIR/README
99 #change back to SRCDIR + add source files
100 tar -f $tarname -r $SRCDIR/*.h
101 tar -f $tarname -r $SRCDIR/*.cpp
102 tar -f $tarname -r $SRCDIR/*.cxx
103 tar -f $tarname -r $SRCDIR/*.ui
104 tar -f $tarname -r $SRCDIR/licence.txt
105 tar -f $tarname -r $SRCDIR/resources
106 tar -f $tarname -r $SRCDIR/engrid.pro
107 tar -f $tarname -r $SRCDIR/engrid.qrc
108 tar -f $tarname -r $SRCDIR/math/*.h
109 tar -f $tarname -r $SRCDIR/netgen_svn/netgen-mesher/netgen
110 tar -f $tarname -r $SRCDIR/netgen_svn/ng.pro
112 #cd /tmp
113 #tar -czvf $gzname $TMP
114 #mv -v $gzname $ORIG_WD
116 #exit 0
118 #extract .tar in ./tmp
120 mkdir -p tmp
121 cd tmp
122 tar xf ../$tarname
125 #rename the extracted dir
126 mv $SRCDIR $dirname
127 tar czf $gzname $dirname
128 mv $gzname ..
129 cd ..
130 saferemove_recursive tmp
131 saferemove $tarname