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

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

Fix failing refresh if file is symlink

Running refresh twice results in odd behaviour since the second time the
directory has been converted to a link.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 2.2 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
10cfg_dir=`dirname $0`/../cfg
11abs_cfg_dir=`cd $cfg_dir; pwd -P`
12
13poudriere_pkglist_file=${cfg_dir}/wlpkgbuild-default-node-pkglist
14
15
16packages_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
43packages_config() {
44 # Configure build options
45 poudriere options -j wlpkgbuild -p default -z node ${1:+-c} ${*:- -f ${poudriere_pkglist_file}}
46}
47
48
49packages_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
55 rm -Rf /usr/local/etc/poudriere.d/$POUDRIERE_MAKE_CONF_FILE
56 rm -Rf /usr/local/etc/poudriere.d/$POUDRIERE_OPTIONS
57
58
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
64packages_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
70echo $PACKAGE_LIST | tr " " "\n" > ${poudriere_pkglist_file}
71
72
73if [ "x$1" = "xinitenv" ]; then
74 packages_initenv
75 packages_refresh
76 shift; packages_config
77elif [ "x$1" = "xrefresh" ]; then
78 packages_refresh
79elif [ "x$1" = "xconfig" ]; then
80 shift; packages_config $*
81elif [ "x$1" = "xrebuild" ]; then
82 packages_refresh
83 packages_build
84elif [ "x$1" = "xbuild" ]; then
85 packages_build
86else
87 echo "Usage $0 <initenv|config|rebuild|build>"
88 exit 128
89fi
Note: See TracBrowser for help on using the repository browser.