#!/usr/local/bin/cbsd
CBSDMODULE=
MYARG=""
MYOPTARG="arch basename ccache clean distcc maxjobs nice notify target_arch target_cputype ver"
MYDESC="Run 'cbsd buildworld' and 'cbsd installworld' atomic"
ADDHELP="

${H3_COLOR}Description${N0_COLOR}:

Build/compile basejail from source tree. This is a wrapper script for 
build/installworld: 'cbsd world' = 'cbsd buildworld' + 'cbsd installworld'.

${H3_COLOR}Options${N0_COLOR}:

 ${N2_COLOR}arch=${N0_COLOR}              - <name>, use non-native architectures.
 ${N2_COLOR}basename=${N0_COLOR}          - Prefix for directory name, can be used for jail as alternative base.
 ${N2_COLOR}destdir${N0_COLOR}            - <path> - alternative DESTDIR= path instead of ~cbsd/basejail/.
 ${N2_COLOR}register_basename=${N0_COLOR} - <name> register with alternative/custom basename.
 ${N2_COLOR}target_arch=${N0_COLOR}       - <name>, build non-native target arch.
 ${N2_COLOR}ver=${N0_COLOR}               - set version: '13.0', '13.1';
                      when version without minor version: e.g:
                     '13' or '12' - you will receive RELENG (stable=1), not release.

${H3_COLOR}Examples${N0_COLOR}:

 # cbsd world
 # cbsd world destdir=/tmp/testbase
 # cbsd world ver=13.0 arch=arm64 target_arch=aarch64
 # cbsd world ver=13.0 arch=riscv target_arch=riscv64

${H3_COLOR}See also${N0_COLOR}:

  cbsd buildworld --help
  cbsd installworld --help
  cbsd srcup --help
  cbsd bases --help
  cbsd sources --help
  cbsd mkdistribution --help
  cbsd baseupdate --help

"

ARGS="${*}"
. ${subrdir}/nc.subr
. ${cbsdinit}

buildworld ${ARGS} && installworld ${ARGS}

exit $?
