Tue, 12 Nov 2024 16:53:27 +0100
fix configure not emitting target data for features - fixes #478
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 |
117 | 4 | VERSION=${project.version} |
18
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
5 | |
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
6 | # help text |
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
7 | printhelp() |
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
8 | { |
111
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
9 | echo "Usage:" |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
10 | echo " $0 [PREFIX=<path>]" |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
11 | echo " $0 home" |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
12 | echo |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
13 | echo "Default PREFIX: /usr/local" |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
14 | 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
|
15 | } |
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
16 | |
26
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
17 | # error function |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
18 | exit_on_error() |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
19 | { |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
20 | echo "$1" |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
21 | exit 1 |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
22 | } |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
23 | |
18
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
24 | # |
111
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
25 | # parse arguments |
18
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
26 | # |
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
|
27 | for arg in "$@" |
18
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
28 | 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
|
29 | case "$arg" in |
111
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
30 | "PREFIX="*) PREFIX=${arg#PREFIX=} ;; |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
31 | "--help"*) printhelp; exit 1 ;; |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
32 | "home"*) PREFIX="$HOME/.local" ;; |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
33 | "-"*) echo "unknown option: $arg"; exit 1 ;; |
cb128bae1161
add shortcut for installation to home
Mike Becker <universe@uap-core.de>
parents:
50
diff
changeset
|
34 | esac |
18
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
35 | done |
0df7309d498e
add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
36 | |
26
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
37 | # |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
38 | # create install dir |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
39 | # |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
40 | 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
|
41 | mkdir -p "$PREFIX/lib/uwproj" "$PREFIX/bin" \ |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
42 | || exit_on_error "Creating install directory failed." |
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | |
26
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
44 | # |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
45 | # install the JAR file |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
46 | # |
117 | 47 | echo "cp ../target/uwproj-$VERSION-jar-with-dependencies.jar $PREFIX/lib/uwproj/uwproj-$VERSION.jar" |
48 | cp "../target/uwproj-$VERSION-jar-with-dependencies.jar" "$PREFIX/lib/uwproj/uwproj-$VERSION.jar" \ | |
27
e6e7e63b8b5e
fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents:
26
diff
changeset
|
49 | || exit_on_error "Installing JAR file failed." |
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | |
26
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
51 | # |
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
52 | # 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
|
53 | # |
24
e7c0b50468ee
fix output not using PREFIX variable - fixes #270
Mike Becker <universe@uap-core.de>
parents:
23
diff
changeset
|
54 | echo "cp bin/uwproj $PREFIX/bin" |
26
0a5e13216803
add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents:
25
diff
changeset
|
55 | 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
|
56 | || exit_on_error "Creating run script failed." |
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | |
27
e6e7e63b8b5e
fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents:
26
diff
changeset
|
58 | echo "chmod 0555 $PREFIX/bin/uwproj" |
e6e7e63b8b5e
fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents:
26
diff
changeset
|
59 | chmod 0755 "$PREFIX/bin/uwproj" \ |
e6e7e63b8b5e
fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents:
26
diff
changeset
|
60 | || 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
|
61 | |
27
e6e7e63b8b5e
fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents:
26
diff
changeset
|
62 | echo |
117 | 63 | echo "uwproj $VERSION has been successfully installed." |