Changeset 658


Ignore:
Timestamp:
Feb 18, 2016, 12:16:47 PM (3 years ago)
Author:
hectorgh
Message:

adding dnsmasq

Location:
n4d-dnsmasq/trunk/fuentes/debian
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • n4d-dnsmasq/trunk/fuentes/debian/n4d-dnsmasq.postinst

    r196 r658  
    11#!/bin/sh
    22set -e
    3 # N4D module must be enabled to make more easier
    4 # the installation process
    5 n4d-modules enable-plugin /etc/n4d/conf.d/DnsmasqManager
    63
    7 # Get the SRV_IP
    8 FILE_TO_WATCH="/etc/dnsmasq.conf"
    9 eval $(n4d-vars getvalues SRV_IP)
     4#!/bin/sh
    105
    11 if grep -Fq "address=/preseed/mirror/$SRV_IP" $FILE_TO_WATCH
    12 then
    13       sed -i "s/address=\/preseed\/mirror\/$SRV_IP/address=\/preseed\/mirror\/proxy\/server\/$SRV_IP/g" $FILE_TO_WATCH
    14 fi
     6set -e
    157
    16 if grep -Fq "address=/preseed/mirror/proxy/$SRV_IP" $FILE_TO_WATCH
    17 then
    18       sed -i "s/address=\/preseed\/mirror\/proxy\/$SRV_IP/address=\/preseed\/mirror\/proxy\/server\/$SRV_IP/g" $FILE_TO_WATCH
    19 fi
     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"
    2013
    21 #DEBHELPER
     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
     22                fi
     23
     24                n4d-modules enable-plugin /etc/n4d/conf.d/DnsmasqManager
     25
     26                # Get the SRV_IP
     27                FILE_TO_WATCH="/etc/dnsmasq.conf"
     28                eval $(n4d-vars getvalues SRV_IP)
     29
     30                if grep -Fq "address=/preseed/mirror/$SRV_IP" $FILE_TO_WATCH
     31                then
     32                      sed -i "s/address=\/preseed\/mirror\/$SRV_IP/address=\/preseed\/mirror\/proxy\/server\/$SRV_IP/g" $FILE_TO_WATCH
     33                fi
     34
     35                if grep -Fq "address=/preseed/mirror/proxy/$SRV_IP" $FILE_TO_WATCH
     36                then
     37                      sed -i "s/address=\/preseed\/mirror\/proxy\/$SRV_IP/address=\/preseed\/mirror\/proxy\/server\/$SRV_IP/g" $FILE_TO_WATCH
     38                fi
     39
     40
     41               ;;
     42        *)
     43                echo "[DEBUG] Unknow action ..."
     44                ;;
     45
     46esac
     47
     48#DEBHELPER#
     49
    2250
    2351exit 0
Note: See TracChangeset for help on using the changeset viewer.