ssfs view ssfs-sh @ rev 42

ssfh-sh: fix arguments handling
author Christophe Lincoln <pankso@slitaz.org>
date Sun Jun 12 16:26:17 2011 +0200 (2011-06-12)
parents 6abd5dd7659d
children ae4fbb9cbaf5
line source
1 #!/bin/sh
2 #
3 # Ssfs users SHell - Chroot user into the virtual disk on login. This tool must
4 # be installed on the server and in the vdisk chroot, it is executed when logging
5 # in and when chrooting.
6 #
7 # Copyright (C) SliTaz GNU/Linux - BSD License
8 # Author: Christophe Lincoln <pankso@slitaz.org>
9 #
11 # Ssfs server config doesn't exist in chroot.
12 if [ -f /etc/ssfs/ssfs-server.conf ]; then
13 . /etc/ssfs/ssfs-server.conf
14 root=$SSFS_CHROOT
15 # Make sure it's a valid Ssfs user.
16 [ -d "$root/home/$USER" ] || exit 0
17 exec chroot $root /bin/ssfs-sh $@
18 else
19 # Chroot will drop user into /, so set new HOME and cd. Set also
20 # some env variables but don't source any profile.
21 cmd=$(echo $@ | sed s'/-c //') && clear
22 echo -e "\n\033[1m Welcome to the Ssfs SHell $USER\033[0m\n"
23 PS1='\u@\h\e[0m:\e[1;34m\w\e[0m\$ '
24 HOME=/home/$USER
25 SYNC=$HOME/Sync
26 SHELL=/bin/sh
27 export PS1 HOME SYNC SHELL
28 cd $HOME
29 [ "$cmd" ] || exec /bin/sh
30 exec /bin/sh -c "$cmd"
31 fi