浏览代码

Special case when there are no tox users on the network

Bob Mottram 9 年前
父节点
当前提交
673a79bdcf
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5
    1
      src/freedombone-image-customise

+ 5
- 1
src/freedombone-image-customise 查看文件

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