#!/bin/bash

prefix=@prefix@
sysconfdir=@sysconfdir@

mkdir -m 0775 -p $sysconfdir/config $prefix/config
chgrp vyattacfg $sysconfdir/config $prefix/config 2>/dev/null

update-rc.d vyatta-ofr defaults 90 >/dev/null
# do we want to start vyatta-ofr here in postinst?

if [ "$sysconfdir" != "/etc" ]; then
  # remove the config files and replace with blank ones
  for conf in dhcp3/dhclient.conf 
  do
    [ -f /etc/$conf ] && mv -f /etc/$conf /etc/$conf.vyatta-save
    touch /etc/$conf
  done
fi

mv /opt/vyatta/share/vyatta-cfg/templates/priority /opt/vyatta/share/vyatta-cfg/.
# add group for configuration, if not already present:
grep '^vyattacfg:' /etc/group >&/dev/null ||
addgroup --system vyattacfg