File: cfssh

package info (click to toggle)
cfs 1.4.1-17
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 600 kB
  • ctags: 648
  • sloc: ansic: 7,684; sh: 362; makefile: 185
file content (38 lines) | stat: -rwxr-xr-x 624 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh

if [ -z "$1" ]; then
	echo Usage: cfssh directory
	exit 1
fi

CONFIG_FILE=/etc/cfs.conf

# Config defaults
CRYPT_ROOT=/var/cfs

# Read config file
if test -f $CONFIG_FILE; then . $CONFIG_FILE; fi

if test "$CRYPT_ROOT" = ""; then
	echo "Cannot determine CRYPT_ROOT"
	exit 1
fi

# Attach the directory and change into it
D=.$RANDOM.$RANDOM
if cattach $1 $D; then :; else
	echo "cattach failed"
	exit 1
fi
echo "Directory is $CRYPT_ROOT/$D"
cd $CRYPT_ROOT/$D

# Clear variables
D="                "
CWD=`/bin/pwd`
D=`basename $CWD`
PWD=$CWD
export RANDOM=0

# Set the shell up
exec /bin/sh -c "$SHELL ; cdetach $D"