dist/install.sh

changeset 26
0a5e13216803
parent 25
f061eecae302
child 27
e6e7e63b8b5e
equal deleted inserted replaced
25:f061eecae302 26:0a5e13216803
6 printhelp() 6 printhelp()
7 { 7 {
8 echo "Usage: $0 [PREFIX=<path>]" 8 echo "Usage: $0 [PREFIX=<path>]"
9 echo 9 echo
10 echo "Default PREFIX: /usr/local" 10 echo "Default PREFIX: /usr/local"
11 }
12
13 # error function
14 exit_on_error()
15 {
16 echo "$1"
17 exit 1
11 } 18 }
12 19
13 # 20 #
14 # parse arguments 21 # parse arguments
15 # 22 #
20 "--help"*) printhelp; exit 1 ;; 27 "--help"*) printhelp; exit 1 ;;
21 "-"*) echo "unknown option: $arg"; exit 1 ;; 28 "-"*) echo "unknown option: $arg"; exit 1 ;;
22 esac 29 esac
23 done 30 done
24 31
25 echo "mkdir -p $PREFIX/lib/uwproj" 32 #
26 mkdir -p "$PREFIX/lib/uwproj" 33 # create install dir
34 #
35 echo "mkdir -p $PREFIX/lib/uwproj $PREFIX/bin"
36 mkdir -p "$PREFIX/lib/uwproj" "$PREFIX/bin" \
37 || exit_on_error "Creating install directory failed."
27 38
39 #
40 # install the JAR file
41 #
28 echo "cp ../target/uwproj-0.1-jar-with-dependencies.jar $PREFIX/lib/uwproj/uwproj-0.1.jar" 42 echo "cp ../target/uwproj-0.1-jar-with-dependencies.jar $PREFIX/lib/uwproj/uwproj-0.1.jar"
29 cp "../target/uwproj-0.1-jar-with-dependencies.jar" "$PREFIX/lib/uwproj/uwproj-0.1.jar" 43 cp "../target/uwproj-0.1-jar-with-dependencies.jar" "$PREFIX/lib/uwproj/uwproj-0.1.jar" \
44 || exit_on_error "Installing JAR file failed."
30 45
46 #
47 # create a run script in the bin dir
48 #
31 echo "cp bin/uwproj $PREFIX/bin" 49 echo "cp bin/uwproj $PREFIX/bin"
32 sed "s:%%PREFIX%%:$PREFIX:g" "bin/uwproj" > "$PREFIX/bin/uwproj" 50 sed "s:%%PREFIX%%:$PREFIX:g" "bin/uwproj" > "$PREFIX/bin/uwproj" \
51 || exit_on_error "Creating run script failed."
33 52
34 53

mercurial