| 1 | #!/bin/sh
|
---|
| 2 | #
|
---|
| 3 | # Compile listing of required packages using poudriere and friends
|
---|
| 4 | #
|
---|
| 5 | # Rick van der Zwet <rick@wirelessleiden.nl>
|
---|
| 6 | #
|
---|
| 7 |
|
---|
| 8 | . `dirname $0`/common.inc.sh
|
---|
| 9 |
|
---|
| 10 |
|
---|
| 11 | cfg_dir=`dirname $0`/../cfg
|
---|
| 12 | abs_cfg_dir=`cd $cfg_dir; pwd -P`
|
---|
| 13 |
|
---|
| 14 | # Wireless Leiden configuration file
|
---|
| 15 | . $cfg_dir/nanobsd.wleiden
|
---|
| 16 |
|
---|
| 17 | packages_update() {
|
---|
| 18 | # Update ports
|
---|
| 19 | portshaker -U
|
---|
| 20 | portshaker -M
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | packages_initenv() {
|
---|
| 25 | config_dir=`dirname $0`
|
---|
| 26 |
|
---|
| 27 | # Install required deamons
|
---|
| 28 | pkg install -y poudriere dialog4ports portshaker
|
---|
| 29 |
|
---|
| 30 | # Setup poudriere build environment
|
---|
| 31 | poudriere jail -c -j wlpkgbuild -v $(uname -r | sed 's/-p[0-9]*$//') -a i386
|
---|
| 32 |
|
---|
| 33 | # Setup portshaker
|
---|
| 34 | cp ${config_dir}/portshaker.conf /usr/local/etc/
|
---|
| 35 | cp ${config_dir}/portshaker.d/* /usr/local/etc/portshaker.d
|
---|
| 36 |
|
---|
| 37 | packages_update
|
---|
| 38 |
|
---|
| 39 | # Setup poudriere ports environment
|
---|
| 40 | poudriere ports -c -f none -p default -m null -M /usr/local/poudriere/ports/default
|
---|
| 41 |
|
---|
| 42 | # Distfile cache should be created if it does not exists
|
---|
| 43 | . /usr/local/etc/poudriere.conf
|
---|
| 44 | if [ ! -d "$DISTFILES_CACHE" ]; then
|
---|
| 45 | mkdir -p $DISTFILES_CACHE
|
---|
| 46 | fi
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | packages_config() {
|
---|
| 50 | # Configure build options
|
---|
| 51 | poudriere options -j wlpkgbuild -z node -c $*
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 |
|
---|
| 55 | packages_refresh() {
|
---|
| 56 | # Install new package (symlink) options
|
---|
| 57 | POUDRIERE_MAKE_CONF_FILE=wlpkgbuild-node-make.conf
|
---|
| 58 | POUDRIERE_OPTIONS=wlpkgbuild-node-options
|
---|
| 59 |
|
---|
| 60 |
|
---|
| 61 | # Clean old stuff (legacy directories & symlinks)
|
---|
| 62 | rm -Rf /usr/local/etc/poudriere.d/$POUDRIERE_MAKE_CONF_FILE
|
---|
| 63 | rm -Rf /usr/local/etc/poudriere.d/$POUDRIERE_OPTIONS
|
---|
| 64 |
|
---|
| 65 | # Generate new content
|
---|
| 66 | echo "$PKG_MAKE_CONF" > /usr/local/etc/poudriere.d/$POUDRIERE_MAKE_CONF_FILE
|
---|
| 67 | ln -s ${abs_cfg_dir}/$POUDRIERE_OPTIONS /usr/local/etc/poudriere.d/$POUDRIERE_OPTIONS
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 |
|
---|
| 71 | packages_build() {
|
---|
| 72 | poudriere bulk -j wlpkgbuild -p default -z node $*
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 |
|
---|
| 76 |
|
---|
| 77 | packages_distclean() {
|
---|
| 78 | pkg delete -y poudriere portshaker
|
---|
| 79 | # Remove immuable flags of jail installed (temponary files)
|
---|
| 80 | chflags -R 0 /usr/local/poudriere
|
---|
| 81 | rm -R /usr/local/etc/poudriere.conf /usr/local/etc/poudriere.d /usr/local/poudriere
|
---|
| 82 | rm -R /usr/local/etc/portshaker.conf /usr/local/etc/portshaker.d /var/cache/portshaker
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 |
|
---|
| 86 |
|
---|
| 87 | if [ "x$1" = "xinitenv" ]; then
|
---|
| 88 | packages_initenv
|
---|
| 89 | packages_refresh
|
---|
| 90 | elif [ "x$1" = "xrefresh" ]; then
|
---|
| 91 | packages_refresh
|
---|
| 92 | elif [ "x$1" = "xconfig" ]; then
|
---|
| 93 | packages_refresh
|
---|
| 94 | shift; packages_config $*
|
---|
| 95 | elif [ "x$1" = "xupdate" ]; then
|
---|
| 96 | packages_update
|
---|
| 97 | elif [ "x$1" = "xrebuild" ]; then
|
---|
| 98 | packages_refresh
|
---|
| 99 | packages_build -c $PACKAGE_LIST
|
---|
| 100 | elif [ "x$1" = "xbuild" ]; then
|
---|
| 101 | packages_refresh
|
---|
| 102 | packages_build $PACKAGE_LIST
|
---|
| 103 | elif [ "x$1" = "xdistclean" ]; then
|
---|
| 104 | packages_distclean
|
---|
| 105 | else
|
---|
| 106 | echo "Usage $0 <initenv|config|update|rebuild|build|distclean>"
|
---|
| 107 | exit 128
|
---|
| 108 | fi
|
---|