source: hybrid/branches/releng-11/nanobsd/tools/package-build.sh

Last change on this file was 14209, checked in by rick, 6 years ago

Add status messages, since some steps can take quite some time.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 2.6 KB
Line 
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
11cfg_dir=`dirname $0`/../cfg
12abs_cfg_dir=`cd $cfg_dir; pwd -P`
13
14# Wireless Leiden configuration file
15. $cfg_dir/nanobsd.wleiden
16
17packages_update() {
18 echo "# Update ports..."
19 portshaker -U
20 portshaker -M
21}
22
23
24packages_initenv() {
25 config_dir=`dirname $0`
26
27 echo "# Install required deamons..."
28 pkg install -y poudriere dialog4ports portshaker
29
30 echo "# Setup poudriere build environment..."
31 poudriere jail -c -j wlpkgbuild -v $(uname -r | sed 's/-p[0-9]*$//') -a i386
32
33 echo "# 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 echo "# 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
49packages_config() {
50 # Configure build options
51 poudriere options -j wlpkgbuild -z node -c $*
52}
53
54
55packages_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
71packages_build() {
72 poudriere bulk -j wlpkgbuild -p default -z node $*
73}
74
75
76
77packages_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
87if [ "x$1" = "xinitenv" ]; then
88 packages_initenv
89 packages_refresh
90elif [ "x$1" = "xrefresh" ]; then
91 packages_refresh
92elif [ "x$1" = "xconfig" ]; then
93 packages_refresh
94 shift; packages_config $*
95elif [ "x$1" = "xupdate" ]; then
96 packages_update
97elif [ "x$1" = "xrebuild" ]; then
98 packages_refresh
99 packages_build -c $PACKAGE_LIST
100elif [ "x$1" = "xbuild" ]; then
101 packages_refresh
102 packages_build $PACKAGE_LIST
103elif [ "x$1" = "xdistclean" ]; then
104 packages_distclean
105else
106 echo "Usage $0 <initenv|config|update|rebuild|build|distclean>"
107 exit 128
108fi
Note: See TracBrowser for help on using the repository browser.