Check stage3 basename for systemd compliance

This commit is contained in:
oddlama 2021-06-02 16:38:47 +02:00
parent 264f811e9d
commit 953f5009e9
No known key found for this signature in database
GPG Key ID: 14EFE510775FE39A
1 changed files with 8 additions and 0 deletions

View File

@ -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 ]] \