dist.src/install.sh

Fri, 05 Jan 2024 21:04:57 +0100

author
Mike Becker <universe@uap-core.de>
date
Fri, 05 Jan 2024 21:04:57 +0100
changeset 94
002497e6c27d
parent 50
d26da280c934
child 111
cb128bae1161
permissions
-rwxr-xr-x

replace -a with && in configure

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 {
0df7309d498e add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
8 echo "Usage: $0 [PREFIX=<path>]"
0df7309d498e add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
9 echo
25
f061eecae302 fix default prefix in help text not being the default but the actual prefix
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
10 echo "Default PREFIX: /usr/local"
18
0df7309d498e add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
11 }
0df7309d498e add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
12
26
0a5e13216803 add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
13 # error function
0a5e13216803 add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
14 exit_on_error()
0a5e13216803 add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
15 {
0a5e13216803 add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
16 echo "$1"
0a5e13216803 add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
17 exit 1
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
18
0df7309d498e add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
20 #
0df7309d498e add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
21 # parse arguments
0df7309d498e add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
22 #
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
23 for arg in "$@"
18
0df7309d498e add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
24 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
25 case "$arg" in
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 "PREFIX="*) PREFIX=${arg#PREFIX=} ;;
18
0df7309d498e add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
27 "--help"*) printhelp; exit 1 ;;
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 "-"*) echo "unknown option: $arg"; exit 1 ;;
18
0df7309d498e add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
29 esac
0df7309d498e add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
30 done
0df7309d498e add PREFIX parameter to install script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
31
26
0a5e13216803 add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
32 #
0a5e13216803 add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
33 # create install dir
0a5e13216803 add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
34 #
0a5e13216803 add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
35 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
36 mkdir -p "$PREFIX/lib/uwproj" "$PREFIX/bin" \
0a5e13216803 add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
37 || exit_on_error "Creating install directory failed."
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38
26
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 # install the JAR file
0a5e13216803 add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
41 #
50
d26da280c934 automatically generate dist files with correct version number - fixes #262
Mike Becker <universe@uap-core.de>
parents: 27
diff changeset
42 echo "cp ../target/uwproj-${project.version}-jar-with-dependencies.jar $PREFIX/lib/uwproj/uwproj-${project.version}.jar"
d26da280c934 automatically generate dist files with correct version number - fixes #262
Mike Becker <universe@uap-core.de>
parents: 27
diff changeset
43 cp "../target/uwproj-${project.version}-jar-with-dependencies.jar" "$PREFIX/lib/uwproj/uwproj-${project.version}.jar" \
27
e6e7e63b8b5e fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents: 26
diff changeset
44 || exit_on_error "Installing JAR file failed."
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45
26
0a5e13216803 add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
46 #
0a5e13216803 add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
47 # 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
48 #
24
e7c0b50468ee fix output not using PREFIX variable - fixes #270
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
49 echo "cp bin/uwproj $PREFIX/bin"
26
0a5e13216803 add error handling to install.sh
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
50 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
51 || exit_on_error "Creating run script failed."
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52
27
e6e7e63b8b5e fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents: 26
diff changeset
53 echo "chmod 0555 $PREFIX/bin/uwproj"
e6e7e63b8b5e fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents: 26
diff changeset
54 chmod 0755 "$PREFIX/bin/uwproj" \
e6e7e63b8b5e fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents: 26
diff changeset
55 || 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
56
27
e6e7e63b8b5e fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents: 26
diff changeset
57 echo
e6e7e63b8b5e fix missing chmod - close #278
Mike Becker <universe@uap-core.de>
parents: 26
diff changeset
58 echo "uwproj has been successfully installed."

mercurial