=================================================================== RCS file: /cvs/openbsd/fill_chroot/fill_chroot,v retrieving revision 1.5 retrieving revision 1.21 diff -u -r1.5 -r1.21 --- openbsd/fill_chroot/fill_chroot 2006/07/18 03:47:35 1.5 +++ openbsd/fill_chroot/fill_chroot 2019/11/04 01:13:18 1.21 @@ -1,21 +1,113 @@ #!/bin/sh -# $RedRiver: fill_chroot,v 1.4 2006/01/26 17:11:09 andrew Exp $ +# $AFresh1: fill_chroot,v 1.20 2012/06/10 03:29:42 andrew Exp $ CHROOT=${CHROOT:=/home/andrew/www} +CHROOT=`echo $CHROOT | sed -e 's,/*$,,'` export CHROOT +BINDIR=$( dirname $( readlink -f $0 ) ) -perl_to_chroot -mkdir -p ${CHROOT}/usr/local/lib +_find="-type f -a (" +_find="${_find} -name *.so.* -o -name *.so" +_find="${_find} -o -path */usr/bin/* -o -path */usr/sbin/*" +_find="${_find} -o -path */usr/local/bin/* -o -path */usr/local/sbin/*" -cd $CHROOT -if [ -e bin/mini_sendmail ]; then - ln -sf bin/mini_sendmail usr/sbin/sendmail +echo Installing Directory Structure +install -d -m 1750 -o www -g bin ${CHROOT}/tmp +for _d in ${CHROOT}/{bin,sbin,usr,var,dev}/ \ + ${CHROOT}/var/run/ \ + ${CHROOT}/usr/{lib,bin,sbin,libexec,local}/ \ + ${CHROOT}/usr/local/{lib,bin,sbin,share}/\ +; do + install -d -m 0555 -o root -g wheel $_d +done + +echo Making devices +cd ${CHROOT}/dev +/dev/MAKEDEV std +cd ${OLDPWD} + +echo Installing perl into ${CHROOT} +for _f in /usr/bin/perl \ + /usr/libdata/perl5 \ + /usr/local/libdata/perl5 \ + ; do + + echo pax -r -w -L -p e $_f ${CHROOT} + pax -r -w -L -p e $_f ${CHROOT} + +done + +if [ -e /usr/local/sbin/femail ]; then + echo Installing femail into ${CHROOT} + echo pax -r -w -L -p e /usr/local/sbin/femail ${CHROOT} + pax -r -w -L -p e /usr/local/sbin/femail ${CHROOT} else - echo mini_sendmail not installed! Please install it and link it to + echo femail not installed! Please install it and link it to echo " ${CHROOT}/usr/sbin/sendmail" fi -find ${CHROOT} -name *.so.* -or -name *.so | xargs find_depends | \ - sort -u | xargs -I {} pax -r -w -L -p e {} ${CHROOT} +if [ -e ${CHROOT}/usr/local/sbin/femail ]; then + echo Installing sendmail symlink to femail + cd ${CHROOT}/usr/sbin/ + ln -sf ../local/sbin/femail sendmail + cd ${OLDPWD} +fi -fix_ldconfig +if [ -e /usr/local/bin/aspell ]; then + echo Installing aspell into ${CHROOT} + for _f in \ + /usr/local/bin/aspell \ + /usr/local/lib/aspell \ + /usr/local/share/aspell \ + ; do + echo pax -r -w -L -p e $_f ${CHROOT} + pax -r -w -L -p e $_f ${CHROOT} + done + + _find="${_find} -o -name aspell" +fi + +if [ -e /usr/local/bin/speedy ]; then + echo Installing speedycgi into ${CHROOT} + for _f in \ + /usr/local/bin/speedy \ + /usr/local/bin/speedy_backend \ + ; do + echo pax -r -w -L -p e $_f ${CHROOT} + pax -r -w -L -p e $_f ${CHROOT} + done + + _find="${_find} -o -name speedy*" +fi + +if [ -e ${CHROOT}/cgi-bin/cvsweb ]; then + echo Installing cvsweb depends + for _f in \ + /usr/bin/{co,cvs,diff,perl,rcsdiff,rlog,uname} \ + ; do + echo pax -r -w -L -p e $_f ${CHROOT} + pax -r -w -L -p e $_f ${CHROOT} + done + +elif [ -e ${CHROOT}/usr/bin/cvs ]; then + _f=/usr/bin/cvs + echo Installing cvs + echo pax -r -w -L -p e $_f ${CHROOT} + pax -r -w -L -p e $_f ${CHROOT} +fi + +_find="${_find} )" +echo Installing dependencies into ${CHROOT} +find ${CHROOT}/usr ${_find} -print0 | + xargs -0 "${BINDIR}"/find_depends | \ + sort -u | \ +{ + local _f + while read _f; do + echo pax -r -w -L -p e ${_f##${CHROOT}} ${CHROOT} + pax -r -w -L -p e ${_f##${CHROOT}} ${CHROOT} + done +} + +echo Fixing ldconfig \(/var/run/ld.so.hints\) +"${BINDIR}"/fix_ldconfig