#!/bin/sh set -e #!/bin/sh set -e # COMMON VARIABLES PACKAGE_NAME="n4d-dnsmasq" ORIGINAL_FILE="/lib/systemd/system/dnsmasq.service" DIVERT_FILE="$ORIGINAL_FILE.divert" LLIUREX_FILE="/usr/share/n4d-dnsmasq/dnsmasq.service" case $1 in configure) if [ ! -r ${DIVERT_FILE} ] ; then dpkg-divert --package ${PACKAGE_NAME} --rename --quiet --add --divert ${DIVERT_FILE} ${ORIGINAL_FILE} ln -fs ${LLIUREX_FILE} ${ORIGINAL_FILE} systemctl daemon-reload fi n4d-modules enable-plugin /etc/n4d/conf.d/DnsmasqManager || true # Get the SRV_IP FILE_TO_WATCH="/etc/dnsmasq.conf" eval $(n4d-vars getvalues SRV_IP) if grep -Fq "address=/preseed/mirror/$SRV_IP" $FILE_TO_WATCH then sed -i "s/address=\/preseed\/mirror\/$SRV_IP/address=\/preseed\/mirror\/proxy\/server\/$SRV_IP/g" $FILE_TO_WATCH fi if grep -Fq "address=/preseed/mirror/proxy/$SRV_IP" $FILE_TO_WATCH then sed -i "s/address=\/preseed\/mirror\/proxy\/$SRV_IP/address=\/preseed\/mirror\/proxy\/server\/$SRV_IP/g" $FILE_TO_WATCH fi if dpkg --compare-versions "$2" lt 1.61; then echo "Newer MacroLAN DNSs are available. Executing DNS Changeer..." lliurex-dns-fixer || true fi ;; *) echo "[DEBUG] Unknow action ..." ;; esac #DEBHELPER# exit 0