# HG changeset patch # User Christophe Lincoln # Date 1390856341 -3600 # Node ID 27c18235251c8c4cea064037fea5e32da498aaad # Parent ab2bf5d509ef31aa98e040965136495890c6a17c Add slish to /etc/shells (used by dropbear) and some improvment diff -r ab2bf5d509ef -r 27c18235251c slish --- a/slish Sat Jan 25 00:19:41 2014 +0000 +++ b/slish Mon Jan 27 21:59:01 2014 +0100 @@ -70,6 +70,11 @@ done # Activity log must be writable by users touch ${activity} && chmod 0666 ${activity} + # Add /usr/bin/slish to /etc/shells (dropbear need it) + if ! fgrep -q '/usr/bin/slish' /etc/shells; then + echo "Adding /bin/slish to the list of valid shells..." + echo '/usr/bin/slish' >> /etc/shells + fi echo "All done!" } @@ -116,7 +121,7 @@ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit -Hi, +Hi $name, Your custom SliTaz GNU/Linux SHell is ready to use! You can login with: @@ -135,9 +140,18 @@ # Add a new SliSH user add_user() { + #home="$root/./home/$user" home="$root/home/$user" shell="/usr/bin/slish" + # Check values + if [ ! "$user" ] || [ ! "$name" ] || [ ! "$pass" ] || [ ! "$mail" ]; then + newline + echo "Missing option(s): --user= --name= --pass= --mail=" + newline && exit 0 + fi + + # Exit if user already exist if grep -q ^${user}: /etc/passwd; then newline echo -n "User already exists: "; colorize 31 "$user" @@ -146,7 +160,7 @@ fi newline - echo -n "$(boldify 'Creating user:') "; colorize 32 "$user" + echo -n "$(boldify 'Creating user:') "; colorize 34 "$user" separator echo -e "$pass\n$pass" | adduser -h "$home" -g "SliSH User" \ -s ${shell} ${user} >/dev/null @@ -185,6 +199,7 @@ # Add all users from the signup queue add_queued_user() { + echo "Checking: $queue" for user in $(ls ${queue}) do . ${queue}/${user}/account.conf @@ -203,16 +218,16 @@ newline && exit 0 fi newline - echo "$(boldify 'Deleting user:') $(colorize 32 "$user")" + echo "$(boldify 'Deleting user:') $(colorize 34 "$user")" separator echo -n "Removing user account from $(hostname) server" deluser "$user"; status sed -i "/^$user:/"d ${root}/etc/passwd sed -i "/^$user:/"d ${root}/etc/group echo -n "Removing all files in : $home" - rm -rf ${home} ; status + rm -rf ${home}; status echo -n "Removing user config : $people/$user" - rm -rf "${people}/${user}" ; status + rm -rf "${people}/${user}"; status separator && newline } @@ -300,7 +315,7 @@ adduser) # We can adduser from cmdline or from the signup queue check_root - if [ "$from-queu" ]; then + if [ "$queued" ]; then add_queued_user else add_user @@ -331,7 +346,7 @@ . ${people}/"$USER"/account.conf log "Chrooting user: $USER" ulimit $(echo "$ULIMIT") - exec chroot ${root} /bin/slish.sh "$@" + exec /usr/sbin/chroot ${root} /bin/slish.sh "$@" else usage fi ;; diff -r ab2bf5d509ef -r 27c18235251c tools/slish.sh --- a/tools/slish.sh Sat Jan 25 00:19:41 2014 +0000 +++ b/tools/slish.sh Mon Jan 27 21:59:01 2014 +0100 @@ -9,8 +9,11 @@ . /lib/libtaz.sh # Welcome -clear && colorize 36 "Welcome to your SliTaz SHell" -boldify $(date '+%a %b %d %Y - %H:%M') +clear && boldify "Welcome to your SliTaz SHell" +colorize 30 $(date '+%a %b %d %Y - %H:%M') +newline +echo "SliTaz : $(cat /etc/slitaz-release) ($(uname -sr))" +echo "Home : $(du -sh /home/$USER)" newline # Set some env variables @@ -18,8 +21,10 @@ PATH='/bin:/usr/bin' HOME=/home/$USER SHELL=/bin/sh -export PS1 PATH HOME SHELL -umask 0077 +EDITOR=nano +export PS1 PATH HOME SHELL EDITOR +#umask 0077 +umask 0022 # Chroot will drop user into / cd ${HOME}