slish rev 7

Add a users list command
author Christophe Lincoln <pankso@slitaz.org>
date Thu Jan 23 23:23:25 2014 +0100 (2014-01-23)
parents e9a2fa5a68d9
children bde0b2c5f234
files slish
line diff
     1.1 --- a/slish	Thu Jan 23 22:51:29 2014 +0100
     1.2 +++ b/slish	Thu Jan 23 23:23:25 2014 +0100
     1.3 @@ -33,6 +33,8 @@
     1.4  
     1.5  $(boldify "Commands:")
     1.6    info          Display paths, configs and some stats
     1.7 +  last          Show last chroted users
     1.8 +  users         List all users with name and mail
     1.9    setup         Setup SliSH server and user chroot
    1.10    gen-chroot    Generate a new default or user chroot
    1.11    clean-chroot  Clean the chroot but skip home and root
    1.12 @@ -203,7 +205,7 @@
    1.13  	newline
    1.14  	echo "$(boldify 'Deleting user:') $(colorize 32 "$user")"
    1.15  	separator
    1.16 -	echo -n "Removing user account from: $(hostname) server"
    1.17 +	echo -n "Removing user account from $(hostname) server"
    1.18  	deluser "$user"; status
    1.19  	sed -i "/^$user:/"d ${root}/etc/passwd
    1.20  	sed -i "/^$user:/"d ${root}/etc/group
    1.21 @@ -280,6 +282,18 @@
    1.22  		separator
    1.23  		tac ${activity} | head -n 20
    1.24  		separator && newline ;;
    1.25 +	users)
    1.26 +		check_root
    1.27 +		newline
    1.28 +		boldify "Users list"
    1.29 +		separator
    1.30 +		for user in $(ls ${people})
    1.31 +		do
    1.32 +			. ${people}/${user}/account.conf
    1.33 +			echo -n "$(colorize 34 "$user")"
    1.34 +			echo -n "$(indent 20 "$NAME")" && indent 46 "<$MAIL>"
    1.35 +		done
    1.36 +		separator && newline ;;
    1.37  	setup)
    1.38  		check_root
    1.39  		setup ;;