Browse Source

Special case when there are no tox users on the network

Bob Mottram 9 years ago
parent
commit
673a79bdcf
No account linked to committer's email
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      src/freedombone-image-customise

+ 5
- 1
src/freedombone-image-customise View File

715
     cat <<EOF > $rootdir/usr/bin/list-tox-users
715
     cat <<EOF > $rootdir/usr/bin/list-tox-users
716
 #!/bin/bash
716
 #!/bin/bash
717
 users_list=\$(lstox | awk -F ' ' '{\$1=""; print \$0}' | sed -e 's/^[[:space:]]*//' | sort -d)
717
 users_list=\$(lstox | awk -F ' ' '{\$1=""; print \$0}' | sed -e 's/^[[:space:]]*//' | sort -d)
718
-no_of_users=\$(echo "\$users_list" | wc -l)
718
+if [ ! \$users_list ]; then
719
+    no_of_users=0
720
+else
721
+    no_of_users=\$(echo "\$users_list" | wc -l)
722
+fi
719
 if [ \$no_of_users -gt 0 ]; then
723
 if [ \$no_of_users -gt 0 ]; then
720
     echo "\$users_list" > /home/$MY_USERNAME/Users.txt
724
     echo "\$users_list" > /home/$MY_USERNAME/Users.txt
721
     chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Users.txt
725
     chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Users.txt