Improved user selection dialog during install
This commit is contained in:
parent
b9baec2b1f
commit
b1178c2bc8
|
@ -598,6 +598,34 @@ function interactive_select_language {
|
|||
update-locale LC_CTYPE=${DEFAULT_LANGUAGE}
|
||||
}
|
||||
|
||||
function select_user {
|
||||
SELECTED_USERNAME=
|
||||
|
||||
users_array=($(ls /home))
|
||||
|
||||
delete=(mirrors git)
|
||||
for del in ${delete[@]}
|
||||
do
|
||||
users_array=(${users_array[@]/$del})
|
||||
done
|
||||
|
||||
i=0
|
||||
W=()
|
||||
name=()
|
||||
for u in ${users_array[@]}
|
||||
do
|
||||
i=$((i+1))
|
||||
W+=($i "$u")
|
||||
name+=("$u")
|
||||
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 [ $? -eq 0 ]; then
|
||||
SELECTED_USERNAME="${name[$((user_index-1))]}"
|
||||
fi
|
||||
}
|
||||
|
||||
function interactive_configuration {
|
||||
# create a temporary copy of the configuration file
|
||||
# which can be used to pre-populate selections
|
||||
|
@ -832,17 +860,8 @@ function interactive_configuration {
|
|||
if [[ $SYSTEM_TYPE == "$VARIANT_MESH" && $DEFAULT_DOMAIN_NAME && -d /home/$DEFAULT_DOMAIN_NAME ]]; then
|
||||
MY_USERNAME=$DEFAULT_DOMAIN_NAME
|
||||
else
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --title $"Select the user account to install as" \
|
||||
--backtitle $"Freedombone Configuration" \
|
||||
--dselect "/home/$(grep 'MY_USERNAME' temp.cfg | awk -F '=' '{print $2}')" 14 40 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
0) MY_USERNAME=$(cat $data | awk -F '/' '{print $3}');;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
select_user
|
||||
MY_USERNAME=$SELECTED_USERNAME
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue