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;
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