From 953f5009e9402fd445268ab8660461fbbcded01c Mon Sep 17 00:00:00 2001 From: oddlama Date: Wed, 2 Jun 2021 16:38:47 +0200 Subject: [PATCH] Check stage3 basename for systemd compliance --- scripts/functions.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/functions.sh b/scripts/functions.sh index 24142a9..4c67cce 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -20,6 +20,14 @@ function check_config() { [[ $KEYMAP =~ ^[0-9A-Za-z-]*$ ]] \ || die "KEYMAP contains invalid characters" + if [[ "$SYSTEMD" == "true" ]]; then + [[ "$STAGE3_BASENAME" == *systemd* ]] \ + || die "Using systemd requires a systemd stage3 archive!" + else + [[ "$STAGE3_BASENAME" != *systemd* ]] \ + || die "Using OpenRC requires a non-systemd stage3 archive!" + fi + # Check hostname per RFC1123 local hostname_regex='^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$' [[ $HOSTNAME =~ $hostname_regex ]] \