#!/bin/sh # # Compile listing of required packages using poudriere and friends # # Rick van der Zwet # . `dirname $0`/common.inc.sh cfg_dir=`dirname $0`/../cfg abs_cfg_dir=`cd $cfg_dir; pwd -P` # Wireless Leiden configuration file . $cfg_dir/nanobsd.wleiden packages_update() { echo "# Update ports..." portshaker -U portshaker -M } packages_initenv() { config_dir=`dirname $0` echo "# Install required deamons..." pkg install -y poudriere dialog4ports portshaker echo "# Setup poudriere build environment..." poudriere jail -c -j wlpkgbuild -v $(uname -r | sed 's/-p[0-9]*$//') -a i386 echo "# Setup portshaker..." cp ${config_dir}/portshaker.conf /usr/local/etc/ cp ${config_dir}/portshaker.d/* /usr/local/etc/portshaker.d packages_update echo "# Setup poudriere ports environment..." poudriere ports -c -f none -p default -m null -M /usr/local/poudriere/ports/default # Distfile cache should be created if it does not exists . /usr/local/etc/poudriere.conf if [ ! -d "$DISTFILES_CACHE" ]; then mkdir -p $DISTFILES_CACHE fi } packages_config() { # Configure build options poudriere options -j wlpkgbuild -z node -c $* } packages_refresh() { # Install new package (symlink) options POUDRIERE_MAKE_CONF_FILE=wlpkgbuild-node-make.conf POUDRIERE_OPTIONS=wlpkgbuild-node-options # Clean old stuff (legacy directories & symlinks) rm -Rf /usr/local/etc/poudriere.d/$POUDRIERE_MAKE_CONF_FILE rm -Rf /usr/local/etc/poudriere.d/$POUDRIERE_OPTIONS # Generate new content echo "$PKG_MAKE_CONF" > /usr/local/etc/poudriere.d/$POUDRIERE_MAKE_CONF_FILE ln -s ${abs_cfg_dir}/$POUDRIERE_OPTIONS /usr/local/etc/poudriere.d/$POUDRIERE_OPTIONS } packages_build() { poudriere bulk -j wlpkgbuild -p default -z node $* } packages_distclean() { pkg delete -y poudriere portshaker # Remove immuable flags of jail installed (temponary files) chflags -R 0 /usr/local/poudriere rm -R /usr/local/etc/poudriere.conf /usr/local/etc/poudriere.d /usr/local/poudriere rm -R /usr/local/etc/portshaker.conf /usr/local/etc/portshaker.d /var/cache/portshaker } if [ "x$1" = "xinitenv" ]; then packages_initenv packages_refresh elif [ "x$1" = "xrefresh" ]; then packages_refresh elif [ "x$1" = "xconfig" ]; then packages_refresh shift; packages_config $* elif [ "x$1" = "xupdate" ]; then packages_update elif [ "x$1" = "xrebuild" ]; then packages_refresh packages_build -c $PACKAGE_LIST elif [ "x$1" = "xbuild" ]; then packages_refresh packages_build $PACKAGE_LIST elif [ "x$1" = "xdistclean" ]; then packages_distclean else echo "Usage $0 " exit 128 fi