ssfs view ssfs-sh @ rev 109

Remove ashism ==
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 26 12:27:01 2019 +0100 (2019-02-26)
parents 86891a868e9d
children
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 *help) echo "Usage: $(basename $0) [args]" && exit 0 ;;
15 esac
17 # Ssfs server config doesn't exist in chroot.
18 if [ -f /etc/ssfs/ssfs-server.conf ]; then
19 . /etc/ssfs/ssfs-server.conf
20 root=$SSFS_CHROOT
21 # Make sure it's a valid Ssfs user.
22 [ -d "$root/home/$USER" ] || exit 0
23 exec chroot $root /bin/ssfs-sh "$@"
24 else
25 # Chroot will drop user into /, so set new HOME and cd. Set also
26 # some env variables but don't source any profile.
27 clear && echo -e \
28 "\n\033[1m Welcome to the Ssfs SHell $USER\033[0m\n"
29 PS1='\u@ssfs\e[0m:\e[1;34m\w\e[0m\$ '
30 PATH='/bin'
31 HOME=/home/$USER
32 SYNC=$HOME/Sync
33 SHELL=/bin/sh
34 export PS1 PATH HOME SYNC SHELL
35 cd $HOME
36 exec /bin/sh "$@"
37 fi