source: branches/1.4/makeLinuxDist.sh @ 245

Revision 245, 1.6 KB checked in by bartek, 11 years ago (diff)

The Next fix related jglobus (brackets)
Error messages fixing (just the beginning of fixing).

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