source: n4d-dnsmasq/trunk/fuentes/debian/n4d-dnsmasq.postinst

Last change on this file was 716, checked in by hectorgh, 4 years ago

fixing postinst

File size: 1.2 KB
Line 
1#!/bin/sh
2set -e
3
4#!/bin/sh
5
6set -e
7
8# COMMON VARIABLES
9PACKAGE_NAME="n4d-dnsmasq"
10ORIGINAL_FILE="/lib/systemd/system/dnsmasq.service"
11DIVERT_FILE="$ORIGINAL_FILE.divert"
12LLIUREX_FILE="/usr/share/n4d-dnsmasq/dnsmasq.service"
13
14case $1 in
15        configure)
16
17                if [ ! -r ${DIVERT_FILE} ] ; then
18
19                        dpkg-divert --package ${PACKAGE_NAME} --rename --quiet --add --divert  ${DIVERT_FILE}  ${ORIGINAL_FILE}
20                        ln -fs ${LLIUREX_FILE}  ${ORIGINAL_FILE}
21                        systemctl daemon-reload
22
23                fi
24
25                n4d-modules enable-plugin /etc/n4d/conf.d/DnsmasqManager || true
26
27                # Get the SRV_IP
28                FILE_TO_WATCH="/etc/dnsmasq.conf"
29                eval $(n4d-vars getvalues SRV_IP)
30
31                if grep -Fq "address=/preseed/mirror/$SRV_IP" $FILE_TO_WATCH
32                then
33                      sed -i "s/address=\/preseed\/mirror\/$SRV_IP/address=\/preseed\/mirror\/proxy\/server\/$SRV_IP/g" $FILE_TO_WATCH
34                fi
35
36                if grep -Fq "address=/preseed/mirror/proxy/$SRV_IP" $FILE_TO_WATCH
37                then
38                      sed -i "s/address=\/preseed\/mirror\/proxy\/$SRV_IP/address=\/preseed\/mirror\/proxy\/server\/$SRV_IP/g" $FILE_TO_WATCH
39                fi
40
41
42               ;;
43        *)
44                echo "[DEBUG] Unknow action ..."
45                ;;
46
47esac
48
49#DEBHELPER#
50
51
52exit 0
Note: See TracBrowser for help on using the repository browser.