Browse Source

Single user case

Bob Mottram 9 years ago
parent
commit
48d3d3f2f2
1 changed files with 20 additions and 13 deletions
  1. 20
    13
      src/freedombone-config

+ 20
- 13
src/freedombone-config View File

702
             esac
702
             esac
703
         done
703
         done
704
     else
704
     else
705
-        if [[ $SYSTEM_TYPE == "$VARIANT_MESH" && $DEFAULT_DOMAIN_NAME && -d /home/$DEFAULT_DOMAIN_NAME ]]; then
706
-            MY_USERNAME=$DEFAULT_DOMAIN_NAME
705
+        no_of_users=$(find /home/* -maxdepth 0 -type d | wc -l)
706
+        if [ $no_of_users -eq 1 ]; then
707
+            # only a single user on the system
708
+            MY_USERNAME=$(ls /home)
707
         else
709
         else
708
-            data=$(tempfile 2>/dev/null)
709
-            trap "rm -f $data" 0 1 2 5 15
710
-            dialog --title $"Select the user account to install as" \
711
-                   --backtitle $"Freedombone Configuration" \
712
-                   --dselect "/home/$(grep 'MY_USERNAME' temp.cfg | awk -F '=' '{print $2}')" 14 40 2> $data
713
-            sel=$?
714
-            case $sel in
715
-                0) MY_USERNAME=$(cat $data | awk -F '/' '{print $3}');;
716
-                1) exit 1;;
717
-                255) exit 1;;
718
-            esac
710
+            # select one from a number of users
711
+            if [[ $SYSTEM_TYPE == "$VARIANT_MESH" && $DEFAULT_DOMAIN_NAME && -d /home/$DEFAULT_DOMAIN_NAME ]]; then
712
+                MY_USERNAME=$DEFAULT_DOMAIN_NAME
713
+            else
714
+                data=$(tempfile 2>/dev/null)
715
+                trap "rm -f $data" 0 1 2 5 15
716
+                dialog --title $"Select the user account to install as" \
717
+                       --backtitle $"Freedombone Configuration" \
718
+                       --dselect "/home/$(grep 'MY_USERNAME' temp.cfg | awk -F '=' '{print $2}')" 14 40 2> $data
719
+                sel=$?
720
+                case $sel in
721
+                    0) MY_USERNAME=$(cat $data | awk -F '/' '{print $3}');;
722
+                    1) exit 1;;
723
+                    255) exit 1;;
724
+                esac
725
+            fi
719
         fi
726
         fi
720
     fi
727
     fi
721
 
728