hr

A horizontal rule for the terminal.


hr

/

install.sh

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
#!/usr/bin/env bash
set -e

BUILD_TYPE="release"

if [[ $# > 0 ]]; then
  if [[ $1 == "--debug" ]]; then
    BUILD_TYPE="debug"
  elif [[ $1 == "--release" ]]; then
    BUILD_TYPE="release"
  else
    printf "usage: ./install.sh [--debug|--release]\n";
    exit 1
  fi
fi

# source environment variables
source ./env.sh

# build
./build.sh --${BUILD_TYPE}
cd build/${BUILD_TYPE}

# install
printf "\nInstalling ${APP} in ${BUILD_TYPE} mode\n"
if command -v sudo > /dev/null; then
  sudo make install
elif command -v doas > /dev/null; then
  doas make install
else
  printf "Don't know how to elevate privileges, bailing.\n"
  exit 1
fi
Back to Top