source: trunk/makeLinuxDist.sh @ 169

Revision 169, 1.5 KB checked in by bartek, 12 years ago (diff)

Fixed scripts for preparing packages

  • Property svn:executable set to *
Line 
1#!/bin/bash
2
3fail() {
4  echo -e '\033[01;41m'"$@"'\033[00m'
5  exit 1
6}
7
8TARGET='install_Qcg-Icon_Linux.sh'
9
10echo "ant clean"
11ant clean > /dev/null || fail "clean failed"
12echo "ant jar"
13ant jar > /dev/null || fail "jar failed"
14echo "Building script"
15
16cat << eof > "$TARGET"
17#!/bin/bash
18echo "Welcome to QCG-Icon 'installer'"
19echo -n " please specify target dir (or press return for default [qcg-icon]): "
20read tgt
21tgt="\${tgt:-qcg-icon}"
22if [[ ! -d "\${tgt}" ]]
23then
24        if mkdir -p "\${tgt}" ; then :; else echo "Cannot create target dir"; exit 1 ; fi
25else
26        ans=
27        until [[ "\$ans" = y || "\$ans" = n || "\$ans" = Y || "\$ans" = N ]]
28        do
29                ans=
30                echo -n " dir exists, continue? [y/N]: "
31                read ans
32                ans="\${ans:-n}"
33        done
34        if [[ "\$ans" = n || "\$ans" = N ]]
35        then
36                echo "Cancelling instalation"
37                exit 1
38        fi
39fi
40
41ARCHIVE=\`awk '/^__ARCHIVE__/ {print NR + 1; exit 0; }' "\$0"\`
42tail -n+"\$ARCHIVE" "\$0" | tar xj -C "\${tgt}"
43
44if (( "\$?" == 0 ))
45then
46        echo "Installing qcg-icon finished."
47else
48        echo "Installing failed!"
49        exit 1
50fi
51
52ans=
53until [[ "\$ans" = y || "\$ans" = n || "\$ans" = Y || "\$ans" = N ]]
54do
55        ans=
56        echo -n " Run qcg-icon? [Y/n]: "
57        read ans
58        ans="\${ans:-y}"
59done
60if [[ "\$ans" = y || "\$ans" = Y ]]
61then
62        ( cd "\${tgt}" && ./qcg-icon.sh & disown )
63        exit 1
64fi
65
66exit 0
67
68__ARCHIVE__
69eof
70
71echo "adding tar payload"
72tar cj --exclude-vcs -C dist lib QCG-Icon.jar -C ../dist_static logging.properties urls.properties certs resources -C ../dist_linux config.properties qcg-icon.sh >> ${TARGET} || fail "packing failed"
73
74chmod +x ${TARGET}
75echo "finished!"
76
77
Note: See TracBrowser for help on using the repository browser.