Alternc  latest
Alternc logiel libre pour l'hébergement
alternc.preinst
Go to the documentation of this file.
1 #!/bin/bash
2 
3 set -e
4 
5 . /usr/share/debconf/confmodule
6 
7 # Create AlternC Panel user for web server
8 if ! getent group alterncpanel; then
9  addgroup --system --gid 1999 alterncpanel
10 fi
11 if ! getent passwd alterncpanel; then
12 adduser --system --home "/etc/alternc/.alterncpanel" \
13  --disabled-password --uid 1999 --ingroup alterncpanel alterncpanel
14 fi
15 case "$1" in
16  install)
17  ;;
18 
19  upgrade)
20 
21  if dpkg --compare-versions "$2" lt "0.9.4"; then
22  echo "Upgrading bind configuration"
23  # Move /etc/bind files around
24  mkdir -p /var/alternc/bind
25  if [ ! -e /var/alternc/bind/automatic.conf -a \
26  -f /etc/bind/automatic.conf ]; then
27  if [ ! -e /var/alternc/bind/zones ]; then
28  mkdir -p /var/alternc/bind/zones
29  fi
30  for zone in `sed -n -e 's,.*/etc/bind/master/\‍(.*\‍)".*,\1,p' \
31  /etc/bind/automatic.conf`; do
32  if [ -f /etc/bind/master/$zone ]; then
33  mv /etc/bind/master/$zone /var/alternc/bind/zones
34  fi
35  done
36  cp -a -f /etc/bind/automatic.conf /var/alternc/bind/automatic.conf
37  sed -e 's,/etc/bind/master,/var/alternc/bind/zones,g' \
38  < /etc/bind/automatic.conf > /var/alternc/bind/automatic.conf
39  rm /etc/bind/automatic.conf
40  fi
41  if [ ! -e /var/alternc/bind/slaveip.conf -a \
42  -f /etc/bind/slaveip.conf ]; then
43  mv /etc/bind/slaveip.conf /var/alternc/bind/slaveip.conf
44  fi
45  if [ ! -e /etc/bind/templates ]; then
46  mkdir -p /etc/bind/templates
47  fi
48  if [ ! -e /etc/bind/templates/named.template -a \
49  -f /etc/bind/domaines.template ]; then
50  mv /etc/bind/domaines.template /etc/bind/templates/named.template
51  fi
52  if [ ! -e /etc/bind/templates/zone.template -a \
53  -f /etc/bind/master/domaines.template ]; then
54  mv /etc/bind/master/domaines.template \
55  /etc/bind/templates/zone.template
56  fi
57  if [ -f /etc/bind/master/mx.template ]; then
58  rm /etc/bind/master/mx.template
59  fi
60  if [ -f /etc/bind/master/slave.template ]; then
61  rm /etc/bind/master/slave.template
62  fi
63  rmdir /etc/bind/master 2> /dev/null ||
64  echo "/etc/bind/master was not empty. Please remove it manually."
65  fi
66 
67  ;;
68 
69  abort-upgrade)
70  ;;
71 
72  *)
73  echo "preinst called with unknown argument '$1'" >&2
74  exit 1
75  ;;
76 
77 esac
78 
79 #DEBHELPER#
80 
81 # vim: et sw=4