Add system information at beginning of installation; provide logging functions to be used instead of echo commands

This commit is contained in:
Jason Ertel
2020-08-13 17:29:45 -04:00
parent 34d8261669
commit 3c113a7a89
2 changed files with 38 additions and 5 deletions

View File

@@ -21,6 +21,40 @@ source ./so-common-functions
SOVERSION=$(cat ../VERSION)
log() {
msg=$1
level=${2:-I}
now=$(TZ=GMT date +"%Y-%m-%dT%H:%M:%SZ")
echo -e "$now | $level | $msg" >> "$setup_log" 2>&1
}
error() {
log "$1" "E"
}
info() {
log "$1" "I"
}
header() {
echo -e "-----------------------------\n $1\n-----------------------------\n" >> "$setup_log" 2>&1
}
logCmd() {
cmd=$1
info "Executing command: $cmd\n$($cmd)\n"
}
analyze_system() {
header "System Characteristics"
logCmd "uptime"
logCmd "uname -a"
logCmd "free -h"
logCmd "lscpu"
logCmd "df -h"
logCmd "ip a"
}
accept_salt_key_remote() {
systemctl restart salt-minion