Fri, 29 Nov 2024 21:43:32 +0100
add draft for website
#!/bin/sh PREFIX=/usr/local VERSION=${project.version} # help text printhelp() { echo "Usage:" echo " $0 [PREFIX=<path>]" echo " $0 home" echo echo "Default PREFIX: /usr/local" echo "With 'home' shortcut, PREFIX: $HOME/.local" } # error function exit_on_error() { echo "$1" exit 1 } # # parse arguments # for arg in "$@" do case "$arg" in "PREFIX="*) PREFIX=${arg#PREFIX=} ;; "--help"*) printhelp; exit 1 ;; "home"*) PREFIX="$HOME/.local" ;; "-"*) echo "unknown option: $arg"; exit 1 ;; esac done # # create install dir # echo "mkdir -p $PREFIX/lib/uwproj $PREFIX/bin" mkdir -p "$PREFIX/lib/uwproj" "$PREFIX/bin" \ || exit_on_error "Creating install directory failed." # # install the JAR file # echo "cp ../target/uwproj-$VERSION-jar-with-dependencies.jar $PREFIX/lib/uwproj/uwproj-$VERSION.jar" cp "../target/uwproj-$VERSION-jar-with-dependencies.jar" "$PREFIX/lib/uwproj/uwproj-$VERSION.jar" \ || exit_on_error "Installing JAR file failed." # # create a run script in the bin dir # echo "cp bin/uwproj $PREFIX/bin" sed "s:%%PREFIX%%:$PREFIX:g" "bin/uwproj" > "$PREFIX/bin/uwproj" \ || exit_on_error "Creating run script failed." echo "chmod 0555 $PREFIX/bin/uwproj" chmod 0755 "$PREFIX/bin/uwproj" \ || exit_on_error "Changing permissions for run script failed." echo echo "uwproj $VERSION has been successfully installed."