From a9d8d0576d68988429d07a8ccc560ecb24a5d726 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 17 Oct 2016 18:21:34 +0100 Subject: [PATCH] If there is only one valid user then don't show selection --- src/freedombone-config | 10 +++++++--- src/freedombone-controlpanel | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/freedombone-config b/src/freedombone-config index 54050397..07fe6ab5 100755 --- a/src/freedombone-config +++ b/src/freedombone-config @@ -1309,10 +1309,14 @@ function select_user { fi done - user_index=$(dialog --backtitle $"Freedombone Configuration" --title $"Select User" --menu $"Select one of the following:" 24 40 17 "${W[@]}" 3>&2 2>&1 1>&3) + if [ $i -eq 1 ]; then + SELECTED_USERNAME="${name[0]}" + else + user_index=$(dialog --backtitle $"Freedombone Configuration" --title $"Select User" --menu $"Select one of the following:" 24 40 17 "${W[@]}" 3>&2 2>&1 1>&3) - if [ $? -eq 0 ]; then - SELECTED_USERNAME="${name[$((user_index-1))]}" + if [ $? -eq 0 ]; then + SELECTED_USERNAME="${name[$((user_index-1))]}" + fi fi } diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel index 03d13d01..2764de01 100755 --- a/src/freedombone-controlpanel +++ b/src/freedombone-controlpanel @@ -403,10 +403,14 @@ function select_user { fi done - user_index=$(dialog --backtitle $"Freedombone Control Panel" --title $"Select User" --menu $"Select one of the following:" 24 40 17 "${W[@]}" 3>&2 2>&1 1>&3) + if [ $i -eq 1 ]; then + SELECTED_USERNAME="${name[0]}" + else + user_index=$(dialog --backtitle $"Freedombone Control Panel" --title $"Select User" --menu $"Select one of the following:" 24 40 17 "${W[@]}" 3>&2 2>&1 1>&3) - if [ $? -eq 0 ]; then - SELECTED_USERNAME="${name[$((user_index-1))]}" + if [ $? -eq 0 ]; then + SELECTED_USERNAME="${name[$((user_index-1))]}" + fi fi }