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 | cfg_dir=`dirname $0`/../cfg
|
---|
11 | abs_cfg_dir=`cd $cfg_dir; pwd -P`
|
---|
12 | poudriere_pkglist_file=${cfg_dir}/wlpkgbuild11_0-default-node-pkglist
|
---|
13 |
|
---|
14 |
|
---|
15 | packages_initenv() {
|
---|
16 | config_dir=`dirname $0`
|
---|
17 |
|
---|
18 | # Install required deamons
|
---|
19 | pkg install poudriere dialog4ports portshaker
|
---|
20 |
|
---|
21 | # Setup poudriere build environment
|
---|
22 | poudriere jail -c -j wlpkgbuild11_0 -v 11.0-RELEASE -a i386
|
---|
23 |
|
---|
24 | # Setup portshaker
|
---|
25 | cp ${config_dir}/portshaker.conf /usr/local/etc/
|
---|
26 | cp ${config_dir}/portshaker.d/* /usr/local/etc/portshaker.d
|
---|
27 |
|
---|
28 | # Update ports
|
---|
29 | portshaker -U
|
---|
30 | portshaker -M
|
---|
31 |
|
---|
32 | # Setup poudriere ports environment
|
---|
33 | poudriere ports -c -F -f none -p default -M /usr/local/poudriere/ports/default
|
---|
34 | }
|
---|
35 |
|
---|
36 | packages_config() {
|
---|
37 | # Configure build options
|
---|
38 | poudriere options -j wlpkgbuild11_0 -p default -z node ${1:+-c} ${*:- -f ${poudriere_pkglist_file}}
|
---|
39 | }
|
---|
40 |
|
---|
41 |
|
---|
42 | packages_refresh() {
|
---|
43 | # Install new package (symlink) options
|
---|
44 | POUDRIERE_MAKE_CONF_FILE=wlpkgbuild11_0-node-make.conf
|
---|
45 | POUDRIERE_OPTIONS=wlpkgbuild11_0-node-options
|
---|
46 |
|
---|
47 | # Clean old stuff
|
---|
48 | if [ -d "/usr/local/etc/poudriere.d/$POUDRIERE_MAKE_CONF_FILE" ]; then
|
---|
49 | rm -Rf /usr/local/etc/poudriere.d/$POUDRIERE_MAKE_CONF_FILE
|
---|
50 | fi
|
---|
51 |
|
---|
52 | if [ -d "/usr/local/etc/poudriere.d/$POUDRIERE_OPTIONS" ]; then
|
---|
53 | rm -Rf /usr/local/etc/poudriere.d/$POUDRIERE_OPTIONS
|
---|
54 | fi
|
---|
55 |
|
---|
56 |
|
---|
57 | ln -s ${abs_cfg_dir}/$POUDRIERE_MAKE_CONF_FILE /usr/local/etc/poudriere.d/$POUDRIERE_MAKE_CONF_FILE
|
---|
58 | ln -s ${abs_cfg_dir}/$POUDRIERE_OPTIONS /usr/local/etc/poudriere.d/$POUDRIERE_OPTIONS
|
---|
59 | }
|
---|
60 |
|
---|
61 |
|
---|
62 | packages_build() {
|
---|
63 | poudriere bulk -j wlpkgbuild11_0 -p default -z node -f ${poudriere_pkglist_file}
|
---|
64 | }
|
---|
65 |
|
---|
66 | # Make package list
|
---|
67 | . $cfg_dir/nanobsd.wleiden
|
---|
68 | echo $PACKAGE_LIST | tr " " "\n" > ${poudriere_pkglist_file}
|
---|
69 |
|
---|
70 |
|
---|
71 | if [ "x$1" = "xinitenv" ]; then
|
---|
72 | packages_initenv
|
---|
73 | packages_refresh
|
---|
74 | shift; packages_config
|
---|
75 | elif [ "x$1" = "xrefresh" ]; then
|
---|
76 | packages_refresh
|
---|
77 | elif [ "x$1" = "xconfig" ]; then
|
---|
78 | shift; packages_config $*
|
---|
79 | elif [ "x$1" = "xrebuild" ]; then
|
---|
80 | packages_refresh
|
---|
81 | packages_build
|
---|
82 | elif [ "x$1" = "xbuild" ]; then
|
---|
83 | packages_build
|
---|
84 | else
|
---|
85 | echo "Usage $0 <initenv|config|rebuild|build>"
|
---|
86 | exit 128
|
---|
87 | fi
|
---|