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