Tue, 24 Sep 2024 21:49:50 +0200
add platform attributes to config element
fixes #427
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | #!/bin/sh |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | |
18
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
3 | PREFIX=/usr/local |
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
4 | |
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
5 | # help text |
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
6 | printhelp() |
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
7 | { |
111
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
8 | echo "Usage:" |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
9 | echo " $0 [PREFIX=<path>]" |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
10 | echo " $0 home" |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
11 | echo |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
12 | echo "Default PREFIX: /usr/local" |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
13 | echo "With 'home' shortcut, PREFIX: $HOME/.local" |
18
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
14 | } |
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
15 | |
26
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
16 | # error function |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
17 | exit_on_error() |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
18 | { |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
19 | echo "$1" |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
20 | exit 1 |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
21 | } |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
22 | |
18
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
23 | # |
111
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
24 | # parse arguments |
18
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
25 | # |
23
79ca64922cfa
add missing double-quotes and use lower-case local variable names - fixes #271
Mike Becker <universe@uap-core.de>
parents:
18
diff
changeset
|
26 | for arg in "$@" |
18
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
27 | do |
23
79ca64922cfa
add missing double-quotes and use lower-case local variable names - fixes #271
Mike Becker <universe@uap-core.de>
parents:
18
diff
changeset
|
28 | case "$arg" in |
111
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
29 | "PREFIX="*) PREFIX=${arg#PREFIX=} ;; |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
30 | "--help"*) printhelp; exit 1 ;; |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
31 | "home"*) PREFIX="$HOME/.local" ;; |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
32 | "-"*) echo "unknown option: $arg"; exit 1 ;; |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
33 | esac |
18
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
34 | done |
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
35 | |
26
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
36 | # |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
37 | # create install dir |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
38 | # |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
39 | echo "mkdir -p $PREFIX/lib/uwproj $PREFIX/bin" |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
40 | mkdir -p "$PREFIX/lib/uwproj" "$PREFIX/bin" \ |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
41 | || exit_on_error "Creating install directory failed." |
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | |
26
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
43 | # |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
44 | # install the JAR file |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
45 | # |
111
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
46 | echo "cp ../target/uwproj-0.2.0-SNAPSHOT-jar-with-dependencies.jar $PREFIX/lib/uwproj/uwproj-0.2.0-SNAPSHOT.jar" |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
47 | cp "../target/uwproj-0.2.0-SNAPSHOT-jar-with-dependencies.jar" "$PREFIX/lib/uwproj/uwproj-0.2.0-SNAPSHOT.jar" \ |
27
e6e7e63b8b5e
fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents:
26
diff
changeset
|
48 | || exit_on_error "Installing JAR file failed." |
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | |
26
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
50 | # |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
51 | # create a run script in the bin dir |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
52 | # |
24
e7c0b50468ee
fix output not using PREFIX variable - fixes #270
Mike Becker <universe@uap-core.de>
parents:
23
diff
changeset
|
53 | echo "cp bin/uwproj $PREFIX/bin" |
26
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
54 | sed "s:%%PREFIX%%:$PREFIX:g" "bin/uwproj" > "$PREFIX/bin/uwproj" \ |
27
e6e7e63b8b5e
fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents:
26
diff
changeset
|
55 | || exit_on_error "Creating run script failed." |
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | |
27
e6e7e63b8b5e
fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents:
26
diff
changeset
|
57 | echo "chmod 0555 $PREFIX/bin/uwproj" |
e6e7e63b8b5e
fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents:
26
diff
changeset
|
58 | chmod 0755 "$PREFIX/bin/uwproj" \ |
e6e7e63b8b5e
fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents:
26
diff
changeset
|
59 | || exit_on_error "Changing permissions for run script failed." |
18
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
60 | |
27
e6e7e63b8b5e
fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents:
26
diff
changeset
|
61 | echo |
e6e7e63b8b5e
fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents:
26
diff
changeset
|
62 | echo "uwproj has been successfully installed." |