kos/scripts/setup.sh
Ari Archer 7eb5f62ced
42: Fix completions, improve permissions, add editorconfig
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
2022-10-16 01:06:07 +03:00

35 lines
766 B
Bash
Executable file

#!/usr/bin/env sh
set -e
main() {
if [ "$USER" != 'root' ]; then
echo 'Needs root privalages'
exit 1
fi
echo 'Using setup script... please be careful'
sleep 1
PREFIX="${DESTDIR}${PREFIX:-/usr/local}/"
BINDIR="${PREFIX}bin"
MANPREFIX="${MANPREFIX:-${PREFIX}/share/man/man1}"
sh ./scripts/build.sh
[ "$DO_STRIP" ] && sh ./scripts/strip.sh kos
mkdir -p "$BINDIR"
chown root:root ./kos
install -o root -Dm4111 ./kos "$BINDIR"
if [ "$INSTALL_MAN" ]; then
mkdir -p "$MANPREFIX"
install -Dm0644 kos.1 "$MANPREFIX"
mandb -qf "${MANPREFIX}/kos.1"
fi
[ "$INSTALL_BCOMP" ] && cp completions/kos.bash /usr/share/bash-completion/completions/kos
return 0
}
main "$@"