File: lua5.1-policy-apply

package info (click to toggle)
lua5.1-policy 20
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 132 kB
  • ctags: 10
  • sloc: sh: 104; ansic: 41; makefile: 39
file content (72 lines) | stat: -rwxr-xr-x 1,661 bytes parent folder | download
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh

POLICYDIR=/usr/share/lua5.1-policy-dev/
TEMPLATES="Makefile.Debian.single Makefile.Debian.multiple app.c app.c.conf.in pkg-config.pc.in"
STAMPDIR=debian/lua5.1-policy-apply-stamp/

B=`basename $0`

apply(){
if [ -d $STAMPDIR ]; then
	echo $B: info: lua5.1-policy-apply already called here! 
	exit 0
fi

if [ "`echo debian/*Makefile.Debian.conf`" = 'debian/*Makefile.Debian.conf' ]; then
	echo $B: error: 'debian/Makefile.Debian.conf' missing
	echo $B: error: See
	echo $B: error:   /usr/share/lua5.1-policy-dev/Makefile.Debian.conf.sample 
	echo $B: error: for a sample file.
	echo $B: info: You can use the lua5.1-policy-create-svnbuildpackage-layout
	echo $B: info: utility to create a debian package.
	exit 1
fi
	
echo $B: info: adding $STAMPDIR
mkdir $STAMPDIR

for X in $TEMPLATES; do
	if [ -e $X ]; then
		mv $X $STAMPDIR/
		echo $B: info: saving $X in $STAMPDIR
	fi
	cp $POLICYDIR/$X .
	echo $B: info: adding $X
done
if [ -e Makefile.Debian ]; then
	mv Makefile.Debian $STAMPDIR/
	echo $B: info: saving Makefile.Debian in $STAMPDIR
fi
ln -s Makefile.Debian.multiple Makefile.Debian
echo "$B: info: adding Makefile.Debian -> Makefile.Debian.multiple"
}

unapply(){
if [ ! -d $STAMPDIR ]; then
	echo $B: info: lua5.1-policy-apply not called here! 
	exit 0
fi

for X in $TEMPLATES; do
	echo $B: info: removing $X
	rm $X
done
echo $B: info: removing Makefile.Debian symlink
rm -f Makefile.Debian
for X in $STAMPDIR/*; do
	if [ -e $X ]; then
		echo $B: info: restoring `basename $X` from $STAMPDIR
		mv $X .
	fi
done
echo $B: info: removing $STAMPDIR
rm -rf $STAMPDIR
}

if [ "$1" = "-r" -o "$1" = "--reverse" ]; then
	unapply
else
	apply
fi

#eof