#!/bin/ksh # # install.lexd_spool.sh - install lexd-spool binary and rc.d script. # # Usage: doas ./install.lexd_spool.sh set -e BIN_SRC="./lexd-spool.sh" BIN_DST="/usr/local/bin/lexd-spool" RC_SRC="./lexd-spool.rc" RC_DST="/etc/rc.d/lexd_spool" if [ "$(id -u)" -ne 0 ]; then echo "error: this script must be run as root" >&2 exit 1 fi if [ ! -f "$BIN_SRC" ]; then echo "error: $BIN_SRC not found" >&2 exit 1 fi if [ ! -f "$RC_SRC" ]; then echo "error: $RC_SRC not found" >&2 exit 1 fi if [ ! -e "$BIN_DST" ]; then echo "installing $BIN_DST" install -o root -g wheel -m 0755 "$BIN_SRC" "$BIN_DST" else echo "$BIN_DST already exists, skipping" fi if [ ! -e "$RC_DST" ]; then echo "installing $RC_DST" install -o root -g wheel -m 0555 "$RC_SRC" "$RC_DST" else echo "$RC_DST already exists, skipping" fi echo "done."