wok-6.x rev 13601

pdns: add post_install
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Nov 10 13:54:41 2012 +0100 (2012-11-10)
parents fe2a41dfcd6d
children 890593feb2f7
files pdnsd/receipt
line diff
     1.1 --- a/pdnsd/receipt	Sat Nov 10 11:39:11 2012 +0100
     1.2 +++ b/pdnsd/receipt	Sat Nov 10 13:54:41 2012 +0100
     1.3 @@ -28,3 +28,25 @@
     1.4  	rm -rf $fs/usr/share
     1.5  	mv $fs/etc/pdnsd.conf.sample $fs/etc/pdnsd.conf
     1.6  }
     1.7 +
     1.8 +# Pre and post install commands for Tazpkg.
     1.9 +pre_remove()
    1.10 +{
    1.11 +	sed -i 's/ pdns / /' $1/etc/rcS.conf
    1.12 +	rm -f $1/etc/init.d/pdns
    1.13 +}
    1.14 +
    1.15 +post_install()
    1.16 +{
    1.17 +	local tmp
    1.18 +	tmp=$(route -n | awk '/^0.0.0.0/ { print $8; }')
    1.19 +	[ -n "$tmp" ] && sed -i "s/eth0/$tmp/" $1/etc/pdns.conf
    1.20 +	tmp=$(sed '/nameserver/!d;s/nameserver //;q' < /etc/resolv.conf)
    1.21 +	[ -n "$tmp" ] && sed -i "s/192\.168\.0\.1/$tmp/" $1/etc/pdns.conf
    1.22 +	tmp=
    1.23 +	[ -s $1/etc/init.d/daemon ] && ln -s daemon $1/etc/init.d/pdns &&
    1.24 +		tmp=" and add pdns to RUN_DAEMONS in /etc/rcS.conf"
    1.25 +	cat <<EOT
    1.26 +Now you can check /etc/pdns.conf$tmp.
    1.27 +EOT
    1.28 +}