28 lines
673 B
Bash
Executable File
28 lines
673 B
Bash
Executable File
#!/usr/bin/env sh
|
|
set -eu
|
|
|
|
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
PREFIX=${XDG_DATA_HOME:-"$HOME/.local/share"}/bjd-cms
|
|
PYTHON=python3
|
|
|
|
while [ "$#" -gt 0 ]; do
|
|
case "$1" in
|
|
--prefix)
|
|
[ "$#" -ge 2 ] || { echo "--prefix requires an absolute directory" >&2; exit 2; }
|
|
PREFIX=$2
|
|
shift 2
|
|
;;
|
|
--python)
|
|
[ "$#" -ge 2 ] || { echo "--python requires an executable" >&2; exit 2; }
|
|
PYTHON=$2
|
|
shift 2
|
|
;;
|
|
*)
|
|
echo "usage: sh install/install.sh [--prefix ABSOLUTE_DIRECTORY] [--python PYTHON_EXECUTABLE]" >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
done
|
|
|
|
exec "$PYTHON" "$SCRIPT_DIR/install.py" --prefix "$PREFIX"
|