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