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

Last change on this file since 14124 was 14124, checked in by rick, 7 years ago

Add distclean of all package generation utilities

Required for total refresh in case of change in build configuration

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 2.5 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
17
18packages_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 -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 none -p default -m null -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
45packages_config() {
46 # Configure build options
47 poudriere options -j wlpkgbuild -z node -c $*
48}
49
50
51packages_refresh() {
52 # Install new package (symlink) options
53 POUDRIERE_MAKE_CONF_FILE=wlpkgbuild-node-make.conf
54 POUDRIERE_OPTIONS=wlpkgbuild-node-options
55
56
57 # Clean old stuff (legacy directories & symlinks)
58 rm -Rf /usr/local/etc/poudriere.d/$POUDRIERE_MAKE_CONF_FILE
59 rm -Rf /usr/local/etc/poudriere.d/$POUDRIERE_OPTIONS
60
61 # Generate new content
62 echo "$PKG_MAKE_CONF" > /usr/local/etc/poudriere.d/$POUDRIERE_MAKE_CONF_FILE
63 ln -s ${abs_cfg_dir}/$POUDRIERE_OPTIONS /usr/local/etc/poudriere.d/$POUDRIERE_OPTIONS
64}
65
66
67packages_build() {
68 poudriere bulk -j wlpkgbuild -p default -z node $*
69}
70
71
72
73packages_distclean() {
74 pkg delete -y poudriere portshaker
75 # Remove immuable flags of jail installed (temponary files)
76 chflags -R 0 /usr/local/poudriere
77 rm -R /usr/local/etc/poudriere.conf /usr/local/etc/poudriere.d /usr/local/poudriere
78 rm -R /usr/local/etc/portshaker.conf /usr/local/etc/portshaker.d /var/cache/portshaker
79}
80
81
82
83if [ "x$1" = "xinitenv" ]; then
84 packages_initenv
85 packages_refresh
86elif [ "x$1" = "xrefresh" ]; then
87 packages_refresh
88elif [ "x$1" = "xconfig" ]; then
89 packages_refresh
90 packages_config $*
91elif [ "x$1" = "xrebuild" ]; then
92 packages_refresh
93 packages_build $PACKAGE_LIST
94elif [ "x$1" = "xbuild" ]; then
95 packages_refresh
96 packages_build $PACKAGE_LIST
97elif [ "x$1" = "xdistclean" ]; then
98 packages_distclean
99else
100 echo "Usage $0 <initenv|config|rebuild|build|distclean>"
101 exit 128
102fi
Note: See TracBrowser for help on using the repository browser.