Single user case

This commit is contained in:
Bob Mottram 2015-11-30 15:56:07 +00:00
parent f6eb49cffa
commit 48d3d3f2f2
1 changed files with 20 additions and 13 deletions

View File

@ -702,20 +702,27 @@ function interactive_configuration {
esac
done
else
if [[ $SYSTEM_TYPE == "$VARIANT_MESH" && $DEFAULT_DOMAIN_NAME && -d /home/$DEFAULT_DOMAIN_NAME ]]; then
MY_USERNAME=$DEFAULT_DOMAIN_NAME
no_of_users=$(find /home/* -maxdepth 0 -type d | wc -l)
if [ $no_of_users -eq 1 ]; then
# only a single user on the system
MY_USERNAME=$(ls /home)
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 one from a number of users
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
fi
fi
fi