ssfs view ssfs-sh @ rev 46

ssfs-sh: quote everything so it work
author Christophe Lincoln <pankso@slitaz.org>
date Sun Jun 12 18:21:50 2011 +0200 (2011-06-12)
parents ae4fbb9cbaf5
children 9cb82082540d
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 # Handle rsync first, user is chrooted after.
12 case "$@" in
13 *rsync*) exec /bin/sh "$@" ;;
14 esac
16 # Ssfs server config doesn't exist in chroot.
17 if [ -f /etc/ssfs/ssfs-server.conf ]; then
18 . /etc/ssfs/ssfs-server.conf
19 root=$SSFS_CHROOT
20 # Make sure it's a valid Ssfs user.
21 [ -d "$root/home/$USER" ] || exit 0
22 exec chroot $root /bin/ssfs-sh "$@"
23 else
24 # Chroot will drop user into /, so set new HOME and cd. Set also
25 # some env variables but don't source any profile.
26 echo -e "\n\033[1m Welcome to the Ssfs SHell $USER\033[0m\n"
27 PS1='\u@\h\e[0m:\e[1;34m\w\e[0m\$ '
28 HOME=/home/$USER
29 SYNC=$HOME/Sync
30 SHELL=/bin/sh
31 export PS1 HOME SYNC SHELL
32 cd $HOME
33 [ "$cmd" ] || exec /bin/sh
34 exec /bin/sh "$@"
35 fi