Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar-conf.sh 2630 2018-09-09 19:41:54Z rexy $
|
2 |
# $Id: alcasar-conf.sh 2651 2018-11-04 00:09:02Z tom.houdayer $
|
3 |
|
3 |
|
4 |
# alcasar-conf.sh
|
4 |
# alcasar-conf.sh
|
5 |
# by REXY
|
5 |
# by REXY
|
6 |
# This script is distributed under the Gnu General Public License (GPL)
|
6 |
# This script is distributed under the Gnu General Public License (GPL)
|
7 |
|
7 |
|
Line 124... |
Line 124... |
124 |
MIN_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f2`
|
124 |
MIN_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f2`
|
125 |
UPD_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f3|cut -c1`
|
125 |
UPD_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f3|cut -c1`
|
126 |
## From 3.2.0 & 3.2.1 ##
|
126 |
## From 3.2.0 & 3.2.1 ##
|
127 |
if [ $MAJ_PREVIOUS_VERSION == "3" ] && [ $MIN_PREVIOUS_VERSION == "2" ]
|
127 |
if [ $MAJ_PREVIOUS_VERSION == "3" ] && [ $MIN_PREVIOUS_VERSION == "2" ]
|
128 |
then
|
128 |
then
|
129 |
## rewrite the file managing domain name resolution (local & remote). Hostnames resolutions are now in /etc/hosts
|
- |
|
130 |
cat << EOF > $DIR_UPDATE/etc/alcasar-dns-name
|
- |
|
131 |
# Vous pouvez définir ici votre nom de domain local ('localdomain' par défaut)
|
- |
|
132 |
# Here you can define your local domain name ('localdomain' by default)
|
- |
|
133 |
local=/$DOMAIN/
|
- |
|
134 |
domain=$DOMAIN
|
- |
|
135 |
|
- |
|
136 |
## Ajouter une ligne pour chaque nom de domaine géré par un autre seveur DNS
|
- |
|
137 |
## Add one line for each domain name managed by an other DNS server
|
- |
|
138 |
## server=/<your_domain>/<@IP_domain_server>
|
- |
|
139 |
## Exemple for an A.D. domain : server=/Your.Domain.AD/110.120.100.100
|
- |
|
140 |
## Exemple for an other domain : server=/an_other_domain/10.20.30.40
|
- |
|
141 |
|
- |
|
142 |
## INFO : local hostnames are resolved in /etc/hosts file
|
- |
|
143 |
EOF
|
- |
|
144 |
## rewrite /etc/hosts file managing hostname resolution
|
129 |
## rewrite /etc/hosts file managing hostname resolution
|
145 |
PRIVATE_IP=`grep ^PRIVATE_IP= $CONF_FILE|cut -d"=" -f2|cut -d"/" -f1`
|
130 |
PRIVATE_IP=`grep ^PRIVATE_IP= $CONF_FILE|cut -d"=" -f2|cut -d"/" -f1`
|
146 |
HOSTNAME=`grep ^HOSTNAME= $CONF_FILE|cut -d"=" -f2`
|
131 |
HOSTNAME=`grep ^HOSTNAME= $CONF_FILE|cut -d"=" -f2`
|
147 |
domainNames="$HOSTNAME $HOSTNAME.$DOMAIN"
|
132 |
domainNames="$HOSTNAME $HOSTNAME.$DOMAIN"
|
148 |
[ "$HOSTNAME" != 'alcasar' ] && domainNames="alcasar $domainNames"
|
133 |
[ "$HOSTNAME" != 'alcasar' ] && domainNames="alcasar $domainNames"
|
Line 394... |
Line 379... |
394 |
chown root:apache $DIR_SHARE/dnsmasq-wl/*
|
379 |
chown root:apache $DIR_SHARE/dnsmasq-wl/*
|
395 |
chmod 660 $DIR_SHARE/dnsmasq-wl/*
|
380 |
chmod 660 $DIR_SHARE/dnsmasq-wl/*
|
396 |
$SED "s@^\([#]\?\)dhcp-range=.*@\1dhcp-range=$PRIVATE_SECOND_IP,$PRIVATE_LAST_IP,$PRIVATE_NETMASK,12h@" /etc/dnsmasq.conf
|
381 |
$SED "s@^\([#]\?\)dhcp-range=.*@\1dhcp-range=$PRIVATE_SECOND_IP,$PRIVATE_LAST_IP,$PRIVATE_NETMASK,12h@" /etc/dnsmasq.conf
|
397 |
$SED "s@^\([#]\?\)dhcp-option=option:router.*@\1dhcp-option=option:router,$PRIVATE_IP@" /etc/dnsmasq.conf
|
382 |
$SED "s@^\([#]\?\)dhcp-option=option:router.*@\1dhcp-option=option:router,$PRIVATE_IP@" /etc/dnsmasq.conf
|
398 |
$SED "s@^\([#]\?\)dhcp-option=option:ntp-server.*@\1dhcp-option=option:ntp-server,$PRIVATE_IP@" /etc/dnsmasq.conf
|
383 |
$SED "s@^\([#]\?\)dhcp-option=option:ntp-server.*@\1dhcp-option=option:ntp-server,$PRIVATE_IP@" /etc/dnsmasq.conf
|
- |
|
384 |
networkDomain='localdomain'
|
- |
|
385 |
# networkDomain="$DOMAIN" (/!\ this domain (and its subdomains) will not be resolved by the external DNS servers)
|
399 |
$SED "s?^local=.*?local=/$DOMAIN/?g" $DIR_ETC/alcasar-dns-name
|
386 |
$SED "s?^local=.*?local=/$networkDomain/?g" $DIR_ETC/alcasar-dns-name
|
400 |
$SED "s?^domain=.*?domain=$DOMAIN?g" $DIR_ETC/alcasar-dns-name
|
387 |
$SED "s?^domain=.*?domain=$networkDomain?g" $DIR_ETC/alcasar-dns-name
|
401 |
# tinyproxy
|
388 |
# tinyproxy
|
402 |
$SED "s?^Listen.*?Listen $PRIVATE_IP?g" /etc/tinyproxy/tinyproxy.conf
|
389 |
$SED "s?^Listen.*?Listen $PRIVATE_IP?g" /etc/tinyproxy/tinyproxy.conf
|
403 |
# DG + BL
|
390 |
# DG + BL
|
404 |
$SED "s?^filterip.*?filterip = $PRIVATE_IP?g" /etc/e2guardian/e2guardian.conf
|
391 |
$SED "s?^filterip.*?filterip = $PRIVATE_IP?g" /etc/e2guardian/e2guardian.conf
|
405 |
# Watchdog
|
392 |
# Watchdog
|