summaryrefslogtreecommitdiff
path: root/debian/vyatta-cfg-system.postinst.in
blob: b747b78607048f2e54a92d41f9e3cdc98775cae8 (plain)
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/bash

prefix=@prefix@
exec_prefix=@exec_prefix@
sysconfdir=@sysconfdir@
bindir=@bindir@
sbindir=@sbindir@

# remove init of daemons that we start/stop
for init in ntp ssh snmpd keepalived ipvsadm; do
  update-rc.d -f ${init} remove >/dev/null
done

case `grep '^RULES_FILE=' /lib/udev/write_net_rules` in
*z25_persistent-net.rules* )
	vyatta_net_rules=z24_vyatta-net.rules;;
*70-persistent-net.rules* )
	vyatta_net_rules=69-vyatta-net.rules;;
* )
	vyatta_net_rules=21-vyatta-net.rules;;
esac

ln -sf ../vyatta-net.rules /etc/udev/rules.d/$vyatta_net_rules

update-rc.d vyatta-udev start 21 S .

if [ "$sysconfdir" != "/etc" ]; then
    # for "admin" level (FIXME)
    sed -i 's/^# %sudo ALL=NOPASSWD: ALL/%sudo ALL=NOPASSWD: ALL/' /etc/sudoers
    if ! grep -q '^%sudo ALL=NOPASSWD: ALL' /etc/sudoers; then
	echo -e "\n%sudo ALL=NOPASSWD: ALL" >> /etc/sudoers
    fi
  
    # for "users" level
    if ! grep -q "^%users ALL=NOPASSWD: ${bindir}/sudo-users/" /etc/sudoers; then
	echo -e "\n%users ALL=NOPASSWD: ${bindir}/sudo-users/" >> /etc/sudoers
    fi

    # keep env vars
    if ! grep -q 'env_keep+=VYATTA_*' /etc/sudoers ; then
	echo "Defaults env_keep+=VYATTA_*" >> /etc/sudoers
    fi

    # quagga/daemons
    sed -i 's/zebra=no/zebra=yes/' /etc/quagga/daemons
    sed -i 's/bgpd=no/bgpd=yes/'   /etc/quagga/daemons
    sed -i 's/ospfd=no/ospfd=yes/' /etc/quagga/daemons
    sed -i 's/ripd=no/ripd=yes/'   /etc/quagga/daemons

    echo "log syslog warnings" >> /etc/quagga/Quagga.conf

    # add temporary version
    echo "Version :    eureka (beta)" > $sysconfdir/version
fi

# update crontab for logrotate
grep -v logrotate /etc/crontab>/etc/crontab.$$
echo "*/10 * * * * /usr/sbin/logrotate /etc/logrotate.conf" >> /etc/crontab.$$
rm /etc/crontab
mv /etc/crontab.$$ /etc/crontab
crontab /etc/crontab

# create needed directories
mkdir -p /etc/raddb
mkdir -p /var/log/{user,vrrpd}

touch /etc/environment

# Local Variables:
# mode: shell-script
# sh-indentation: 4
# End: