#!/bin/bash # Copyright 2014-2022 Security Onion Solutions, LLC # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . MYNAME="${0##*/}" display_help() { printf "%s" "${MYNAME}" printf " [%s]" "-h" "-q|--quiet" printf "\n" printf "\t-%s\t%s\n" \ "h" "Show this message." \ "q,--quiet" "suppress the output and return a single status code of overall status" printf "\nReturn Codes:\n" printf "\t%s - %s\n" \ "0" "Ok" \ "1" "Error" \ "2" "Starting/Pending"\ "99" "Installing SO" # exit with code 0, unless passed a number when called exit "${1:-0}" } # Constants QUIET=false EXITCODE=0 SYSTEM_START_TIME=$(date -d "$(/dev/null \ && __tty=1 return "${__tty}" } if ! [ "$(id -u)" = 0 ]; then echo "${MYNAME}: This command must be run as root" display_help 1 fi while getopts ':hq' OPTION; do case "$OPTION" in h) display_help 0 ;; q) QUIET=true ;; \?) display_help 1 ;; esac done main exit $EXITCODE