- Timestamp:
- Nov 18, 2015, 9:40:00 PM (9 years ago)
- Location:
- branches/releng-10/nanobsd/tools
- Files:
-
- 4 added
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/releng-10/nanobsd/tools/package-build.sh
r13411 r13483 1 1 #!/bin/sh 2 # Install all required packages3 2 # 4 # XXX: Welcome to port hell, if /usr/ports has been updated, you actually want 5 # to delete all installed packages and start over again, hence why people used 6 # to run this stuff in jails, etc. 7 # 8 # TODO: Poudriere is mature and the way to go for these days: 9 # https://www.freebsd.org/doc/handbook/ports-poudriere.html 3 # Compile listing of required packages using poudriere and friends 10 4 # 11 5 # Rick van der Zwet <rick@wirelessleiden.nl> 12 6 # 13 7 14 . `dirname $0`/ package-build.inc.sh8 . `dirname $0`/common.inc.sh 15 9 16 DEBUG=${DEBUG:-'0'} 10 cfg_dir=`dirname $0`/../cfg 11 poudriere_pkglist_file=${cfg_dir}/wlpkgbuild10_2-default-node-pkglist 17 12 18 # Find listing of packages to build19 PKG_TO_BUILD=${PKG_TO_BUILD:-${PACKAGE_LIST}}20 13 21 # make options, for package building 22 LOGDIR=`mktemp -d /tmp/$(basename $0 .sh)-$(date '+%Y%m%d-%H:%M:%S')X`14 packages_initenv() { 15 config_dir=`dirname $0` 23 16 24 p_info Log directory ${LOGDIR} 25 p_info Make arguments are: 26 p_info `p_list ${PKG_MAKE_ARGS}` 27 p_info Make configuration is: 28 echo "${PKG_MAKE_CONF}" | sed 's/^/## /' 17 # Install required deamons 18 pkg install poudriere dialog4ports portshaker 29 19 30 # HACK: install our own ports _inside_ the normal ports dir 31 cp -fR $WL_PORTSDIR/* $PORTSDIR || exit 1 20 # Setup poudriere build environment 21 poudriere jail -c -j wlpkgbuild10_2 -v 10.2-RELEASE -a i386 32 22 33 # Cleanup of old packages 34 if [ -d "${NANO_PACKAGE_DIR}" ]; then 35 p_warn "Deleted all (old) packages at ${NANO_PACKAGE_DIR}" 36 rm -R ${NANO_PACKAGE_DIR}/* 23 # Setup portshaker 24 cp ${config_dir}/portshaker.conf /usr/local/etc/ 25 cp ${config_dir}/portshaker.d/* /usr/local/etc/portshaker.d 26 27 # Update ports 28 portshaker -U 29 portshaker -M 30 31 # Setup poudriere ports environment 32 poudriere ports -c -F -f none -p default -M /usr/local/poudriere/ports/default 33 34 # Build options 35 poudriere options -j wlpkgbuild10_2 -p default -z node -f ${poudriere_pkglist_file} 36 } 37 38 39 package_build() { 40 poudriere bulk -j wlpkgbuild10_2 -p default -z node -f ${poudriere_pkglist_file} 41 } 42 43 # Make package list 44 . $cfg_dir/nanobsd.wleiden 45 echo $PACKAGE_LIST | tr " " "\n" > ${poudriere_pkglist_file} 46 47 48 if [ "x$1" = "xinitenv" ]; then 49 packages_initenv 50 elif [ "x$1" = "xbuild" ]; then 51 package_build 52 else 53 echo "Usage $0 <initenv|build>" 54 exit 128 37 55 fi 38 p_info Created target dir ${NANO_PACKAGE_DIR}39 mkdir -p ${NANO_PACKAGE_DIR}40 41 # Build required packages42 MAKE_CONF=`mktemp -t $(basename $0)`43 echo "${PKG_MAKE_CONF}" > $MAKE_CONF44 MAKE="make __MAKE_CONF=$MAKE_CONF ${PKG_MAKE_ARGS}"45 BUILD_LIST=''46 set `echo ${PKG_TO_BUILD} | xargs -n1 -I% echo $PORTSDIR/%`47 while [ "$1" ]; do48 PACKAGE=$1; shift49 BUILD_LIST="${BUILD_LIST} ${PACKAGE}"50 51 # Build new one52 LOGFILE="$LOGDIR/build_`echo $PACKAGE | tr '/' '_'`.log"53 echo ""54 p_info Packaging $PACKAGE55 cd $PACKAGE || exit 156 57 # Check for build dependencies58 BUILDDEP_PKG=`${MAKE} build-depends-list | awk -F: '{print $2}'`59 if [ -n "${BUILDDEP_PKG}" ]; then60 p_info Build dependencies needed are:61 p_info `p_list ${BUILDDEP_PKG}`62 fi63 64 # Check for run dependencies65 PKGDEP_PKGS=`${MAKE} package-depends-list | awk '{print $2}'`66 if [ -n "${PKGDEP_PKGS}" ]; then67 p_info Package dependencies also packaged are:68 p_info `p_list ${PKGDEP_PKGS}`69 fi70 71 PKGNAME=`${MAKE} extract-message | awk '{print $NF}'`72 PKGBUILDLOG=/tmp/build.$$.`basename $PACKAGE`.log73 p_info Packaging $PACKAGE ... details at $PKGBUILDLOG74 ${MAKE} PACKAGES=/root/nanobsd/pkg clean package do-package 1>>$PKGBUILDLOG 2>>$PKGBUILDLOG75 if [ $? -ne 0 ]; then76 p_err "Failed to create $PKGNAME"77 exit 178 fi79 80 p_info Checking dependencies81 for PKG in $PKGDEP_PKGS; do82 echo "${BUILD_LIST}" | grep -q "$PKG"83 if [ $? -eq 0 ]; then84 # Already packaged85 p_info ${PKG} Already packaged86 else87 echo $@ | grep -q "${PKG}"88 if [ $? -eq 0 ]; then89 p_info ${PKG} Already planned90 else91 set $@ ${PKG}92 fi93 fi94 done95 p_info Packaging $PACKAGE succesfull96 done97 98 p_info `echo ${BUILD_LIST} | wc -w` packages build succesfully99 100 if [ ${DEBUG} -eq 0 ]; then101 rm -R ${LOGDIR}102 else103 p_info Debugging enabled ${LOGDIR} saved104 fi105 106 # House keeping107 rm $MAKE_CONF108 -
branches/releng-10/nanobsd/tools/write-image.sh
r13482 r13483 2 2 # Wrapper allowing to write image to card writer 3 3 4 . $(dirname $0)/ package-build.inc.sh4 . $(dirname $0)/common.inc.sh 5 5 6 6 BASEDIR=`dirname $0`
Note:
See TracChangeset
for help on using the changeset viewer.