Debian Codegraph @

testing/guestbin/swan-install

raw
1 #!/bin/sh
2
3 # we run with -x so : works instead of echo for output (not logging)
4 set -eux
5
6 if [ -r LIBRESWAN-OPENPGP-KEY.txt ]; then
7 cat <<EOF
8
9 $PWD is a top-level source directory.
10 Not CDing to /source
11
12 EOF
13 else
14 cd /source
15 fi
16
17 if [ -f /usr/libexec/ipsec/pluto ]; then
18 : ABORT: existing pluto found at /usr/libexec/ipsec/pluto
19 exit 1
20 fi
21
22 pidof pluto >/dev/null && ipsec setup stop 2> /dev/null
23
24 targets="install-base module_install"
25 make "$@" $targets
26
27 # ensure selinux bits
28 restorecon /usr/local/sbin -Rv
29 restorecon /usr/local/libexec/ipsec -Rv
30
31 # disable autostarting via service or systemd
32 if [ -x /usr/bin/systemctl -o \
33 -x /usr/sbin/systemctl -o \
34 -x /sbin/systemctl ]; then
35 sed -i "s/Restart=always/Restart=no/" \
36 /lib/systemd/system/ipsec.service
37 systemctl disable ipsec.service
38 systemctl daemon-reload
39 else
40 service ipsec disable
41 fi
42
43 echo "$0 finished on $(hostname) at $(date)"