Skip to content

Commit

Permalink
Rename _PRESET variables
Browse files Browse the repository at this point in the history
Rename the *_PRESET variables and document the re-export in the
second virtual console.
  • Loading branch information
aplanas committed May 13, 2019
1 parent 2eb48c5 commit 687333e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
18 changes: 10 additions & 8 deletions files/usr/lib/jeos-firstboot
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ findlocales()
[ -n "$list" ]
}

if [ -z "$LOCALE_PRESET" ]; then
if [ -z "$JEOS_LOCALE" ]; then
default="en_US"
[ -f /etc/locale.conf ] && locale_lang="$(awk -F= '$1 == "LANG" { split($2,fs,"."); print fs[1]; exit }' /etc/locale.conf)"
[ -n "$locale_lang" ] && default="$locale_lang"
Expand All @@ -185,11 +185,11 @@ if [ -z "$LOCALE_PRESET" ]; then
run langset.sh $locale || warn $"Setting the locale failed"
fi
else
locale="$LOCALE_PRESET"
locale="$JEOS_LOCALE"
systemd_firstboot_args+=("--locale=$locale")
fi

if [ -z "$KEYTABLE_PRESET" ]; then
if [ -z "$JEOS_KEYTABLE" ]; then
default="us"
[ -f /etc/vconsole.conf ] && vconsole_keymap="$(awk -F= '$1 == "KEYMAP" { split($2,fs,"."); print fs[1]; exit }' /etc/vconsole.conf)"
[ -n "$vconsole_keymap" ] && default="$vconsole_keymap"
Expand Down Expand Up @@ -222,8 +222,10 @@ if [[ "$(ps h -o tty -p $$)" = tty[0-9]* ]]; then
start_kmscon["ko"]=1

if [ -n "$locale" -a -n "${start_kmscon[${language}]+_}" ]; then
export LOCALE_PRESET="$locale"
export KEYTABLE_PRESET="$keytable"
# We re-export the variables, as will be inspected when this
# script is re-executed in the secondary console
export JEOS_LOCALE="$locale"
export JEOS_KEYTABLE="$keytable"

if kmscon_available; then
ret_file="$(mktemp)"
Expand Down Expand Up @@ -270,7 +272,7 @@ fi
default="$(readlink -f /etc/localtime)"
default="${default##/usr/share/zoneinfo/}"

if [ -z "$TIMEZONE_PRESET" ]; then
if [ -z "$JEOS_TIMEZONE" ]; then
# timedatectl doesn't work as dbus is not up yet
# menulist timedatectl --no-pager list-timezones
if menulist awk \
Expand All @@ -284,15 +286,15 @@ if [ -z "$TIMEZONE_PRESET" ]; then
d --msgbox $"error setting timezone" 0 0
fi
else
timezone="$TIMEZONE_PRESET"
timezone="$JEOS_TIMEZONE"
systemd_firstboot_args+=("--timezone=$timezone")
fi

# systemd-firstboot does not set the timezone if it exists, langset.sh created it
run rm -f /etc/localtime
run systemd-firstboot "${systemd_firstboot_args[@]}"

if [ -z "$PASSWORD_ALREADY_SET" ]; then
if [ -z "$JEOS_PASSWORD_ALREADY_SET" ]; then
# NOTE: must be last as dialog file is used to set the password
while true; do
password=
Expand Down
8 changes: 4 additions & 4 deletions files/usr/share/defaults/jeos-firstboot.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Example configuration file for jeos-firstboot

# LOCALE_PRESET='en_US'
# KEYTABLE_PRESET='en'
# TIMEZONE_PRESET='UTC'
# PASSWORD_ALREADY_SET=0
# JEOS_LOCALE='en_US'
# JEOS_KEYTABLE='en'
# JEOS_TIMEZONE='UTC'
# JEOS_PASSWORD_ALREADY_SET=0

0 comments on commit 687333e

Please sign in to comment.