dist/install.sh

changeset 18
0df7309d498e
parent 0
38775db5fdf5
child 23
79ca64922cfa
--- a/dist/install.sh	Sat Nov 14 21:12:53 2020 +0100
+++ b/dist/install.sh	Thu Feb 23 13:11:26 2023 +0100
@@ -1,11 +1,35 @@
 #!/bin/sh
 
+PREFIX=/usr/local
+
+# help text
+printhelp()
+{
+	echo "Usage: $0 [PREFIX=<path>]"
+	echo
+	echo "Default PREFIX:" $PREFIX
+}
+
+#
+# parse arguments 
+#
+for ARG in $@
+do
+    case "$ARG" in
+		"PREFIX="*)         PREFIX=${ARG#PREFIX=} ;;
+		"--help"*)          printhelp; exit 1 ;;
+		"-"*) echo "unknown option: $ARG"; exit 1 ;;
+	esac
+done
+
+
 echo "mkdir -p /usr/lib/uwproj"
-mkdir -p /usr/lib/uwproj
+mkdir -p $PREFIX/lib/uwproj
 
 echo "cp ../target/uwproj-0.1-jar-with-dependencies.jar /usr/lib/uwproj/uwproj-0.1.jar"
-cp ../target/uwproj-0.1-jar-with-dependencies.jar /usr/lib/uwproj/uwproj-0.1.jar
+cp ../target/uwproj-0.1-jar-with-dependencies.jar $PREFIX/lib/uwproj/uwproj-0.1.jar
 
 echo "cp bin/uwproj /usr/bin"
-cp bin/uwproj /usr/bin
+sed s:%%PREFIX%%:$PREFIX:g bin/uwproj > $PREFIX/bin/uwproj
 
+

mercurial