Special case when there are no tox users on the network

This commit is contained in:
Bob Mottram 2016-08-24 09:09:12 +01:00
parent d20e0dc15a
commit 673a79bdcf
No known key found for this signature in database
GPG Key ID: 0452CC7CEA982E38
1 changed files with 5 additions and 1 deletions

View File

@ -715,7 +715,11 @@ function configure_user_interface {
cat <<EOF > $rootdir/usr/bin/list-tox-users
#!/bin/bash
users_list=\$(lstox | awk -F ' ' '{\$1=""; print \$0}' | sed -e 's/^[[:space:]]*//' | sort -d)
no_of_users=\$(echo "\$users_list" | wc -l)
if [ ! \$users_list ]; then
no_of_users=0
else
no_of_users=\$(echo "\$users_list" | wc -l)
fi
if [ \$no_of_users -gt 0 ]; then
echo "\$users_list" > /home/$MY_USERNAME/Users.txt
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Users.txt