File: updatejail

package info (click to toggle)
jailer 0.4-8
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 364 kB
  • ctags: 6
  • sloc: sh: 2,595; perl: 207; makefile: 48
file content (45 lines) | stat: -rwxr-xr-x 845 bytes parent folder | download | duplicates (2)
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
39
40
41
42
43
44
45
#!/bin/sh 
#
#
#

KEEP="/dev/log
"


if [ Q$1 == "Q" -o Q$2 == "Q" ]
then
	echo "Usage: upratejail <config.file> <jail identifier>"
else

	JAIL=`cat $1 | grep Root: | grep $2 | awk '{print $2}'`
	echo "jail: " $JAIL
	echo "config: " $1
	read

	
	if test -d $JAIL
	then
		cd $JAIL

		find $JAIL -type b > /tmp/$$.updatejail
		find $JAIL -type c >> /tmp/$$.updatejail
		find $JAIL -type p >> /tmp/$$.updatejail
		find $JAIL -type f >> /tmp/$$.updatejail
		find $JAIL -type l >> /tmp/$$.updatejail
		find $JAIL -type s >> /tmp/$$.updatejail
		for i in `echo $KEEP`
		do
			cat /tmp/$$.updatejail | grep -v $JAIL$i > /tmp/$$.updatejail.tmp
			mv /tmp/$$.updatejail.tmp /tmp/$$.updatejail
		done
		for i in `cat /tmp/$$.updatejail`
		do
			rm $i
		done
		rm /tmp/$$.updatejail
		/usr/sbin/jailer $1 $2
	else
		echo "This jail does not exist!"
	fi
fi