36 lines
763 B
Bash
36 lines
763 B
Bash
#!/usr/bin/env bash
|
|
# Common functions for the lab scripts
|
|
# Copyright Bryan C. Roessler
|
|
|
|
# Don't run this script directly
|
|
[[ "${BASH_SOURCE[0]}" == "${0}" ]] && exit 0
|
|
|
|
|
|
### VARS ###
|
|
export INSTALL_DIR=/usr/local/bin
|
|
|
|
|
|
### FUNCTIONS ###
|
|
prompt() { read -r -p "Enter $1: " "$1"; }
|
|
|
|
ask_ok() {
|
|
declare response
|
|
(( YES_SWITCH )) && return 0
|
|
read -r -p "$* [y/N]: " response
|
|
[[ ${response,,} =~ ^(yes|y)$ ]]
|
|
}
|
|
|
|
is_root() {
|
|
[[ $EUID -gt 0 ]] && echo "Script must be run with sudo" && exit 1
|
|
}
|
|
|
|
copy_manual() {
|
|
cat <<-EOF > "$1/manual.desktop"
|
|
[Desktop Entry]
|
|
Encoding=UTF-8
|
|
Name=Hartman Lab Server Manual
|
|
Type=Link
|
|
URL=https://docs.google.com/document/d/1K_KwAlv8Zljmy-enwmhT6gMTFutlAFglixvpLGBx0VY
|
|
Icon=text-html
|
|
EOF
|
|
} |