mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-21 18:03:41 +03:00
test: handle Debian's /etc/default/locale in testsuite-74.firstboot.sh
This handles a Debian-specific quirk where /etc/default/locale is used instead of /etc/locale.conf. There is currently special handling for this in testsuite-73.sh, so the quirk should be handled here too for consistency. (cherry picked from commit bb59fdc1e3a7119f3680d309147020fce9bf67b5)
This commit is contained in:
parent
97ebe90879
commit
9b42646b22
@ -24,6 +24,12 @@ ROOT_HASHED_PASSWORD1='$6$foobarsalt$YbwdaATX6IsFxvWbY3QcZj2gB31R/LFRFrjlFrJtTTq
|
|||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
ROOT_HASHED_PASSWORD2='$6$foobarsalt$q.P2932zYMLbKnjFwIxPI8y3iuxeuJ2BgE372LcZMMnj3Gcg/9mJg2LPKUl.ha0TG/.fRNNnRQcLfzM0SNot3.'
|
ROOT_HASHED_PASSWORD2='$6$foobarsalt$q.P2932zYMLbKnjFwIxPI8y3iuxeuJ2BgE372LcZMMnj3Gcg/9mJg2LPKUl.ha0TG/.fRNNnRQcLfzM0SNot3.'
|
||||||
|
|
||||||
|
# Debian and Ubuntu use /etc/default/locale instead of /etc/locale.conf. Make
|
||||||
|
# sure we use the appropriate path for locale configuration.
|
||||||
|
LOCALE_PATH="/etc/locale.conf"
|
||||||
|
[ -e "$LOCALE_PATH" ] || LOCALE_PATH="/etc/default/locale"
|
||||||
|
[ -e "$LOCALE_PATH" ] || systemd-firstboot --locale=C.UTF-8
|
||||||
|
|
||||||
# Create a minimal root so we don't modify the testbed
|
# Create a minimal root so we don't modify the testbed
|
||||||
ROOT=test-root
|
ROOT=test-root
|
||||||
mkdir -p "$ROOT/bin"
|
mkdir -p "$ROOT/bin"
|
||||||
@ -31,14 +37,14 @@ mkdir -p "$ROOT/bin"
|
|||||||
touch "$ROOT/bin/fooshell" "$ROOT/bin/barshell"
|
touch "$ROOT/bin/fooshell" "$ROOT/bin/barshell"
|
||||||
|
|
||||||
systemd-firstboot --root="$ROOT" --locale=foo
|
systemd-firstboot --root="$ROOT" --locale=foo
|
||||||
grep -q "LANG=foo" "$ROOT/etc/locale.conf"
|
grep -q "LANG=foo" "$ROOT$LOCALE_PATH"
|
||||||
rm -fv "$ROOT/etc/locale.conf"
|
rm -fv "$ROOT$LOCALE_PATH"
|
||||||
systemd-firstboot --root="$ROOT" --locale-messages=foo
|
systemd-firstboot --root="$ROOT" --locale-messages=foo
|
||||||
grep -q "LC_MESSAGES=foo" "$ROOT/etc/locale.conf"
|
grep -q "LC_MESSAGES=foo" "$ROOT$LOCALE_PATH"
|
||||||
rm -fv "$ROOT/etc/locale.conf"
|
rm -fv "$ROOT$LOCALE_PATH"
|
||||||
systemd-firstboot --root="$ROOT" --locale=foo --locale-messages=bar
|
systemd-firstboot --root="$ROOT" --locale=foo --locale-messages=bar
|
||||||
grep -q "LANG=foo" "$ROOT/etc/locale.conf"
|
grep -q "LANG=foo" "$ROOT$LOCALE_PATH"
|
||||||
grep -q "LC_MESSAGES=bar" "$ROOT/etc/locale.conf"
|
grep -q "LC_MESSAGES=bar" "$ROOT$LOCALE_PATH"
|
||||||
|
|
||||||
systemd-firstboot --root="$ROOT" --keymap=foo
|
systemd-firstboot --root="$ROOT" --keymap=foo
|
||||||
grep -q "KEYMAP=foo" "$ROOT/etc/vconsole.conf"
|
grep -q "KEYMAP=foo" "$ROOT/etc/vconsole.conf"
|
||||||
@ -82,8 +88,8 @@ systemd-firstboot --root="$ROOT" \
|
|||||||
--root-password-hashed="$ROOT_HASHED_PASSWORD2" \
|
--root-password-hashed="$ROOT_HASHED_PASSWORD2" \
|
||||||
--root-shell=/bin/barshell \
|
--root-shell=/bin/barshell \
|
||||||
--kernel-command-line="hello.world=0"
|
--kernel-command-line="hello.world=0"
|
||||||
grep -q "LANG=foo" "$ROOT/etc/locale.conf"
|
grep -q "LANG=foo" "$ROOT$LOCALE_PATH"
|
||||||
grep -q "LC_MESSAGES=bar" "$ROOT/etc/locale.conf"
|
grep -q "LC_MESSAGES=bar" "$ROOT$LOCALE_PATH"
|
||||||
grep -q "KEYMAP=foo" "$ROOT/etc/vconsole.conf"
|
grep -q "KEYMAP=foo" "$ROOT/etc/vconsole.conf"
|
||||||
readlink "$ROOT/etc/localtime" | grep -q "Europe/Berlin$"
|
readlink "$ROOT/etc/localtime" | grep -q "Europe/Berlin$"
|
||||||
grep -q "foobar" "$ROOT/etc/hostname"
|
grep -q "foobar" "$ROOT/etc/hostname"
|
||||||
@ -103,8 +109,8 @@ systemd-firstboot --root="$ROOT" --force \
|
|||||||
--root-password-hashed="$ROOT_HASHED_PASSWORD2" \
|
--root-password-hashed="$ROOT_HASHED_PASSWORD2" \
|
||||||
--root-shell=/bin/barshell \
|
--root-shell=/bin/barshell \
|
||||||
--kernel-command-line="hello.world=0"
|
--kernel-command-line="hello.world=0"
|
||||||
grep -q "LANG=locale-overwrite" "$ROOT/etc/locale.conf"
|
grep -q "LANG=locale-overwrite" "$ROOT$LOCALE_PATH"
|
||||||
grep -q "LC_MESSAGES=messages-overwrite" "$ROOT/etc/locale.conf"
|
grep -q "LC_MESSAGES=messages-overwrite" "$ROOT$LOCALE_PATH"
|
||||||
grep -q "KEYMAP=keymap-overwrite" "$ROOT/etc/vconsole.conf"
|
grep -q "KEYMAP=keymap-overwrite" "$ROOT/etc/vconsole.conf"
|
||||||
readlink "$ROOT/etc/localtime" | grep -q "/CET$"
|
readlink "$ROOT/etc/localtime" | grep -q "/CET$"
|
||||||
grep -q "hostname-overwrite" "$ROOT/etc/hostname"
|
grep -q "hostname-overwrite" "$ROOT/etc/hostname"
|
||||||
@ -118,7 +124,7 @@ rm -fr "$ROOT"
|
|||||||
mkdir "$ROOT"
|
mkdir "$ROOT"
|
||||||
# Copy everything at once (--copy)
|
# Copy everything at once (--copy)
|
||||||
systemd-firstboot --root="$ROOT" --copy
|
systemd-firstboot --root="$ROOT" --copy
|
||||||
diff /etc/locale.conf "$ROOT/etc/locale.conf"
|
diff $LOCALE_PATH "$ROOT$LOCALE_PATH"
|
||||||
diff <(awk -F: '/^root/ { print $7; }' /etc/passwd) <(awk -F: '/^root/ { print $7; }' "$ROOT/etc/passwd")
|
diff <(awk -F: '/^root/ { print $7; }' /etc/passwd) <(awk -F: '/^root/ { print $7; }' "$ROOT/etc/passwd")
|
||||||
diff <(awk -F: '/^root/ { print $2; }' /etc/shadow) <(awk -F: '/^root/ { print $2; }' "$ROOT/etc/shadow")
|
diff <(awk -F: '/^root/ { print $2; }' /etc/shadow) <(awk -F: '/^root/ { print $2; }' "$ROOT/etc/shadow")
|
||||||
[[ -e /etc/vconsole.conf ]] && diff /etc/vconsole.conf "$ROOT/etc/vconsole.conf"
|
[[ -e /etc/vconsole.conf ]] && diff /etc/vconsole.conf "$ROOT/etc/vconsole.conf"
|
||||||
@ -127,7 +133,7 @@ rm -fr "$ROOT"
|
|||||||
mkdir "$ROOT"
|
mkdir "$ROOT"
|
||||||
# Copy everything at once, but now by using separate switches
|
# Copy everything at once, but now by using separate switches
|
||||||
systemd-firstboot --root="$ROOT" --copy-locale --copy-keymap --copy-timezone --copy-root-password --copy-root-shell
|
systemd-firstboot --root="$ROOT" --copy-locale --copy-keymap --copy-timezone --copy-root-password --copy-root-shell
|
||||||
diff /etc/locale.conf "$ROOT/etc/locale.conf"
|
diff $LOCALE_PATH "$ROOT$LOCALE_PATH"
|
||||||
diff <(awk -F: '/^root/ { print $7; }' /etc/passwd) <(awk -F: '/^root/ { print $7; }' "$ROOT/etc/passwd")
|
diff <(awk -F: '/^root/ { print $7; }' /etc/passwd) <(awk -F: '/^root/ { print $7; }' "$ROOT/etc/passwd")
|
||||||
diff <(awk -F: '/^root/ { print $2; }' /etc/shadow) <(awk -F: '/^root/ { print $2; }' "$ROOT/etc/shadow")
|
diff <(awk -F: '/^root/ { print $2; }' /etc/shadow) <(awk -F: '/^root/ { print $2; }' "$ROOT/etc/shadow")
|
||||||
[[ -e /etc/vconsole.conf ]] && diff /etc/vconsole.conf "$ROOT/etc/vconsole.conf"
|
[[ -e /etc/vconsole.conf ]] && diff /etc/vconsole.conf "$ROOT/etc/vconsole.conf"
|
||||||
@ -140,8 +146,8 @@ touch "$ROOT/bin/fooshell" "$ROOT/bin/barshell"
|
|||||||
# We can do only limited testing here, since it's all an interactive stuff,
|
# We can do only limited testing here, since it's all an interactive stuff,
|
||||||
# so --prompt and --prompt-root-password are skipped on purpose
|
# so --prompt and --prompt-root-password are skipped on purpose
|
||||||
echo -ne "\nfoo\nbar\n" | systemd-firstboot --root="$ROOT" --prompt-locale
|
echo -ne "\nfoo\nbar\n" | systemd-firstboot --root="$ROOT" --prompt-locale
|
||||||
grep -q "LANG=foo" "$ROOT/etc/locale.conf"
|
grep -q "LANG=foo" "$ROOT$LOCALE_PATH"
|
||||||
grep -q "LC_MESSAGES=bar" "$ROOT/etc/locale.conf"
|
grep -q "LC_MESSAGES=bar" "$ROOT$LOCALE_PATH"
|
||||||
echo -ne "\nfoo\n" | systemd-firstboot --root="$ROOT" --prompt-keymap
|
echo -ne "\nfoo\n" | systemd-firstboot --root="$ROOT" --prompt-keymap
|
||||||
grep -q "KEYMAP=foo" "$ROOT/etc/vconsole.conf"
|
grep -q "KEYMAP=foo" "$ROOT/etc/vconsole.conf"
|
||||||
echo -ne "\nEurope/Berlin\n" | systemd-firstboot --root="$ROOT" --prompt-timezone
|
echo -ne "\nEurope/Berlin\n" | systemd-firstboot --root="$ROOT" --prompt-timezone
|
||||||
|
Loading…
x
Reference in New Issue
Block a user