3 PREFIX=/usr/local |
3 PREFIX=/usr/local |
4 |
4 |
5 # help text |
5 # help text |
6 printhelp() |
6 printhelp() |
7 { |
7 { |
8 echo "Usage: $0 [PREFIX=<path>]" |
8 echo "Usage:" |
9 echo |
9 echo " $0 [PREFIX=<path>]" |
10 echo "Default PREFIX: /usr/local" |
10 echo " $0 home" |
|
11 echo |
|
12 echo "Default PREFIX: /usr/local" |
|
13 echo "With 'home' shortcut, PREFIX: $HOME/.local" |
11 } |
14 } |
12 |
15 |
13 # error function |
16 # error function |
14 exit_on_error() |
17 exit_on_error() |
15 { |
18 { |
16 echo "$1" |
19 echo "$1" |
17 exit 1 |
20 exit 1 |
18 } |
21 } |
19 |
22 |
20 # |
23 # |
21 # parse arguments |
24 # parse arguments |
22 # |
25 # |
23 for arg in "$@" |
26 for arg in "$@" |
24 do |
27 do |
25 case "$arg" in |
28 case "$arg" in |
26 "PREFIX="*) PREFIX=${arg#PREFIX=} ;; |
29 "PREFIX="*) PREFIX=${arg#PREFIX=} ;; |
27 "--help"*) printhelp; exit 1 ;; |
30 "--help"*) printhelp; exit 1 ;; |
28 "-"*) echo "unknown option: $arg"; exit 1 ;; |
31 "home"*) PREFIX="$HOME/.local" ;; |
29 esac |
32 "-"*) echo "unknown option: $arg"; exit 1 ;; |
|
33 esac |
30 done |
34 done |
31 |
35 |
32 # |
36 # |
33 # create install dir |
37 # create install dir |
34 # |
38 # |
37 || exit_on_error "Creating install directory failed." |
41 || exit_on_error "Creating install directory failed." |
38 |
42 |
39 # |
43 # |
40 # install the JAR file |
44 # install the JAR file |
41 # |
45 # |
42 echo "cp ../target/uwproj-${project.version}-jar-with-dependencies.jar $PREFIX/lib/uwproj/uwproj-${project.version}.jar" |
46 echo "cp ../target/uwproj-0.2.0-SNAPSHOT-jar-with-dependencies.jar $PREFIX/lib/uwproj/uwproj-0.2.0-SNAPSHOT.jar" |
43 cp "../target/uwproj-${project.version}-jar-with-dependencies.jar" "$PREFIX/lib/uwproj/uwproj-${project.version}.jar" \ |
47 cp "../target/uwproj-0.2.0-SNAPSHOT-jar-with-dependencies.jar" "$PREFIX/lib/uwproj/uwproj-0.2.0-SNAPSHOT.jar" \ |
44 || exit_on_error "Installing JAR file failed." |
48 || exit_on_error "Installing JAR file failed." |
45 |
49 |
46 # |
50 # |
47 # create a run script in the bin dir |
51 # create a run script in the bin dir |
48 # |
52 # |