File: prep.sh

package info (click to toggle)
libreswan 5.2-2.3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 81,644 kB
  • sloc: ansic: 129,988; sh: 32,018; xml: 20,646; python: 10,303; makefile: 3,022; javascript: 1,506; sed: 574; yacc: 511; perl: 264; awk: 52
file content (77 lines) | stat: -rwxr-xr-x 1,143 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
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
73
74
75
76
77
#!/bin/sh

hostname=$(hostname)

copy_if()
{
    local d=$1 ; shift
    rm -f ${d}
    local s
    for s in "$@" ; do
	test ! -r ${s} && continue
	if test -r ${d} ; then
	    echo "duplicate ${d}: $@" 1>&2
	    exit 1
	fi
	mkdir -p $(dirname ${d})
	cp -v ${s} ${d}
	chmod u=r,go= ${d}
    done
}

log_if() {
    local d=$1
    rm -f /tmp/${d}.log
    if test -r ${2} ; then
	ln -s $PWD/OUTPUT/${hostname}.${d}.log /tmp/${d}.log
    fi
}

#
# Libreswan
#
# install stuff into ${etc}/ipsec.*
#

case $(uname) in
    Linux ) etc=/etc ;;
    *BSD ) etc=/usr/local/etc ;;
esac

rm -rf ${etc}/ipsec.d
mkdir ${etc}/ipsec.d

for s in conf secrets ; do
    copy_if ${etc}/ipsec.${s} ${hostname}.${s} ipsec.${s}
done

log_if pluto ${etc}/ipsec.conf

#
# IKED
#
# Install stuff into /etc/*.conf
#

for n in iked.conf ; do
    copy_if /etc/iked.conf ${hostname}.${n} ${n}
done

log_if iked /etc/iked.conf

#
# Racoon
#
# Install stuff into /etc/racoon/*
#

rm -rf /etc/racoon
for p in racoon.conf psk.txt ; do
    copy_if /etc/racoon/${p} ${hostname}.${p} ${p}
done

log_if racoon /etc/racoon/racoon.conf

case $(uname) in
    *BSD ) stty -oxtabs ;;
esac