Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions packages/omamobile-firstboot/bin/omamobile-firstboot
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
4 changes: 4 additions & 0 deletions packages/omamobile-firstboot/test/all
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/omamobile-firstboot/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.4
0.1.5