Selected username

This commit is contained in:
Bob Mottram 2016-02-02 14:01:27 +00:00
parent b1178c2bc8
commit f81489bd74
1 changed files with 12 additions and 7 deletions

View File

@ -110,6 +110,7 @@ DH_KEYLENGTH=
MINIMAL_INSTALL="yes"
DEFAULT_LANGUAGE='en_GB.UTF-8'
ONION_ONLY="no"
SELECTED_USERNAME=
# Mirrors settings
FRIENDS_MIRRORS_SERVER=
@ -810,21 +811,21 @@ function interactive_configuration {
exit 62753
fi
# when installing from an image which comes with a known default user account
selected_username=
while [ ! $selected_username ]
SELECTED_USERNAME=
while [ ! $SELECTED_USERNAME ]
do
if [ ! $selected_username ]; then
selected_username=$(grep 'MY_USERNAME' temp.cfg | awk -F '=' '{print $2}')
if [ ! $SELECTED_USERNAME ]; then
SELECTED_USERNAME=$(grep 'MY_USERNAME' temp.cfg | awk -F '=' '{print $2}')
fi
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Configuration" \
--title $"Username" \
--inputbox $"Set your username for the system\n\nYour username should not contain any spaces" 12 60 "$selected_username" 2> $data
--inputbox $"Set your username for the system\n\nYour username should not contain any spaces" 12 60 "$SELECTED_USERNAME" 2> $data
sel=$?
case $sel in
0) possible_username=$(cat $data)
selected_username=
SELECTED_USERNAME=
if [[ $possible_username != *' '* && $possible_username != *'/'* && $possible_username != *'\'* && $possible_username != *'*'* ]]; then
if [ $possible_username ]; then
if [ ${#possible_username} -gt 1 ]; then
@ -861,7 +862,11 @@ function interactive_configuration {
MY_USERNAME=$DEFAULT_DOMAIN_NAME
else
select_user
MY_USERNAME=$SELECTED_USERNAME
if [ ! $SELECTED_USERNAME ]; then
echo $'No username selected'
exit 72589
fi
MY_USERNAME="$SELECTED_USERNAME"
fi
fi
fi