From d48e7f3f3311464b03c3c9aeb43808db1767b339 Mon Sep 17 00:00:00 2001 From: Bryan Roessler Date: Thu, 21 Oct 2021 11:07:24 -0400 Subject: [PATCH] Fix banner --- functions | 7 ++++++- script-install-banner | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/functions b/functions index 1816fd28..8f10cec0 100644 --- a/functions +++ b/functions @@ -2,6 +2,10 @@ # Common functions for the lab scripts # Copyright 2021 Bryan C. Roessler +# Don't run this script directly +[[ "${BASH_SOURCE[0]}" == "${0}" ]] && exit 0 + + ask_ok() { read -r -p "$* [y/N]" response response=${response,,} @@ -15,6 +19,7 @@ is_root() { [[ $user != "root" ]] && echo "Script must be run with sudo rights!" && exit 1 } + if ! type -t readarray >/dev/null; then readarray() { local cmd opt t v=MAPFILE @@ -48,4 +53,4 @@ if ! type -t readarray >/dev/null; then eval "${v}+=(\"$line\")" done } -fi \ No newline at end of file +fi diff --git a/script-install-banner b/script-install-banner index b5784c0c..65423f90 100644 --- a/script-install-banner +++ b/script-install-banner @@ -1,6 +1,7 @@ #!/usr/bin/env bash # Install motd scripts +# shellcheck source=./functions [[ -f functions ]] && . functions || exit 1 is_root @@ -15,6 +16,7 @@ if [[ -v DEBUG ]]; then banner="banner.sh" else banner="$profiledir/banner.sh" + [[ -f ./functions ]] && cp functions "$profiledir" fi cat <<- 'EOF' > "$banner"