]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Fixup, no touch files if not needed, copy when not exists.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 25 Apr 2008 15:47:59 +0000 (15:47 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 25 Apr 2008 15:47:59 +0000 (15:47 +0000)
git-svn-id: file:///svn/unbound/trunk@1076 be551aaa-1e26-0410-a405-d3ace91eadb9

contrib/unbound.init
contrib/unbound.spec

index 606299607fc761c28592d57a84a3973bfca6fbb9..747f94e932ddf72d136ee0e03f1e08e0cf42bb2f 100644 (file)
@@ -37,21 +37,25 @@ start() {
     echo -n $"Starting $prog: "
 
     # setup root jail
-    if [ -s /etc/localtime ] && /usr/bin/cmp -s /etc/localtime ${rootdir}/etc/localtime; then
-       mkdir -p ${rootdir}/etc
-       cp -fp /etc/localtime ${rootdir}/etc/localtime
+    if [ -s /etc/localtime ]; then 
+       [ -d ${rootdir}/etc ] || mkdir -p ${rootdir}/etc ;
+       if [ ! -e ${rootdir}/etc/localtime ] || /usr/bin/cmp -s /etc/localtime ${rootdir}/etc/localtime; then
+           cp -fp /etc/localtime ${rootdir}/etc/localtime
+       fi;
     fi;
-    if [ -s /etc/resolv.conf ] && /usr/bin/cmp -s /etc/resolv.conf ${rootdir}/etc/resolv.conf; then
-       mkdir -p ${rootdir}/etc
-       cp -fp /etc/resolv.conf ${rootdir}/etc/resolv.conf
+    if [ -s /etc/resolv.conf ]; then
+       [ -d ${rootdir}/etc ] || mkdir -p ${rootdir}/etc ;
+       if [ ! -e ${rootdir}/etc/resolv.conf ] || /usr/bin/cmp -s /etc/resolv.conf ${rootdir}/etc/resolv.conf; then
+           cp -fp /etc/resolv.conf ${rootdir}/etc/resolv.conf
+       fi;
     fi;
     if ! egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/log' /proc/mounts; then
-       mkdir -p ${rootdir}/dev
+       [ -d ${rootdir}/dev ] || mkdir -p ${rootdir}/dev ;
        [ -e ${rootdir}/dev/log ] || touch ${rootdir}/dev/log
        mount --bind -n /dev/log ${rootdir}/dev/log >/dev/null 2>&1;
     fi;
     if ! egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/random' /proc/mounts; then
-       mkdir -p ${rootdir}/dev
+       [ -d ${rootdir}/dev ] || mkdir -p ${rootdir}/dev ;
        [ -e ${rootdir}/dev/random ] || touch ${rootdir}/dev/random
        mount --bind -n /dev/random ${rootdir}/dev/random >/dev/null 2>&1;
     fi;
index c2fbf62f9f20bd5236318da3c9eb1ee28ffaece8..64c9f7b5c0f30925fcc893ca2e6cd0fc9e67fac6 100644 (file)
@@ -78,15 +78,16 @@ exit 0
 if [ $1 -eq 0 ]; then
        /sbin/service %{name} stop >/dev/null 2>&1
        /sbin/chkconfig --del %{name}
+       # remove root jail 
+       rm -f /var/unbound/dev/log /var/unbound/dev/random /var/unbound/etc/localtime /var/unbound/etc/resolv.conf >/dev/null 2>&1
+       rmdir /var/unbound/dev >/dev/null 2>&1 || :
+       rmdir /var/unbound/etc >/dev/null 2>&1 || :
+       rmdir /var/unbound >/dev/null 2>&1 || :
 fi
 
 %postun
 if [ "$1" -ge "1" ]; then
        /sbin/service %{name} condrestart >/dev/null 2>&1 || :
-else
-       # remove root jail 
-       rm -f /var/unbound/dev/log /var/unbound/dev/random /var/unbound/etc/localtime /var/unbound/etc/resolv.conf >/dev/null 2>&1
-       rmdir /var/unbound >/dev/null 2>&1 || :
 fi
 
 %changelog