summaryrefslogtreecommitdiff
path: root/debian/vyatta-cfg-system.postinst.in
blob: 7c561358d2f8ca1030f027139f0c9a550adf5721 (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
#!/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; do
  update-rc.d -f ${init} remove >/dev/null
done

# create symlinks
for bb in telnetd telnet tftp ftpget ftpput; do
  ln -sf /bin/busybox ${sbindir}/${bb}
done
ln -sf ${bindir}/progress-indicator /usr/bin/progress-indicator

if [ "$sysconfdir" != "/etc" ]; then
  # remove the config files
  for conf in hosts motd.tail ntp.conf syslog.conf logrotate.d/messages \
              default/ssh ssh/ssh_host_key
  do
    [ -f /etc/$conf ] && \
      ( mv /etc/$conf /etc/$conf.vyatta-save && touch /etc/$conf );
  done

  # use our config files
  for conf in hosts motd.tail syslog.conf; do
    cp $sysconfdir/$conf /etc/$conf
  done
  cp $sysconfdir/logrotate_messages /etc/logrotate.d/messages
  cp $sysconfdir/default_ssh /etc/default/ssh

  # sudoers
  cp -p /etc/sudoers /etc/sudoers.vyatta-save
  echo -e "\n%quaggavty ALL=NOPASSWD: ALL" >> /etc/sudoers
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}