mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-06 23:43:20 +02:00
confd: Notify user of all bootstrapping issues via login banners
Collect all bootstrapping issues in all banner-like files during boot, so that they are presented to the user when logging in. This should make it harder to miss overlook the fact that a system is running in a degraded state.
This commit is contained in:
@@ -80,9 +80,11 @@ console_error()
|
||||
[ -z "$STATUS" ] || return
|
||||
STATUS="CRITICAL ERROR: $1"
|
||||
|
||||
printf "\n$PRETTY_NAME\n%s\n\n" "$STATUS" | tee /etc/banner > /etc/issue.net
|
||||
printf "\n$PRETTY_NAME (console)\n%s\n\n" "$STATUS" > /etc/issue
|
||||
|
||||
printf "\n$STATUS\n" | tee -a \
|
||||
/etc/banner \
|
||||
/etc/issue \
|
||||
/etc/issue.net \
|
||||
>/dev/null
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,17 @@
|
||||
#
|
||||
set -e
|
||||
|
||||
banner_append()
|
||||
{
|
||||
printf "\n$@\n" | tee -a \
|
||||
/etc/banner \
|
||||
/etc/issue \
|
||||
/etc/issue.net \
|
||||
>/dev/null
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
. /etc/confdrc
|
||||
|
||||
@@ -35,6 +46,7 @@ if ! sysrepocfg -v3 -I"$fn" -f json; then
|
||||
;;
|
||||
failure-config)
|
||||
logger -sik -p user.error "Failed loading $fn, aborting!"
|
||||
banner_append "CRITICAL ERROR: Logins are disabled, no credentials available"
|
||||
initctl -nbq runlevel 9
|
||||
;;
|
||||
esac
|
||||
@@ -42,3 +54,6 @@ if ! sysrepocfg -v3 -I"$fn" -f json; then
|
||||
exit 1
|
||||
fi
|
||||
logger -sik -p user.notice "Loaded $fn successfully."
|
||||
if [ "$config" = "failure-config" ]; then
|
||||
banner_append "ERROR: Corrupt startup-config, system has reverted to default login credentials"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user