Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mapi
Created June 6, 2011 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mapi/1009712 to your computer and use it in GitHub Desktop.
Save mapi/1009712 to your computer and use it in GitHub Desktop.
unbound for runit
#!/bin/sh
PATH=/usr/local/bin:/usr/bin:/bin
EXEC="/package/admin/unbound/sbin/unbound"
rootdir="/package/admin/unbound/etc/unbound"
#setup jail
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
:
else
cp -fp /etc/localtime ${rootdir}/etc/localtime
fi;
fi;
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
:
else
cp -fp /etc/resolv.conf ${rootdir}/etc/resolv.conf
fi;
fi;
if ! egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/log' /proc/mounts; then
[ -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
[ -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;
echo
exec 2>&1
exec env - PATH=${PATH} /usr/local/bin/chpst ${EXEC} -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment