#!/bin/sh # Install all required packages # XXX: Welcome to port hell, if /usr/ports has been updated, you actually want # to delete all installed packages and start over again, hence why people used # to run this stuff in jails, etc. . $(dirname $0)/package-build.inc.sh DEBUG=${DEBUG:-0} DEP_CHECK_ONLY=${DEP_CHECK_ONLY:-0} # make options, for package building LOGDIR=`mktemp -d "/tmp/$(basename $0 .sh)-$(date +%Y%m%d-%H:%M:%S).X"` TARGET="`cd $(dirname $0);pwd -P`/../pkg/" # Package target MAKE_ARGS="$MAKE_ARGS PACKAGES=$TARGET" MAKE_ARGS="$MAKE_ARGS BATCH=yes PACKAGE_BUILDING=yes" # www/py-cherrypy MAKE_ARGS="${MAKE_ARGS} WITH_APACHE=yes" # net-mgmt/net-snmp MAKE_ARGS="${MAKE_ARGS} WITHOUT_PERL=yes" # net-mgmt/nagios-plugins MAKE_ARGS="${MAKE_ARGS} WITH_FPING=yes" # threads is broken in the version (atleast up to 9.0 - 20120213) # Should be fix in current version in linux, but for some reason # Not yet in BSD. We don't need threads MAKE_ARGS="${MAKE_ARGS} WITHOUT_THREADS=yes" p_info Log directory ${LOGDIR} p_info Make options are: p_info $(p_list ${MAKE_ARGS}) p_info Checking whether there are currently unmet dependencies RETVAL=0 PKGS=`pkg_info | awk '{print $1}'` for PKG in ${PKGS} ; do PKG_DEP_FAIL="" for PKGDEP in `pkg_info -qr ${PKG} | awk '{print $2}'`; do pkg_info -e ${PKGDEP} if [ $? -eq 1 ]; then PKG_DEP_FAIL="${PKG_DEP_FAIL} ${PKGDEP}" fi done if [ -n "${PKG_DEP_FAIL}" ]; then p_err Unmet dependencies found at $PKG, please fix manually: p_err $(p_list ${PKG_DEP_FAIL}) RETVAL=1 fi done if [ $RETVAL -eq 1 ]; then exit 1 fi p_info Dependecy check ok if [ ${DEP_CHECK_ONLY} -eq 1 ]; then exit 0 fi echo "" if [ -d "${TARGET}/All" ]; then p_warn "Deleted all (old) packages at ${TARGET}" rm -R $TARGET/* fi p_info Created target dir ${TARGET}/All mkdir -p ${TARGET}/All PORTSDIR='/usr/ports' WL_PORTSDIR="`cd $(dirname $0);pwd -P`/../ports/" PACKAGE_LIST=`cat <>$LOGFILE 1>> $LOGFILE if [ $? -ne 0 ]; then p_err building ${PACKAGE} FAILED, logging at $LOGFILE exit 1 fi fi ${MAKE} package-links PKGNAME=`make extract-message | awk '{print $NF}'` pkg_create -b $PKGNAME $TARGET/All/${PKGNAME}.tbz p_info Checking dependencies for PKG in $PKGDEP_PKGS; do echo "${BUILD_LIST}" | grep -q "$PKG" if [ $? -eq 0 ]; then # Already packaged p_info ${PKG} Already packaged else echo $@ | grep -q "${PKG}" if [ $? -eq 0 ]; then p_info ${PKG} Already planned else set $@ ${PKG} fi fi done p_info Packaging $PACKAGE succesfull done p_info $(echo ${BUILD_LIST} | wc -w) packages build succesfully if [ ${DEBUG} -eq 0 ]; then rm -R ${LOGDIR} else p_info Debugging enabled ${LOGDIR} saved fi