diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2022-05-19 17:16:50 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2022-05-19 17:16:50 +0200 |
commit | 7231208d8ae2495bd52b241403c728b1c0c29895 (patch) | |
tree | 1f6c6a81fc87e2525571096b268c2c5053f42b10 /setup-desktop.in | |
parent | c2a62a09f7a6a81f2d4b2f2d809e64339f86f26b (diff) | |
download | alpine-conf-7231208d8ae2495bd52b241403c728b1c0c29895.zip |
setup-desktop: fix non-interactive mode
Diffstat (limited to 'setup-desktop.in')
-rw-r--r-- | setup-desktop.in | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/setup-desktop.in b/setup-desktop.in index 116cd59..ad2a269 100644 --- a/setup-desktop.in +++ b/setup-desktop.in @@ -30,9 +30,15 @@ if [ $# -gt 1 ]; then fi de="$1" + +valid_desktops="xfce gnome none" +if [ $# -eq 1 ] && ! isin "$de" $valid_desktops; then + echo "$de is not a valid desktop" >&2 + usage "1" >&2 +fi shift -while [ $# -ne 1 ] && ! isin "$de" xfce gnome none; do +while ! isin "$de" $valid_desktops; do ask "Which desktop environment? ('gnome', 'xfce' or 'none')" none de="$resp" done @@ -61,7 +67,7 @@ case "$de" in ;; esac -users=$(awk -F: '{if ($3<65000 && $3 >= 1000) print $1}' "$ROOT"/etc/passwd) +users=$(awk -F: '{if ($3<65000 && $3 >= 1000) print $1}' "$ROOT"/etc/passwd 2>/dev/null) if [ -z "$users" ]; then echo "WARNING: You need to create a user account. Please run:" >&2 echo "" >&2 |