diff --git a/packages/omamobile-firstboot/bin/omamobile-firstboot b/packages/omamobile-firstboot/bin/omamobile-firstboot index 5d44a0d02..298bdb08d 100755 --- a/packages/omamobile-firstboot/bin/omamobile-firstboot +++ b/packages/omamobile-firstboot/bin/omamobile-firstboot @@ -445,12 +445,16 @@ s_user_setup() { # variables as_user passes; Omarchy 4.5's writes only the Compose shortcuts # (its git setup is a command the owner runs). Written here, so the # installer's answers reach git under either; a blank one stays unset, and - # a failure is said but doesn't fail the first boot. - if [[ -n ${C[FULL_NAME]//[[:space:]]/} ]]; then - as_user git config --global user.name "${C[FULL_NAME]}" || echo " git's user.name could not be set" + # a failure is said but doesn't fail the first boot. Both keys are optional + # (the installer writes them only when given), so they are read with a + # default: under set -u a bare ${C[EMAIL]} ended this step before + # omamobile-setup-user and the lock toggles, on a phone whose owner gave none. + local name=${C[FULL_NAME]-} email=${C[EMAIL]-} + if [[ -n ${name//[[:space:]]/} ]]; then + as_user git config --global user.name "$name" || echo " git's user.name could not be set" fi - if [[ -n ${C[EMAIL]//[[:space:]]/} ]]; then - as_user git config --global user.email "${C[EMAIL]}" || echo " git's user.email could not be set" + if [[ -n ${email//[[:space:]]/} ]]; then + as_user git config --global user.email "$email" || echo " git's user.email could not be set" fi if command -v omamobile-setup-user >/dev/null; then as_user omamobile-setup-user || { echo " omamobile-setup-user failed"; failed=1; } diff --git a/packages/omamobile-firstboot/test/all b/packages/omamobile-firstboot/test/all index 38bfc85cf..e9db78351 100755 --- a/packages/omamobile-firstboot/test/all +++ b/packages/omamobile-firstboot/test/all @@ -207,6 +207,10 @@ pass "running again is safe" good | sed '/^WIFI_/d; /^FULL_NAME=/d; /^EMAIL=/d' > "$R/etc/omamobile/firstboot.conf" run || { cat "$t/run.out"; fail "a run without a name and email succeeds"; } grep -c ' git config ' "$CALLS" >/dev/null && fail "without a name and email git's config is not written" +# ... and the rest of user setup still runs: the step is optional, so a death +# in it (an unset key under set -u, 0.1.4) left the run's exit status at 0. +grep -c 'unbound variable' "$t/run.out" >/dev/null && { cat "$t/run.out"; fail "a run without a name and email reads no unset key"; } +grep -c 'with warnings' "$t/run.out" >/dev/null && { cat "$t/run.out"; fail "a run without a name and email ends without warnings"; } pass "the installer's name and email reach git; without them git is left alone" : > "$CALLS" diff --git a/packages/omamobile-firstboot/version b/packages/omamobile-firstboot/version index 845639eef..9faa1b7a7 100644 --- a/packages/omamobile-firstboot/version +++ b/packages/omamobile-firstboot/version @@ -1 +1 @@ -0.1.4 +0.1.5