Initial drop-in of FreeNAS 10 build system.

This commit is contained in:
Jakub Klama
2015-04-22 11:57:31 +02:00
commit acea4ee59b
73 changed files with 5159 additions and 0 deletions

70
.gitignore vendored Normal file
View File

@@ -0,0 +1,70 @@
### SublimeText ###
*.sublime-workspace
### PyCharm ###
.idea
### OSX ###
.DS_Store
.AppleDouble
.LSOverride
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
### PROJECT SETTINGS ###
*.pyc
*.swp
*.mo
*.o
/gui/local_settings.py
/FreeBSD/
/filtered-patches/
/os-base/
/pbi/
/sbin/
# Exlude compiled Sphinx docs
/docs/*/_build/
# Any and all logs
*.log
# Exclude Grunt and Bower build data
node_modules
bower_components
# Exclude compiled webapp
src/gui/app/build/
src/gui/app/public/
src/gui/app/ssrjs/
src/gui/app-deploy/
# Exclude config files
freenas9-conf.json
freenas10-conf.json
src/gui/freenas9-conf - Copy.json
src/gui/freenas9-conf - MiniHome.json
src/gui/freenas10-conf - mini.json

75
Makefile Normal file
View File

@@ -0,0 +1,75 @@
#-
# Copyright 2010-2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
BUILD_TIMESTAMP != date '+%Y%m%d'
BUILD_STARTED != date '+%s'
BUILD_ROOT ?= ${.CURDIR}
BUILD_CONFIG := ${BUILD_ROOT}/build/config
BUILD_TOOLS := ${BUILD_ROOT}/build/tools
PYTHONPATH := ${BUILD_ROOT}/build/lib
OBJDIR ?= ${BUILD_ROOT}/objs/amd64
MK := ${MAKE} -f ${BUILD_ROOT}/Makefile.inc1
GIT_REPO_SETTING=${BUILD_ROOT}/.git-repo-setting
.if exists(${GIT_REPO_SETTING})
GIT_LOCATION!=cat ${GIT_REPO_SETTING}
.endif
.export MK
.export GIT_LOCATION
.export BUILD_TIMESTAMP
.export BUILD_ROOT
.export BUILD_CONFIG
.export BUILD_TOOLS
.export PYTHONPATH
.export OBJDIR
.export BUILD_STARTED
.export GIT_REPO_SETTING
git-verify:
@if [ ! -f ${GIT_REPO_SETTING} ]; then \
echo "No git repo choice is set. Please use \"make git-external\" to build as an"; \
echo "external developer or \"make git-internal\" to build as an ${COMPANY}"; \
echo "internal developer. You only need to do this once."; \
exit 1; \
fi
@echo "NOTICE: You are building from the ${GIT_LOCATION} git repo."
.BEGIN:
.if !make(remote) && !make(sync)
@${BUILD_TOOLS}/buildenv.py ${BUILD_TOOLS}/check-host.py
.if !make(checkout) && !make(update) && !make(clean) && !make(distclean) && !make(git-internal) && !make(git-external)
@${BUILD_TOOLS}/buildenv.py ${BUILD_TOOLS}/check-sandbox.py
.endif
.endif
buildenv:
@${BUILD_TOOLS}/buildenv.py sh
.DEFAULT: git-verify
@mkdir -p ${OBJDIR}
@${BUILD_TOOLS}/buildenv.py ${MK} ${.TARGETS}

181
Makefile.inc1 Normal file
View File

@@ -0,0 +1,181 @@
#-
# Copyright 2010-2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
.if exists(build/hooks/Makefile)
.include "build/hooks/Makefile"
.endif
.ifdef SCRIPT
RELEASE_LOGFILE?=${SCRIPT}
.else
RELEASE_LOGFILE?=release.build.log
.endif
.if defined(CHANGELOG)
.export CHANGELOG
.endif
all: check-root build
.PHONY: world build packages checkout update dumpenv clean
check-root:
@[ `id -u` -eq 0 ] || ( echo "Sorry, you must be running as root to build this."; exit 1 )
build: portsjail ports world packages images
world:
@${BUILD_TOOLS}/install-world.py
@${BUILD_TOOLS}/install-ports.py
@${BUILD_TOOLS}/customize.py
packages:
@${BUILD_TOOLS}/build-packages.py
checkout:
@${BUILD_TOOLS}/checkout.py
update:
@git pull
@${BUILD_TOOLS}/checkout.py
buildenv:
@sh
dumpenv:
@${BUILD_TOOLS}/dumpenv.py
clean:
chflags -R 0 ${BUILD_ROOT}/objs
rm -rf ${BUILD_ROOT}/objs
rm -rf release.build.log
clean-packages:
find ${MAKEOBJDIRPREFIX}/ports -type f -delete
clean-package:
.if defined(p)
find ${MAKEOBJDIRPREFIX}/ports -name "${p}*" | xargs rm -fr
.else
@echo "Clean a single package from object tree"
@echo ""
@echo "Usage: ${MAKE} ${.TARGET} p=[package name]"
@echo ""
@echo "Examples:"
@echo " ${MAKE} ${.TARGET} p=freenas-ui"
@echo " ${MAKE} ${.TARGET} p=netatalk"
.endif
clean-ui-package:
${MK} clean-package p=freenas-10gui
rm -rf objs/os-base/*/gui-dest
distclean: clean
rm -fr FreeBSD nas_source
save-build-env:
@${BUILD_TOOLS}/save-build-env.py
sync:
rsync -al \
--rsync-path="sudo rsync" \
--delete \
--exclude '.git-repo-setting' \
--exclude 'objs' \
--exclude 'FreeBSD' \
--exclude '.git' \
--exclude '.idea' . ${host}:${dir}/
remote: sync
ssh -o StrictHostKeyChecking=no -t ${host} sudo make -C ${dir} ${target}
reinstall-package:
@${BUILD_TOOLS}/reinstall-package.py ${host} ${p}
freenas: release
release:
@if [ "${NANO_LABEL}" = "TrueNAS" -a "${GIT_LOCATION}" != "INTERNAL" ]; then echo "You can only run this target from an internal repository."; exit 2; fi
@echo "Doing executing target $@ on host: `hostname`"
@echo "Build directory: `pwd`"
script -a ${RELEASE_LOGFILE} ${MK} build
script -a ${RELEASE_LOGFILE} ${BUILD_TOOLS}/create-release-distribution.py
script -a ${RELEASE_LOGFILE} ${BUILD_TOOLS}/create-upgrade-distribution.py
release-push: update-push
@${BUILD_TOOLS}/post-to-storage.py
@if [ "${PRODUCT}" == "FreeNAS" ]; then \
${BUILD_TOOLS}/post-to-download.py; \
fi
update-push:
@${BUILD_TOOLS}/post-to-upgrade.py
rebuild: checkout all
@${BUILD_TOOLS}/create-release-distribution.py
cdrom:
@${BUILD_TOOLS}/create-iso.py
gui-upgrade:
@${BUILD_TOOLS}/create-gui-upgrade.py
images: cdrom gui-upgrade
# intentionally split up to prevent abuse/spam
BUILD_BUG_DOMAIN?=ixsystems.com
BUILD_BUG_USER?=build-bugs
BUILD_BUG_EMAIL?=${BUILD_BUG_USER}@${BUILD_BUG_DOMAIN}
build-bug-report:
mail -s "build fail for $${SUDO_USER:-$$USER}" ${BUILD_BUG_EMAIL} < \
${RELEASE_LOGFILE}
git-internal:
@echo "INTERNAL" > ${GIT_REPO_SETTING}
@echo "You are set up for internal (${COMPANY}) development. You can use"
@echo "the standard make targets (e.g. build or release) now."
git-external:
@echo "EXTERNAL" > ${GIT_REPO_SETTING}
@echo "You are set up for external (github) development. You can use"
@echo "the standard make targets (e.g. build or release) now."
tag:
@${BUILD_TOOLS}/apply-tag.py ${tag}
build-gui:
@${BUILD_TOOLS}/build-gui.py
ports: check-root build-gui
@${BUILD_TOOLS}/create-ports-overlay.py
@${BUILD_TOOLS}/merge-pcbsd-ports.py
@${BUILD_TOOLS}/build-ports.py
@${BUILD_TOOLS}/cleanup-ports-overlay.py
portsjail:
@${BUILD_TOOLS}/build-os.py
@${BUILD_TOOLS}/install-jail.py

61
README.md Normal file
View File

@@ -0,0 +1,61 @@
# Building FreeNAS
To build the system (experts only):
## Requirements:
* Your build environment must be FreeBSD 10.0-RELEASE/FreeBSD 10.1-STABLE (building on
FreeBSD 9 or 11 is not supported at this time).
* an amd64 capable processor. 8GB of memory, or an equal/greater amount
of swap space, is also required
* You will need the following ports/packages when compiling anything
FreeNAS-related:
* ports-mgmt/poudriere-devel
* devel/git
* sysutils/cdrtools
* archivers/pxz
* lang/python (2.7 or later, with THREADS support)
* sysutils/grub2-pcbsd
* sysutils/xorriso
* www/npm
* devel/gmake
* py-sphinx
* py-sphinx_rtd_theme
* py-sphinxcontrib-httpdomain
(and all the dependencies that these ports/pkgs install, of course)
## Building the System Quickstart Flow:
* Checking out the code from git:
```
% cd /path/to/your-build-filesystem
% git clone git://github.com/freenas/freenas.git --branch freenas10/development
% cd freenas
```
* Build it
```
% make git-external
% make checkout
% make release
```
* Update the source tree, to pull in new source code changes
```
% make update
```
This will also fetch TrueOS and ports for the build from github.
## The End Result:
If your build completes successfully, you'll have both 32 and 64 bit
release products in the release_stage directory. You will also have
a tarball in your build directory containing the entire release for
easy transport.

4
ReleaseNotes Normal file
View File

@@ -0,0 +1,4 @@
Release Notes for FreeNAS 10.1-M1
This is a place-holder for the release notes for FreeNAS 10.1 (pre-ALPHA),
development milestone 1.

18
build/README Normal file
View File

@@ -0,0 +1,18 @@
This is an x64 distribution for FreeNAS VERSION
built on BUILD_TIMESTAMP (yyyymmdd format).
If you are seeing this README file, this is a daily build created for
testing purposes. You should, of course, run any daily build at your
own risk, and on non-mission-critical data, since it obviously has not
been deemed fully release-ready and may suffer from any number of issues!
Please feel free to report bugs for this build (http://bugs.freenas.org)
but please be also sure to note the build version and timestamp as above,
since otherwise we will have no idea which build contains the bug being
reported. These bug reports are VERY valuable to us and will be looked
at, since fixing them early is what keeps our builds of consistently
high quality.
Thanks!
The FreeNAS development team

46
build/apply_tag.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/sh
#
#
umask 022
cd "$(dirname "$0")/.."
TOP="$(pwd)"
. build/nano_env
. build/functions.sh
. build/repos.sh
apply_tag()
{
local repo
local repo_checkout_path
if [ -z "$TAG" ]; then
echo "TAG not specified"
echo "Use:"
echo " make tag TAG=<tagname>"
echo ""
exit 1
fi
set -e
# FreeNAS repo is not in REPOS variable yet
repo_checkout_path=${AVATAR_ROOT}
echo "Tagging $repo_checkout_path with $TAG"
git --git-dir="$repo_checkout_path/.git" tag ${TAG_ARGS} ${TAG}
for repo in $REPOS ; do
eval repo_checkout_path="\${GIT_${repo}_CHECKOUT_PATH}"
echo "Tagging $repo_checkout_path with $TAG"
git --git-dir="$repo_checkout_path/.git" tag ${TAG_ARGS} ${TAG}
done
set +e
}
main()
{
apply_tag "$@"
}
main "$@"

33
build/build_bug.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/sh
do_cmd()
{
echo "*********************** BEGIN $* ***********************"
$*
echo "*********************** END $* ***********************"
}
cd "$(dirname $0)/.."
. build/nano_env
. build/functions.sh
log="build_bug.$$.log.bz2"
info "grabbing build environment information; please wait.."
(
for cmd in \
"uname -a" \
"set" \
"cat os-base/*/_.env" \
"git status ." \
"git diff" \
"cd FreeBSD/src && git rev-parse HEAD" \
"cd FreeBSD/src && git remote -v" \
"cd FreeBSD/src && git status" \
"cd FreeBSD/src && git diff HEAD" \
; \
do
do_cmd "$cmd"
done
) | bzip2 -c > $log 2>&1
info "Done! Please create a support ticket [at $AVATAR_SUPPORT_SITE], attach $log (in addition to any other failed build logs as noted by nanobsd, etc), and note that the issue is a build system issue."

102
build/config/config.pyd Normal file
View File

@@ -0,0 +1,102 @@
#+
# Copyright (c) 2010-2015 iXsystems, Inc., All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc. OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# Kernel configuration
kernel_config("kernel/FREENAS.amd64")
if DEBUG:
kernel_config("kernel/DEBUG")
# Kernel modules configuration
kernel_module("cc/cc_chd", "cc/cc_cubic", "cc/cc_hd", "cc/cc_htcp", "cc/cc_vegas")
kernel_module("cxgb", "cxgbe", "cyclic")
kernel_module("dtrace", "ext2fs", "fdescfs", "geom", "ipmi", "khelp/h_ertt", "krpc")
kernel_module("libiconv", "libmchain", "lindev", "linprocfs", "linsysfs", "linux")
kernel_module("nfs_common", "nfsclient", "nfslock")
kernel_module("ispfw/ispfw")
kernel_module("opensolaris")
kernel_module("pf", "pflog", "smbfs", "tmpfs")
kernel_module("udf", "usb/xhci", "zfs")
kernel_module("iscsi")
if PRODUCT == "TrueNAS":
kernel_module("hwpmc", "ipdivert", "ipfw", "ispfw", "linprocfs", "syscons/blank")
else:
#kernel_module("ctl", "cxgbe/t4_firmware", "cxgbe/t5_firmware")
kernel_module("syscons")
kernel_module("netgraph/ether", "netgraph/socket")
fi
# World configuration
make_conf_build(
WITHOUT_BIND_DNSSEC="yes",
WITHOUT_BIND_ETC="yes",
WITHOUT_BIND_LIBS_LWRES="yes",
WITHOUT_BIND_NAMED="yes",
WITHOUT_BLUETOOTH="yes",
WITHOUT_BSNMP="yes",
WITHOUT_CALENDAR="yes",
WITHOUT_CTM="yes",
WITHOUT_CVS="yes",
WITHOUT_DICT="yes",
WITHOUT_EXAMPLES="yes",
WITHOUT_FORTRAN="yes",
WITHOUT_FREEBSD_UPDATE="yes",
WITHOUT_GAMES="yes",
WITHOUT_GCOV="yes",
WITHOUT_GPIB="yes",
WITHOUT_HTML="yes",
WITHOUT_I4B="yes",
WITHOUT_IPFILTER="yes",
WITHOUT_IPX="yes",
WITHOUT_LIB32="yes",
WITHOUT_LIBKSE="yes",
WITHOUT_LPR="yes",
WITHOUT_MAN="yes",
WITHOUT_NDIS="yes",
WITHOUT_NLS="yes",
WITHOUT_NS_CACHING="yes",
WITHOUT_OBJC="yes",
WITH_OPENSSH_NONE_CIPHER="yes",
WITHOUT_PORTSNAP="yes",
WITHOUT_PPP="yes",
WITHOUT_PROFILE="yes",
WITHOUT_RCMDS="yes",
WITHOUT_SENDMAIL="yes",
WITHOUT_SYSINSTALL="yes",
WITHOUT_WIRELESS="yes",
WITHOUT_WPA_SUPPLICANT_EAPOL="yes",
DEFAULT_VERSIONS="python=2.7",
NOPORTDOCS="yes",
LOCAL_DIRS=""
)
customize_task("remove-bits")
#customize_task("remove-gcc")
customize_task("remove-var-cache-pkg")
customize_task("strip-binaries")
customize_task("write-version")

93
build/config/env.pyd Normal file
View File

@@ -0,0 +1,93 @@
#+
# Copyright (c) 2010-2015 iXsystems, Inc., All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc. OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
PRODUCT = PRODUCT or "FreeNAS"
COMPANY = COMPANY or "iXsystems"
MILESTONE = "M1"
VERSION = e("10.1-${MILESTONE}")
TRUEOS_ROOT = e("${BUILD_ROOT}/FreeBSD/src")
PORTS_ROOT = e("${BUILD_ROOT}/FreeBSD/ports")
PCBSD_ROOT = e("${BUILD_ROOT}/FreeBSD/pcbsd")
SRC_ROOT = e("${BUILD_ROOT}/src")
PORTS_OVERLAY = e("${OBJDIR}/ports-overlay")
POUDRIERE_ROOT = e("${OBJDIR}/poudriere")
JAIL_DESTDIR = e("${OBJDIR}/jail")
WORLD_DESTDIR = e("${OBJDIR}/world")
GUI_STAGEDIR = e("${OBJDIR}/gui-stage")
GUI_DESTDIR = e("${OBJDIR}/gui-dest")
PACKAGES_DESTDIR = e("${OBJDIR}/packages")
INSTUFS_DESTDIR = e("${OBJDIR}/instufs")
ISO_DESTDIR = e("${OBJDIR}/iso")
CDROM_LABEL = PRODUCT
FREEBSD_RELEASE_VERSION = "10.0-STABLE"
TRAIN = TRAIN or e("${PRODUCT}-10-Nightlies")
BUILD_ARCH = "amd64"
BUILD_ARCH_SHORT = "x64"
GIT_REVISION = sh("git rev-parse --verify --short HEAD")
SEQUENCE = sh("git show -s --format=%ct")
STAGEDIR = e("${PRODUCT}-${VERSION}-${BUILD_TIMESTAMP}")
if RELEASE:
NAME = e("${PRODUCT}-${VERSION}-${BUILD_ARCH_SHORT}")
else:
NAME = e("${PRODUCT}-${VERSION}-${GIT_REVISION}-${BUILD_ARCH_SHORT}")
# This is needed for buildkernels
KERNCONF = e("${PRODUCT}.${BUILD_ARCH}")
KERNCONFDIR = OBJDIR
# Various path shortcuts
BUILD_CONFIG = e("${BUILD_ROOT}/build/config")
BUILD_TOOLS = e("${BUILD_ROOT}/build/tools")
DISTFILES_CACHE = e("${OBJDIR}/ports/distfiles")
XZ = XZ or "pxz"
# URLs
PROJECT_SITE = "http://www.freenas.org"
SUPPORT_SITE = "http://bugs.freenas.org"
# Release bits
RELEASE_STAGEDIR = e("${BUILD_ROOT}/objs/${PRODUCT}-${VERSION}-${BUILD_TIMESTAMP}")
UPGRADE_STAGEDIR = e("${BUILD_ROOT}/objs/${SEQUENCE}-Update")
LATEST = e("${OBJDIR}/LATEST")
# release-push settings
UPDATE_USER = "sef"
UPDATE_HOST = "beta-update.freenas.org"
UPDATE_DB = e("sqlite:${PRODUCT}-updates.db")
UPDATE_DEST = e("/tank/www/${PRODUCT}")
IX_INTERNAL_PATH = e("/freenas/Dev/releng/${PRODUCT}/nightlies/")
FREENAS_KEYFILE = FREENAS_KEYFILE or "/dev/null"
if PRODUCT == "FreeNAS":
DOWNLOAD_HOST = "download.freenas.org"
DOWNLOAD_BASEDIR = "/tank/downloads/10/Nightlies"
DOWNLOAD_TARGETDIR = e("${DOWNLOAD_BASEDIR}/${MILESTONE}/${BUILD_TIMESTAMP}")
# Calculate make jobs number, PXZ acceleration and so on
HW_NCPU = sh("sysctl -n hw.ncpu")
HW_PHYSMEM = sh("sysctl -n hw.physmem")
MAKE_JOBS = str(int(HW_NCPU) * 2 + 1)
PXZ_ACCEL = e("-T${HW_NCPU}")

44
build/config/jail.pyd Normal file
View File

@@ -0,0 +1,44 @@
#+
# Copyright (c) 2010-2015 iXsystems, Inc., All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc. OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
link(
source=TRUEOS_ROOT,
dest="/usr/src",
flags="ro",
)
copy(
source=SRC_ROOT,
dest="/usr/freenas_src"
)
copy(
source=GUI_DESTDIR,
dest="/usr/freenas_gui"
)
if PRODUCT == "TrueNAS":
pass

15
build/config/kernel/DEBUG Normal file
View File

@@ -0,0 +1,15 @@
# Debug options to be added to a FREENAS kernel config
options KDB # Enable kernel debugger support.
# For minimum debugger support (stable branch) use:
#options KDB_TRACE # Print a stack trace for a panic.
# For full debugger support use this instead:
options DDB # Support DDB.
options GDB # Support remote GDB.
options DEADLKRES # Enable the deadlock resolver
options INVARIANTS # Enable calls of extra sanity checking
options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS
options WITNESS # Enable checks to detect deadlocks and cycles
options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed
options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
options DEBUG_VFS_LOCKS # enable VFS lock debugging

View File

@@ -0,0 +1,369 @@
#
# FREENAS64 -- FreeBSD/amd64 config file tune for FreeNAS
#
# For more information on this file, please read the config(5) manual page,
# and/or the handbook section on Kernel Configuration Files:
#
# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
#
# The handbook is also available locally in /usr/share/doc/handbook
# if you've installed the doc distribution, otherwise always see the
# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the
# latest information.
#
# An exhaustive list of options and more detailed explanations of the
# device lines is also present in the ../../conf/NOTES and NOTES files.
# If you are in doubt as to the purpose or necessity of a line, check first
# in NOTES.
#
# $FreeBSD: stable/8/sys/amd64/conf/GENERIC 202536 2010-01-18 00:53:21Z imp $
cpu HAMMER
ident FREENAS64
# To statically compile in device wiring instead of /boot/device.hints
#hints "GENERIC.hints" # Default places to look for devices.
# Use the following to compile in values accessible to the kernel
# through getenv() (or kenv(1) in userland). The format of the file
# is 'variable=value', see kenv(1)
#
# env "GENERIC.env"
makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols
makeoptions WITH_CTF=1
options SCHED_ULE # ULE scheduler
options PREEMPTION # Enable kernel thread preemption
options INET # InterNETworking
options INET6 # IPv6 communications protocols
#options SCTP # Stream Control Transmission Protocol
options TCP_OFFLOAD # TCP offload
options FFS # Berkeley Fast Filesystem
options SOFTUPDATES # Enable FFS soft updates support
options UFS_ACL # Support for access control lists
options UFS_DIRHASH # Improve performance on big directories
options UFS_GJOURNAL # Enable gjournal-based UFS journaling
options MD_ROOT # MD is a potential root device
options NFSCL # New Network Filesystem Client
options NFSD # New Network Filesystem Server
options NFSLOCKD # Network Lock Manager
options NFS_ROOT # NFS usable as /, requires NFSCL
options MSDOSFS # MSDOS Filesystem
options CD9660 # ISO 9660 Filesystem
options PROCFS # Process filesystem (requires PSEUDOFS)
options PSEUDOFS # Pseudo-filesystem framework
options GEOM_PART_GPT # GUID Partition Tables.
options GEOM_RAID # Soft RAID functionality
options GEOM_LABEL # Provides labelization
options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty)
options COMPAT_FREEBSD32 # Compatible with i386 binaries
options COMPAT_FREEBSD4 # Compatible with FreeBSD4
options COMPAT_FREEBSD5 # Compatible with FreeBSD5
options COMPAT_FREEBSD6 # Compatible with FreeBSD6
options COMPAT_FREEBSD7 # Compatible with FreeBSD7
options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI
options KTRACE # ktrace(1) support
options STACK # stack(9) support
options SYSVSHM # SYSV-style shared memory
options SYSVMSG # SYSV-style message queues
options SYSVSEM # SYSV-style semaphores
options P1003_1B_SEMAPHORES # POSIX-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed.
options KBD_INSTALL_CDEV # install a CDEV entry in /dev
options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4)
options AUDIT # Security event auditing
options MAC # TrustedBSD MAC Framework
#options FLOWTABLE # per-cpu routing cache
options KDTRACE_FRAME # Ensure frames are compiled in (AMD64 only!)
options KDTRACE_HOOKS # Kernel DTrace hooks
options INCLUDE_CONFIG_FILE # Include this file in kernel
options KDB # Kernel debugger related code
options KDB_TRACE # Print a stack trace for a panic
options DDB_CTF # Kernel ELF linker loads CTF data
options DDB # Support DDB.
options KGSSAPI
# Make an SMP-capable kernel by default
options SMP # Symmetric MultiProcessor Kernel
device zfs
# CPU frequency control
device amdtemp
device coretemp
device cpufreq
#
# CPU control pseudo-device. Provides access to MSRs, CPUID info and
# microcode update feature.
#
device cpuctl
# Bus support.
device acpi
device pci
# Floppy drives
device fdc
# ATA controllers
device ahci # AHCI-compatible SATA controllers
device ada # SATA drives
device ata # Legacy ATA/SATA controllers
#options ATA_CAM # Handle legacy controllers with CAM
options ATA_STATIC_ID # Static device numbering
device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA
device siis # SiliconImage SiI3124/SiI3132/SiI3531 SATA
# FC target support
options ISP_TARGET_MODE
# SCSI Controllers
device ahc # AHA2940 and onboard AIC7xxx devices
options AHC_REG_PRETTY_PRINT # Print register bitfields in debug
# output. Adds ~128k to driver.
device ahd # AHA39320/29320 and onboard AIC79xx devices
options AHD_REG_PRETTY_PRINT # Print register bitfields in debug
# output. Adds ~215k to driver.
#device amd # AMD 53C974 (Tekram DC-390(T))
device hptiop # Highpoint RocketRaid 3xxx series
device isci # Intel C600 SAS controllers
device isp # Qlogic family
#device ispfw # Firmware for QLogic HBAs- normally a module
device mpt # LSI-Logic MPT-Fusion
device mps # LSI-Logic MPT-Fusion 2
device mpr # LSI-Logic MPT-Fusion 3
#device ncr # NCR/Symbios Logic
device sym # NCR/Symbios Logic (newer chipsets + those of `ncr')
#device trm # Tekram DC395U/UW/F DC315U adapters
#device adv # Advansys SCSI adapters
#device adw # Advansys wide SCSI adapters
#adevice aic # Adaptec 15[012]x SCSI adapters, AIC-6[23]60.
#device bt # Buslogic/Mylex MultiMaster SCSI adapters
# SCSI peripherals
device scbus # SCSI bus (required for SCSI)
device ch # SCSI media changers
device da # Direct Access (disks)
device sa # Sequential Access (tape etc)
device cd # CD
device pass # Passthrough device (direct SCSI access)
device ses # SCSI Environmental Services (and SAF-TE)
device ctl # CAM Target Layer
# RAID controllers interfaced to the SCSI subsystem
device amr # AMI MegaRAID
device arcmsr # Areca SATA II RAID
#XXX it is not 64-bit clean, -scottl
#device asr # DPT SmartRAID V, VI and Adaptec SCSI RAID
device ciss # Compaq Smart RAID 5*
device dpt # DPT Smartcache III, IV - See NOTES for options
device hptmv # Highpoint RocketRAID 182x
device hptnr # Highpoint DC7280, R750
device hptrr # Highpoint RocketRAID 17xx, 22xx, 23xx, 25xx
device hpt27xx # HighPoint RocketRAID 27xx SAS 6Gb/s HBA card driver
device iir # Intel Integrated RAID
device ips # IBM (Adaptec) ServeRAID
device mly # Mylex AcceleRAID/eXtremeRAID
device twa # 3ware 9000 series PATA/SATA RAID
device tws # LSI 3ware 9750 SATA+SAS 6Gb/s RAID controller
# RAID controllers
device aac # Adaptec FSA RAID
device aacp # SCSI passthrough for aac (requires CAM)
device aacraid
#device ida # Compaq Smart RAID
device mfi # LSI MegaRAID SAS
device mlx # Mylex DAC960 family
#XXX pointer/int warnings
#device pst # Promise Supertrak SX6000
device twe # 3ware ATA RAID
# atkbdc0 controls both the keyboard and the PS/2 mouse
device atkbdc # AT keyboard controller
device atkbd # AT keyboard
device psm # PS/2 mouse
device kbdmux # keyboard multiplexer
device vga # VGA video card driver
device splash # Splash screen and screen saver support
# syscons is the default console driver, resembling an SCO console
device sc
device agp # support several AGP chipsets
# Serial (COM) ports
device uart # Generic UART driver
# PCI Ethernet NICs.
device bxe # Broadcom BCM57710/BCM57711/BCM57711E 10Gb Ethernet
device cxgb # Chelsio T3 10 Gigabit Ethernet adapter driver
device de # DEC/Intel DC21x4x (``Tulip'')
device em # Intel PRO/1000 Gigabit Ethernet Family
device igb # Intel PRO/1000 PCIE Server Gigabit Family
device ixgb # Intel PRO/10Gb Ethernet Card
device ixgbe # Intel 10Gb Ethernet Card
device le # AMD Am7900 LANCE and Am79C9xx PCnet
device mxge # Myricom Myri10GE 10 Gigabit Ethernet adapter driver
device ti # Alteon Networks Tigon I/II gigabit Ethernet
device txp # 3Com 3cR990 (``Typhoon'')
device vx # 3Com 3c590, 3c595 (``Vortex'')
device qlxgb # qlogic 10Gb
device oce # Emulex 10Gbe Ethernet
device sfxge # Solarflare SFC9000 family 10Gb Ethernet adapters
# PCI Ethernet NICs that use the common MII bus controller code.
# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs!
device miibus # MII bus support
device ae # Attansic/Atheros L2 FastEthernet
device age # Attansic/Atheros L1 Gigabit Ethernet
device alc # Atheros AR8131/AR8132 Ethernet
device ale # Atheros AR8121/AR8113/AR8114 Ethernet
device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet
device bfe # Broadcom BCM440x 10/100 Ethernet
device bge # Broadcom BCM570xx Gigabit Ethernet
device dc # DEC/Intel 21143 and various workalikes
device et # Agere ET1310 10/100/Gigabit Ethernet
device fxp # Intel EtherExpress PRO/100B (82557, 82558)
device jme # JMicron JMC250 Gigabit/JMC260 Fast Ethernet
device lge # Level 1 LXT1001 gigabit Ethernet
device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet
device nfe # nVidia nForce MCP on-board Ethernet
device nge # NatSemi DP83820 gigabit Ethernet
device nve # nVidia nForce MCP on-board Ethernet Networking
device pcn # AMD Am79C97x PCI 10/100 (precedence over 'le')
device re # RealTek 8139C+/8169/8169S/8110S
device rl # RealTek 8129/8139
device sf # Adaptec AIC-6915 (``Starfire'')
device sge # Silicon Integrated Systems SiS 190/191
device sis # Silicon Integrated Systems SiS 900/SiS 7016
device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet
device ste # Sundance ST201 (D-Link DFE-550TX)
device stge # Sundance/Tamarack TC9021 gigabit Ethernet
device tl # Texas Instruments ThunderLAN
device tx # SMC EtherPower II (83c170 ``EPIC'')
device vge # VIA VT612x gigabit Ethernet
device vr # VIA Rhine, Rhine II
device wb # Winbond W89C840F
device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'')
# Pseudo devices.
device loop # Network loopback
device random # Entropy device
device ether # Ethernet support
device lagg # Link aggregation
device vlan # 802.1Q VLAN support
device tun # Packet tunnel.
device pty # BSD-style compatibility pseudo ttys
device md # Memory "disks"
device gif # IPv6 and IPv4 tunneling
device faith # IPv6-to-IPv4 relaying (translation)
device firmware # firmware assist module
device crypto # core crypto support
device cryptodev # /dev/crypto for access to h/w
# The `bpf' device enables the Berkeley Packet Filter.
# Be aware of the administrative consequences of enabling this!
# Note that 'bpf' is required for DHCP.
device bpf # Berkeley packet filter
# USB support
options USB_DEBUG # enable debug msgs
device uhci # UHCI PCI->USB interface
device ohci # OHCI PCI->USB interface
device ehci # EHCI PCI->USB interface (USB 2.0)
device usb # USB Bus (required)
device uhid # "Human Interface Devices"
device ukbd # Keyboard
device ulpt # Printer
device umass # Disks/Mass storage - Requires scbus and da
device ums # Mouse
# Needed for ipmi(4)
device smbus
## This is FreeNAS specific but leaving it here because I'm unsure
## if putting it after PF will change the order that packets are handled
## by the system, and everything works nicely now
# ipfw and nat for jails
options IPDIVERT
options IPFIREWALL
options IPFIREWALL_VERBOSE
#options IPFIREWALL_FORWARD
options IPFIREWALL_DEFAULT_TO_ACCEPT
options IPFIREWALL_NAT
options DUMMYNET
options LIBALIAS
## End FreeNAS specific section
# FreeNAS shared modifications
options GEOM_UZIP
options GEOM_ELI
options NULLFS
options UNIONFS
options VFS_AIO
device aesni
device carp
## FreeNAS specific modifications
# misc
device padlock
options VIMAGE
options NETGRAPH
device snp
device iscsi
device epair # A pair of virtual back-to-back connected Ethernet interfaces
device if_bridge # network bridge device
# The `tap' device is a pty-like virtual Ethernet interface
device tap
options GEOM_MIRROR
# Watchdog support
device ichwd
device amdsbwd
device viawd
device wbwd
# NVM Express (NVMe) support
device nvme # base NVMe driver
device nvd # expose NVMe namespaces as disks, depends on nvme
# VirtIO
device virtio
device virtio_pci
device virtio_blk
device virtio_balloon
device vtnet
device virtio_scsi
# FireWire support
device firewire # FireWire bus code
device sbp # SCSI over FireWire (Requires scbus and da)
#device fwe # Ethernet over FireWire (non-standard!)
#device fwip # IP over FireWire (RFC 2734,3146)
#device dcons # Dumb console driver
#device dcons_crom # Configuration ROM for dcons
# USB Serial devices
device u3g # USB-based 3G modems (Option, Huawei, Sierra)
device uark # Technologies ARK3116 based serial adapters
device ubsa # Belkin F5U103 and compatible serial adapters
device uftdi # For FTDI usb serial adapters
device uplcom # Prolific PL-2303 serial adapters
device uslcom # SI Labs CP2101/CP2102 serial adapters
# USB Ethernet, requires miibus
device aue # ADMtek USB Ethernet
device axe # ASIX Electronics USB Ethernet
device cdce # Generic USB over Ethernet
device cue # CATC USB Ethernet
device kue # Kawasaki LSI USB Ethernet
device rue # RealTek RTL8150 USB Ethernet
device udav # Davicom DM9601E USB
## End FreeNAS specific section

View File

@@ -0,0 +1,355 @@
#
# FREENAS32 -- FreeBSD/i386 config file tune for FreeNAS
#
# For more information on this file, please read the config(5) manual page,
# and/or the handbook section on Kernel Configuration Files:
#
# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
#
# The handbook is also available locally in /usr/share/doc/handbook
# if you've installed the doc distribution, otherwise always see the
# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the
# latest information.
#
# An exhaustive list of options and more detailed explanations of the
# device lines is also present in the ../../conf/NOTES and NOTES files.
# If you are in doubt as to the purpose or necessity of a line, check first
# in NOTES.
#
# $FreeBSD$
cpu I586_CPU
cpu I686_CPU
ident FREENAS32
# To statically compile in device wiring instead of /boot/device.hints
#hints "GENERIC.hints" # Default places to look for devices.
# Use the following to compile in values accessible to the kernel
# through getenv() (or kenv(1) in userland). The format of the file
# is 'variable=value', see kenv(1)
#
# env "GENERIC.env"
makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols
makeoptions WITH_CTF=1
options SCHED_ULE # ULE scheduler
options PREEMPTION # Enable kernel thread preemption
options INET # InterNETworking
options INET6 # IPv6 communications protocols
#options SCTP # Stream Control Transmission Protocol
options FFS # Berkeley Fast Filesystem
options SOFTUPDATES # Enable FFS soft updates support
options UFS_ACL # Support for access control lists
options UFS_DIRHASH # Improve performance on big directories
options UFS_GJOURNAL # Enable gjournal-based UFS journaling
options MD_ROOT # MD is a potential root device
options NFSCL # New Network Filesystem Client
options NFSD # New Network Filesystem Server
options NFSLOCKD # Network Lock Manager
options NFS_ROOT # NFS usable as /, requires NFSCL
options MSDOSFS # MSDOS Filesystem
options CD9660 # ISO 9660 Filesystem
options PROCFS # Process filesystem (requires PSEUDOFS)
options PSEUDOFS # Pseudo-filesystem framework
options GEOM_PART_GPT # GUID Partition Tables.
options GEOM_RAID # Soft RAID functionality
options GEOM_LABEL # Provides labelization
options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty)
options COMPAT_FREEBSD4 # Compatible with FreeBSD4
options COMPAT_FREEBSD5 # Compatible with FreeBSD5
options COMPAT_FREEBSD6 # Compatible with FreeBSD6
options COMPAT_FREEBSD7 # Compatible with FreeBSD7
options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI
options KTRACE # ktrace(1) support
options STACK # stack(9) support
options SYSVSHM # SYSV-style shared memory
options SYSVMSG # SYSV-style message queues
options SYSVSEM # SYSV-style semaphores
options P1003_1B_SEMAPHORES # POSIX-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed.
options KBD_INSTALL_CDEV # install a CDEV entry in /dev
options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4)
options AUDIT # Security event auditing
options MAC # TrustedBSD MAC Framework
#options FLOWTABLE # per-cpu routing cache
options KDTRACE_HOOKS # Kernel DTrace hooks
options INCLUDE_CONFIG_FILE # Include this file in kernel
options KDB # Kernel debugger related code
options KDB_TRACE # Print a stack trace for a panic
options DDB_CTF # Kernel ELF linker loads CTF data
options DDB # Support DDB.
# Make an SMP-capable kernel by default
options SMP # Symmetric MultiProcessor Kernel
device apic
device zfs
# CPU frequency control
device amdtemp
device coretemp
device cpufreq
#
# CPU control pseudo-device. Provides access to MSRs, CPUID info and
# microcode update feature.
#
device cpuctl
# Bus support.
device acpi
device pci
# Floppy drives
device fdc
# ATA controllers
device ahci # AHCI-compatible SATA controllers
device ada # SATA drives
device ata # Legacy ATA/SATA controllers
#options ATA_CAM # Handle legacy controllers with CAM
options ATA_STATIC_ID # Static device numbering
device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA
device siis # SiliconImage SiI3124/SiI3132/SiI3531 SATA
# FC target support
options ISP_TARGET_MODE
# SCSI Controllers
device ahc # AHA2940 and onboard AIC7xxx devices
options AHC_REG_PRETTY_PRINT # Print register bitfields in debug
# output. Adds ~128k to driver.
device ahd # AHA39320/29320 and onboard AIC79xx devices
options AHD_REG_PRETTY_PRINT # Print register bitfields in debug
# output. Adds ~215k to driver.
#device amd # AMD 53C974 (Tekram DC-390(T))
device hptiop # Highpoint RocketRaid 3xxx series
device isci # Intel C600 SAS controllers
device isp # Qlogic family
#device ispfw # Firmware for QLogic HBAs- normally a module
device mpt # LSI-Logic MPT-Fusion
device mps # LSI-Logic MPT-Fusion 2
device mpr # LSI-Logic MPT-Fusion 3
#device ncr # NCR/Symbios Logic
device sym # NCR/Symbios Logic (newer chipsets + those of `ncr')
#device trm # Tekram DC395U/UW/F DC315U adapters
#device adv # Advansys SCSI adapters
#device adw # Advansys wide SCSI adapters
#adevice aic # Adaptec 15[012]x SCSI adapters, AIC-6[23]60.
#device bt # Buslogic/Mylex MultiMaster SCSI adapters
# SCSI peripherals
device scbus # SCSI bus (required for SCSI)
device ch # SCSI media changers
device da # Direct Access (disks)
device sa # Sequential Access (tape etc)
device cd # CD
device pass # Passthrough device (direct SCSI access)
device ses # SCSI Environmental Services (and SAF-TE)
device ctl # CAM Target Layer
# RAID controllers interfaced to the SCSI subsystem
device amr # AMI MegaRAID
device arcmsr # Areca SATA II RAID
device asr # DPT SmartRAID V, VI and Adaptec SCSI RAID
device ciss # Compaq Smart RAID 5*
device dpt # DPT Smartcache III, IV - See NOTES for options
device hptmv # Highpoint RocketRAID 182x
device hptnr # Highpoint DC7280, R750
device hptrr # Highpoint RocketRAID 17xx, 22xx, 23xx, 25xx
device hpt27xx # HighPoint RocketRAID 27xx SAS 6Gb/s HBA card driver
device iir # Intel Integrated RAID
device ips # IBM (Adaptec) ServeRAID
device mly # Mylex AcceleRAID/eXtremeRAID
device twa # 3ware 9000 series PATA/SATA RAID
device tws # LSI 3ware 9750 SATA+SAS 6Gb/s RAID controller
# RAID controllers
device aac # Adaptec FSA RAID
device aacp # SCSI passthrough for aac (requires CAM)
#device ida # Compaq Smart RAID
device mfi # LSI MegaRAID SAS
device mlx # Mylex DAC960 family
#XXX pointer/int warnings
#device pst # Promise Supertrak SX6000
device twe # 3ware ATA RAID
# atkbdc0 controls both the keyboard and the PS/2 mouse
device atkbdc # AT keyboard controller
device atkbd # AT keyboard
device psm # PS/2 mouse
device kbdmux # keyboard multiplexer
device vga # VGA video card driver
device splash # Splash screen and screen saver support
# syscons is the default console driver, resembling an SCO console
device sc
device agp # support several AGP chipsets
# Serial (COM) ports
device uart # Generic UART driver
# PCI Ethernet NICs.
device bxe # Broadcom BCM57710/BCM57711/BCM57711E 10Gb Ethernet
device de # DEC/Intel DC21x4x (``Tulip'')
device em # Intel PRO/1000 Gigabit Ethernet Family
device igb # Intel PRO/1000 PCIE Server Gigabit Family
device ixgb # Intel PRO/10Gb Ethernet Card
device le # AMD Am7900 LANCE and Am79C9xx PCnet
device mxge # Myricom Myri10GE 10 Gigabit Ethernet adapter driver
device ti # Alteon Networks Tigon I/II gigabit Ethernet
device txp # 3Com 3cR990 (``Typhoon'')
device vx # 3Com 3c590, 3c595 (``Vortex'')
# PCI Ethernet NICs that use the common MII bus controller code.
# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs!
device miibus # MII bus support
device ae # Attansic/Atheros L2 FastEthernet
device age # Attansic/Atheros L1 Gigabit Ethernet
device alc # Atheros AR8131/AR8132 Ethernet
device ale # Atheros AR8121/AR8113/AR8114 Ethernet
device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet
device bfe # Broadcom BCM440x 10/100 Ethernet
device bge # Broadcom BCM570xx Gigabit Ethernet
device dc # DEC/Intel 21143 and various workalikes
device et # Agere ET1310 10/100/Gigabit Ethernet
device fxp # Intel EtherExpress PRO/100B (82557, 82558)
device jme # JMicron JMC250 Gigabit/JMC260 Fast Ethernet
device lge # Level 1 LXT1001 gigabit Ethernet
device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet
device nfe # nVidia nForce MCP on-board Ethernet
device nge # NatSemi DP83820 gigabit Ethernet
device nve # nVidia nForce MCP on-board Ethernet Networking
device pcn # AMD Am79C97x PCI 10/100 (precedence over 'le')
device re # RealTek 8139C+/8169/8169S/8110S
device rl # RealTek 8129/8139
device sf # Adaptec AIC-6915 (``Starfire'')
device sge # Silicon Integrated Systems SiS 190/191
device sis # Silicon Integrated Systems SiS 900/SiS 7016
device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet
device ste # Sundance ST201 (D-Link DFE-550TX)
device stge # Sundance/Tamarack TC9021 gigabit Ethernet
device tl # Texas Instruments ThunderLAN
device tx # SMC EtherPower II (83c170 ``EPIC'')
device vge # VIA VT612x gigabit Ethernet
device vr # VIA Rhine, Rhine II
device wb # Winbond W89C840F
device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'')
# Pseudo devices.
device loop # Network loopback
device random # Entropy device
device ether # Ethernet support
device lagg # Link aggregation
device vlan # 802.1Q VLAN support
device tun # Packet tunnel.
device pty # BSD-style compatibility pseudo ttys
device md # Memory "disks"
device gif # IPv6 and IPv4 tunneling
device faith # IPv6-to-IPv4 relaying (translation)
device firmware # firmware assist module
device crypto # core crypto support
device cryptodev # /dev/crypto for access to h/w
# The `bpf' device enables the Berkeley Packet Filter.
# Be aware of the administrative consequences of enabling this!
# Note that 'bpf' is required for DHCP.
device bpf # Berkeley packet filter
# USB support
options USB_DEBUG # enable debug msgs
device uhci # UHCI PCI->USB interface
device ohci # OHCI PCI->USB interface
device ehci # EHCI PCI->USB interface (USB 2.0)
device usb # USB Bus (required)
device uhid # "Human Interface Devices"
device ukbd # Keyboard
device ulpt # Printer
device umass # Disks/Mass storage - Requires scbus and da
device ums # Mouse
# Needed for ipmi(4)
device smbus
## This is FreeNAS specific but leaving it here because I'm unsure
## if putting it after PF will change the order that packets are handled
## by the system, and everything works nicely now
# ipfw and nat for jails
options IPDIVERT
options IPFIREWALL
options IPFIREWALL_VERBOSE
#options IPFIREWALL_FORWARD
options IPFIREWALL_DEFAULT_TO_ACCEPT
options IPFIREWALL_NAT
options DUMMYNET
options LIBALIAS
## End FreeNAS specific section
# FreeNAS shared modifications
options GEOM_UZIP
options GEOM_ELI
options NULLFS
options UNIONFS
options VFS_AIO
device carp
## FreeNAS specific modifications
# misc
device padlock
options VIMAGE
options NETGRAPH
device snp
device iscsi
device epair # A pair of virtual back-to-back connected Ethernet interfaces
device if_bridge # network bridge device
# The `tap' device is a pty-like virtual Ethernet interface
device tap
options GEOM_MIRROR
# Watchdog support
device ichwd
device amdsbwd
device viawd
device wbwd
# VirtIO
device virtio
device virtio_pci
device virtio_blk
device virtio_balloon
device vtnet
device virtio_scsi
# FireWire support
device firewire # FireWire bus code
device sbp # SCSI over FireWire (Requires scbus and da)
#device fwe # Ethernet over FireWire (non-standard!)
#device fwip # IP over FireWire (RFC 2734,3146)
#device dcons # Dumb console driver
#device dcons_crom # Configuration ROM for dcons
# USB Serial devices
device u3g # USB-based 3G modems (Option, Huawei, Sierra)
device uark # Technologies ARK3116 based serial adapters
device ubsa # Belkin F5U103 and compatible serial adapters
device uftdi # For FTDI usb serial adapters
device uplcom # Prolific PL-2303 serial adapters
device uslcom # SI Labs CP2101/CP2102 serial adapters
# USB Ethernet, requires miibus
device aue # ADMtek USB Ethernet
device axe # ASIX Electronics USB Ethernet
device cdce # Generic USB over Ethernet
device cue # CATC USB Ethernet
device kue # Kawasaki LSI USB Ethernet
device rue # RealTek RTL8150 USB Ethernet
device udav # Davicom DM9601E USB
## End FreeNAS specific section

44
build/config/packages.pyd Normal file
View File

@@ -0,0 +1,44 @@
#+
# Copyright (c) 2010-2015 iXsystems, Inc., All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc. OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
package(
name="base-os",
template=e("${BUILD_CONFIG}/templates/packages/base-os")
)
package(
name="freebsd-pkgdb",
template=e("${BUILD_CONFIG}/templates/packages/freebsd-pkgdb")
)
package(
name="freenas-pkg-tools",
template=e("${BUILD_CONFIG}/templates/packages/freenas-pkg-tools")
)
package(
name="freenasUI",
template=e("${BUILD_CONFIG}/templates/packages/freenasUI")
)

View File

@@ -0,0 +1,141 @@
#+
# Copyright (c) 2010-2015 iXsystems, Inc., All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc. OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
port(
name="freenas/freenas-files",
options=[
e("PRODUCT_VERSION=${VERSION}"),
e("BUILD_TIMESTAMP=${BUILD_TIMESTAMP}"),
e("REVISION=${GIT_REVISION}")
]
)
port(
name="freenas/freenas-debug",
options=[
e("PRODUCT_VERSION=${VERSION}"),
e("BUILD_TIMESTAMP=${BUILD_TIMESTAMP}"),
e("REVISION=${GIT_REVISION}")
]
)
port(
name="freenas/freenas-datastore",
options=[
e("PRODUCT_VERSION=${VERSION}"),
e("BUILD_TIMESTAMP=${BUILD_TIMESTAMP}"),
e("REVISION=${GIT_REVISION}")
]
)
port(
name="freenas/freenas-dispatcher",
options=[
e("PRODUCT_VERSION=${VERSION}"),
e("BUILD_TIMESTAMP=${BUILD_TIMESTAMP}"),
e("REVISION=${GIT_REVISION}")
]
)
port(
name="freenas/freenas-etcd",
options=[
e("PRODUCT_VERSION=${VERSION}"),
e("BUILD_TIMESTAMP=${BUILD_TIMESTAMP}"),
e("REVISION=${GIT_REVISION}")
]
)
port(
name="freenas/freenas-networkd",
options=[
e("PRODUCT_VERSION=${VERSION}"),
e("BUILD_TIMESTAMP=${BUILD_TIMESTAMP}"),
e("REVISION=${GIT_REVISION}")
]
)
port(
name="freenas/freenas-fnstatd",
options=[
e("PRODUCT_VERSION=${VERSION}"),
e("BUILD_TIMESTAMP=${BUILD_TIMESTAMP}"),
e("REVISION=${GIT_REVISION}")
]
)
port(
name="freenas/freenas-10gui",
options=[
e("PRODUCT_VERSION=${VERSION}"),
e("BUILD_TIMESTAMP=${BUILD_TIMESTAMP}"),
e("REVISION=${GIT_REVISION}")
]
)
port(
name="freenas/freenas-cli",
options=[
e("PRODUCT_VERSION=${VERSION}"),
e("BUILD_TIMESTAMP=${BUILD_TIMESTAMP}"),
e("REVISION=${GIT_REVISION}")
]
)
port(
name="freenas/py-libzfs",
options=[
e("PRODUCT_VERSION=${VERSION}"),
e("BUILD_TIMESTAMP=${BUILD_TIMESTAMP}"),
e("REVISION=${GIT_REVISION}")
]
)
port(
name="freenas/py-netif",
options=[
e("PRODUCT_VERSION=${VERSION}"),
e("BUILD_TIMESTAMP=${BUILD_TIMESTAMP}"),
e("REVISION=${GIT_REVISION}")
]
)
port(
name="freenas/py-sysctl",
options=[
e("PRODUCT_VERSION=${VERSION}"),
e("BUILD_TIMESTAMP=${BUILD_TIMESTAMP}"),
e("REVISION=${GIT_REVISION}")
]
)
port(
name="freenas/py-fnutils",
options=[
e("PRODUCT_VERSION=${VERSION}"),
e("BUILD_TIMESTAMP=${BUILD_TIMESTAMP}"),
e("REVISION=${GIT_REVISION}")
]
)

View File

@@ -0,0 +1,49 @@
#+
# Copyright (c) 2010-2015 iXsystems, Inc., All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc. OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
port(name="lang/python27")
port(name="lang/python2")
port(name="lang/python")
port(name="databases/sqlite3")
port(name="databases/py-sqlite3")
port(name="databases/py-bsddb3")
port(
name="freenas/pc-sysinstall",
options=[
e("PRODUCT_VERSION=${VERSION}"),
e("BUILD_TIMESTAMP=${BUILD_TIMESTAMP}"),
e("REVISION=${GIT_REVISION}")
]
)
port(
name="freenas/freenas-installer",
options=[
e("PRODUCT_VERSION=${VERSION}"),
e("BUILD_TIMESTAMP=${BUILD_TIMESTAMP}"),
e("REVISION=${GIT_REVISION}")
]
)

View File

@@ -0,0 +1,328 @@
#+
# Copyright (c) 2010-2015 iXsystems, Inc., All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc. OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
port(name="sysutils/pcbsd-appweb")
port(name="net/mDNSResponder")
port(name="textproc/libxml2")
port(name="devel/libffi")
port(name="archivers/lz4")
port(name="archivers/lzo2")
port(name="archivers/pigz")
port(name="archivers/plzip")
port(name="security/easy-rsa")
port(name="security/openvpn", options=["WITHOUT_CHECK=yes"])
port(name="converters/iconv", options=["OPTIONS_FILE_UNSET+=CCSUTIL"])
port(name="devel/gettext")
port(name="comms/lrzsz")
port(name="devel/pkgconf")
port(name="devel/m4")
port(name="sysutils/screen")
port(name="devel/libpthread-stubs")
port(name="devel/cdialog")
port(name="dns/inadyn-mt")
port(name="devel/pcre")
port(name="editors/nano")
port(name="ftp/proftpd")
port(name="misc/cpuid")
port(name="net-mgmt/clog")
port(name="net-mgmt/sipcalc")
if LABEL != "TrueNAS":
port(name="net/vblade")
port(name="emulators/virtualbox-ose-kmod", options=["OPTIONS_FILE_SET+=VIMAGE"])
port(name="security/libgpg-error")
port(name="security/libgcrypt")
port(name="databases/db48")
port(name="security/cyrus-sasl2-gssapi")
port(name="net/openldap24-sasl-client")
port(name="net/smbldap-tools")
port(name="net/rsync", options=[
"OPTIONS_FILE_SET+=ACL",
"OPTIONS_FILE_SET+=ICONV",
"OPTIONS_FILE_UNSET+=FLAGS"
])
port(name="lang/python27", options=[
"OPTIONS_FILE_UNSET+=NLS",
"OPTIONS_FILE_SET+=DEBUG"
])
port(name="lang/python2")
port(name="lang/python")
port(name="lang/cython")
# conflicting version of python (the below is installed as dependency of another port albeit as a different version)
#port(name="devel/py-setuptools")
port(name="dns/py-bonjour")
port(name="dns/py-dnspython")
port(name="devel/tevent")
port(name="devel/talloc", options=["MAKE_JOBS_UNSAFE=y", "MAKE_JOBS_NUMBER=1"])
port(name="devel/libexecinfo")
port(name="devel/popt")
port(name="databases/tdb", options=["MAKE_JOBS_UNSAFE=y", "MAKE_JOBS_NUMBER=1"])
port(name="sysutils/libsunacl")
port(name="security/pam_ldap")
port(name="security/pam_mkhomedir")
port(name="shells/bash", options=["OPTIONS_FILE_UNSET+=NLS"])
port(name="shells/ksh93")
port(name="shells/mksh")
port(name="shells/zsh")
port(name="shells/scponly", options=[
"OPTIONS_FILE_SET+=GFTP",
"OPTIONS_FILE_SET+=RSYNC",
"OPTIONS_FILE_SET+=SCP",
"OPTIONS_FILE_SET+=WINSCP"
])
port(name="sysutils/e2fsprogs")
port(name="sysutils/fusefs-libs")
port(name="devel/libublio")
port(name="sysutils/fusefs-ntfs")
port(name="sysutils/smartmontools")
port(name="net/libdnet")
port(name="emulators/open-vm-tools-nox11", options=["WITHOUT_ICU=y"])
if PRODUCT == "TrueNAS":
port(name="emulators/qemu", options=[
"WITHOUT_ADD_AUDIO=y",
"WITHOUT_ALL_TARGETS=y",
"WITHOUT_CDROM_DMA=y",
"WITHOUT_CURL=y",
"WITHOUT_GNS3=y",
"WITHOUT_GNUTLS=y",
"WITHOUT_KQEMU=y",
"WITHOUT_BPF=y",
"WITHOUT_RTL8139_TIMER=y",
"WITHOUT_SAMBA=y",
"WITHOUT_SDL=y"
])
port(name="databases/sqlite3")
port(name="databases/py-sqlite3")
port(name="databases/py-bsddb3")
port(name="databases/mongodb")
port(name="databases/pymongo")
port(name="devel/py-gevent")
port(name="www/py-gevent-websocket")
port(name="www/py-flask")
port(name="www/py-flask-bootstrap")
port(name="devel/py-argh")
port(name="devel/py-texttable")
port(name="devel/py-columnize")
port(name="devel/py-pip")
port(name="devel/py-pyee")
port(name="devel/py-watchdog")
port(name="devel/py-setproctitle")
port(name="devel/py-jsonschema")
port(name="devel/py-jsonpointer")
port(name="devel/py-natural")
port(name="devel/py-enum34")
port(name="net/py-ipaddress")
port(name="math/py-networkx")
port(name="math/py-pandas")
port(name="devel/py-tables")
port(name="devel/py-termcolor")
port(name="sysutils/py-psutil")
port(name="textproc/py-mako")
port(name="www/py-ws4py")
port(name="www/py-flup")
port(name="www/node")
port(name="devel/py-asn1")
port(name="devel/py-asn1-modules")
port(name="security/openssl")
port(name="security/py-openssl")
port(name="security/py-htpasswd")
port(name="www/apache24", options=["WITH_OPENSSL_PORT=yes"])
port(name="www/mod_mpm_itk")
port(name="sysutils/syslog-ng")
port(name="www/nginx", options=[
"WITH_OPENSSL_PORT=yes",
"OPTIONS_FILE_SET+=HTTP_SSL",
"OPTIONS_FILE_SET+=HTTP_UPLOAD",
"OPTIONS_FILE_SET+=HTTP_UPLOAD_PROGRESS",
"OPTIONS_FILE_SET+=SPDY",
"OPTIONS_FILE_SET+=STATUS"
])
port(name="net-mgmt/net-snmp", options=[
"OPTIONS_FILE_UNSET+=PERL",
"OPTIONS_FILE_UNSET+=PERL_EMBEDDED",
"NET_SNMP_WITHOUT_MIB_MODULE_LIST=sctp-mib"
])
port(name="sysutils/nut", options=["OPTIONS_FILE_UNSET+=NEON"])
port(name="textproc/py-libxml2")
port(name="textproc/expat2")
port(name="devel/gamin")
#port(name="devel/gio-fam-backend")
if PRODUCT == "TrueNAS":
port(name="devel/bison")
port(name="devel/libffi")
port(name="misc/gnomehier")
port(name="www/py-httplib2")
port(name="net/py-oauth2")
port(name="sysutils/jailme")
if REPORTING:
port(name="devel/libstatgrab")
port(name="devel/libltdl")
port(name="net/liboping")
port(name="net-mgmt/collectd5", options=[
"OPTIONS_FILE_UNSET+=BIND",
"OPTIONS_FILE_UNSET+=SNMP",
"OPTIONS_FILE_SET+=DISK",
"OPTIONS_FILE_SET+=STATGRAB"
])
#FIXME: gobject now requires cairo as build dependency
port(name="devel/gobject-introspection")
port(name="devel/py-ipaddr")
port(name="converters/base64")
port(name="emulators/mtools", options=["OPTIONS_FILE_UNSET+=X11"])
port(name="sysutils/arcconf")
port(name="sysutils/tw_cli")
port(name="sysutils/megacli")
if PRODUCT != "TrueNAS":
port(name="sysutils/areca-cli")
port(name="sysutils/hptcli")
port(name="net/py-ldap2", options=["OPTIONS_FILE_SET+=SASL"])
port(name="sysutils/ataidle")
port(name="sysutils/gnome_subr")
port(name="devel/dbus", options=["OPTIONS_FILE_UNSET+=X11"])
port(name="devel/dbus-glib")
port(name="devel/libdaemon")
port(name="databases/gdbm")
port(name="devel/py-lxml")
port(name="textproc/py-xml")
port(name="sysutils/dmidecode")
port(name="sysutils/graid5")
port(name="sysutils/tmux", options=["OPTIONS_FILE_SET+=LIBEVENT2"])
port(name="devel/py-dbus")
port(name="net/netatalk3", options=[
"OPTIONS_FILE_SET+=PAM",
"OPTIONS_FILE_SET+=ACL",
"OPTIONS_FILE_SET+=SENDFILE",
"OPTIONS_FILE_SET+=MDNSRESPONDER",
"OPTIONS_FILE_UNSET+=AVAHI",
"OPTIONS_FILE_SET+=LDAP"
])
port(name="net/ladvd")
port(name="dns/libidn")
port(name="ftp/wget")
port(name="benchmarks/iozone")
port(name="benchmarks/iperf")
port(name="benchmarks/netperf")
port(name="security/sudo", options=[
"OPTIONS_FILE_SET+=LDAP",
"OPTIONS_FILE_SET+=SSSD"
])
port(name="sysutils/ipmitool")
port(name="devel/py-mimeparse")
port(name="devel/py-six")
port(name="devel/py-dateutil")
port(name="devel/py-rose")
port(name="devel/py-lockfile")
port(name="devel/py-daemon")
port(name="devel/py-polib")
port(name="devel/py-ujson")
port(name="devel/py-simplejson")
port(name="www/wgetpaste")
port(name="devel/py-greenlet")
port(name="net/py-eventlet")
port(name="sysutils/sg3_utils")
port(name="graphics/jpeg")
port(name="www/py-requests")
port(name="sysutils/smp_utils")
port(name="net/trafshow")
#
# These are all for SSSD
#
port(name="textproc/xmlcatmgr")
port(name="textproc/libxslt")
port(name="dns/c-ares")
port(name="databases/ldb")
port(name="devel/libunistring")
port(name="devel/ding-libs")
port(name="devel/nspr")
port(name="security/nss")
port(name="security/krb5")
port(name="security/sssd")
port(name="security/ca_root_nss", options=["OPTIONS_FILE_SET+=ETCSYMLINK"])
port(name="ftp/curl")
port(name="devel/git", options=[
"OPTIONS_FILE_UNSET+=SVN",
"OPTIONS_FILE_UNSET+=CVS",
"OPTIONS_FILE_UNSET+=P4",
"OPTIONS_FILE_UNSET+=PERL",
"OPTIONS_FILE_UNSET+=CONTRIB",
"OPTIONS_FILE_UNSET+=NLS"
])
port(name="math/gmp")
port(name="security/libtasn1")
port(name="security/p11-kit")
port(name="security/nettle")
port(name="devel/libinotify")
port(name="dns/samba-nsupdate")
port(name="security/gnutls")
port(name="net/samba41", options=[
"OPTIONS_FILE_SET+=ACL_SUPPORT",
"OPTIONS_FILE_SET+=ADS",
"OPTIONS_FILE_SET+=AIO_SUPPORT",
"OPTIONS_FILE_UNSET+=AVAHI",
"OPTIONS_FILE_UNSET+=CUPS",
"OPTIONS_FILE_SET+=DEBUG",
"OPTIONS_FILE_UNSET+=DEVELOPER",
"OPTIONS_FILE_SET+=DNSUPDATE",
"OPTIONS_FILE_SET+=EXP_MODULES",
"OPTIONS_FILE_SET+=FAM_SUPPORT",
"OPTIONS_FILE_SET+=LDAP",
"OPTIONS_FILE_SET+=MANPAGES",
"OPTIONS_FILE_SET+=MDNSRESPONDER",
"OPTIONS_FILE_SET+=PAM_SMBPASS",
"OPTIONS_FILE_SET+=PTHREADPOOL",
"OPTIONS_FILE_SET+=QUOTAS",
"OPTIONS_FILE_UNSET+=SWAT",
"OPTIONS_FILE_SET+=SYSLOG",
"OPTIONS_FILE_SET+=UTMP",
"OPTIONS_FILE_SET+=WINBIND",
"OPTIONS_FILE_SET+=NSUPDATE",
"OPTIONS_FILE_UNSET+=BIND98",
"OPTIONS_FILE_UNSET+=BIND99",
"WITH_DEBUG=yes"
])
port(name="sysutils/grub2-pcbsd")
port(name="sysutils/beadm-devel")
port(name="net/py-pysphere")
if DEBUG:
port(name="editors/vim-lite")
port(name="misc/py-pexpect")
port(name="devel/ipython", options=["OPTIONS_FILE_UNSET+=X11", "OPTIONS_FILE_UNSET+=ZMQ"])
port(name="devel/ctags")

27
build/config/ports.pyd Normal file
View File

@@ -0,0 +1,27 @@
#+
# Copyright (c) 2010-2015 iXsystems, Inc., All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc. OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
include("${BUILD_CONFIG}/ports-freenas.pyd")
include("${BUILD_CONFIG}/ports-system.pyd")

34
build/config/release.pyd Normal file
View File

@@ -0,0 +1,34 @@
#+
# Copyright (c) 2010-2015 iXsystems, Inc., All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc. OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
if BUILD_TYPE == "RELEASE":
url = e("http://download.freenas.org/${VERSION_SHORT}/RELEASE")
else:
url = e("http://download.freenas.org/nightlies/${VERSION_SHORT}")
format("iso", "GUI_Upgrade.txz")
aux_file(name="ReleaseNotes", source=e("${BUILD_ROOT}/ReleaseNotes"))
aux_file(name="MANIFEST", source=e("${BUILD_ROOT}/FreeBSD/repo-manifest"))
aux_file(name="README", source=e("${BUILD_ROOT}/README.md"), template=True)

68
build/config/repos.pyd Normal file
View File

@@ -0,0 +1,68 @@
#+
# Copyright (c) 2010-2015 iXsystems, Inc., All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc. OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
if GIT_LOCATION == "INTERNAL":
repository(
name="trueos",
path="FreeBSD/src",
url="git@gitserver.ixsystems.com:/git/repos/freenas-build/trueos.git",
branch="freebsd10"
)
repository(
name="ports",
path="FreeBSD/ports",
url="git@gitserver.ixsystems.com:/git/repos/freenas-build/ports.git",
branch="masters/2014q4"
)
if GIT_LOCATION == "EXTERNAL":
repository(
name="trueos",
path="FreeBSD/src",
url="https://github.com/trueos/trueos",
branch="freebsd10"
)
repository(
name="ports",
path="FreeBSD/ports",
url="https://github.com/freenas/ports.git",
branch="masters/2014q4"
)
repository(
name="pcbsd",
path="FreeBSD/pcbsd",
url="https://github.com/pcbsd/pcbsd.git",
branch="master"
)
if LABEL == "TrueNAS":
repository(
name="truenas-components",
path="src/truenas",
branch="master"
)

View File

@@ -0,0 +1,7 @@
#!/bin/sh
export AVATAR_PROJECT="${PRODUCT}"
export AVATAR_VERSION="${VERSION}"
export AVATAR_BUILD_NUMBER=""
export AVATAR_ARCH="${BUILD_ARCH}"
export AVATAR_PROJECT_SITE="${PROJECT_SITE}"
export AVATAR_SUPPORT_SITE="${SUPPORT_SITE}"

View File

@@ -0,0 +1,60 @@
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /usr/local/etc/grub.d and settings from /usr/local/etc/default/grub
#
### BEGIN /usr/local/etc/grub.d/00_header ###
if [ -s $$prefix/grubenv ]; then
load_env
fi
set default="0"
if [ x"$${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
if [ "$${prev_saved_entry}" ]; then
set saved_entry="$${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "$${boot_once}" ]; then
saved_entry="$${chosen}"
save_env saved_entry
fi
}
function load_video {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
}
terminal_output gfxterm
insmod gfxmenu
insmod png
set timeout=15
menuentry "${PRODUCT} Installer" {
kfreebsd /boot/kernel/kernel
kfreebsd_loadenv /boot/device.hints
set kFreeBSD.vfs.root.mountfrom=cd9660:/dev/iso9660/${CDROM_LABEL}
set kFreeBSD.xconsole=YES
# The following delay during mounting of root file
# system is needed because mounting of an IPMI CD-ROM
# sometimes slow.
set kFreeBSD.vfs.mountroot.timeout=180
}

View File

@@ -0,0 +1,15 @@
#
# Boot loader file for ${PRODUCT}
#
autoboot_delay="2"
loader_logo="%NANO_LABEL_LOWER%"
loader_menu_title=" "
loader_version=" "
loader_brand="%NANO_LABEL_LOWER%-brand"
vfs.root.mountfrom="cd9660:iso9660/${CDROM_LABEL}"
# The following delay during mounting of root file
# system is needed because mounting of an IPMI CD-ROM
# sometimes slow.
vfs.mountroot.timeout="180"

View File

@@ -0,0 +1,4 @@
.timeout 5
.onfail retry
.md /data/base.ufs.uzip
ufs:/dev/md#.uzip rw

View File

@@ -0,0 +1,42 @@
[Package]
name = base-os
comment = "FreeNAS OS"
desc = "FreeNAS OS (derived from FreeBSD)"
www = http://www.freenas.org/
origin = freenas/os
maintainer = dev@ixsystems.com
prefix = /
arch = freebsd:10:x86:64
licenselogic = or
licenses = [BSD, MIT, GPL]
[Scripts]
post-install = /usr/bin/touch /boot/kernel/linker.hints
/usr/bin/touch /boot/modules/linker.hints
/usr/sbin/service datastore init
/usr/sbin/service datastore start
/usr/local/sbin/dsrestore -f /usr/local/share/datastore/factory.json
/usr/sbin/service datastore stop
post-upgrade = /usr/bin/touch /boot/kernel/linker.hints
/usr/bin/touch /boot/modules/linker.hints
/usr/bin/touch /data/cd-upgrade
/usr/bin/touch /data/need-update
/usr/local/sbin/dsmigrate -f /usr/local/share/datastore/factory.json
[Files]
exclude = /usr/local/www/gui
/usr/share/man
/usr/lib/*.a
/usr/local/share/doc
/usr/local/share/gtk-doc
/usr/local/share/gir-1.0
/usr/local/info
/usr/local/man
/usr/local/share/examples
/usr/share/groff_font
/usr/share/tmac
/usr/share/me
/var/db/pkg
/etc/rc.d/netif
/etc/rc.d/routing

View File

@@ -0,0 +1,17 @@
[Package]
name = freebsd-pkgdb
comment = "FreeBSD pkg db files"
desc = "FreeNAS OS (derived from FreeBSD)"
www = http://www.freenas.org/
origin = freenas/os
maintainer = dev@ixsystems.com
prefix = /
arch = freebsd:10:x86:64
licenselogic = or
licenses = [BSD, MIT, GPL]
requires-reboot = False
[Files]
include =
/var/db/pkg

View File

@@ -0,0 +1,36 @@
[Package]
name = freenas-pkg-tools
comment = "FreeNAS Package Tools"
desc = "FreeNAS Package tools"
www = http://www.freenas.org/
origin = freenas/pkg-tools
maintainer = dev@ixsystems.com
prefix = /
arch = freebsd:10:x86:64
licenselogic = or
licenses = [BSD]
requires-reboot = False
[Files]
include = /usr/local/lib/freenasOS/Configuration.py
/usr/local/lib/freenasOS/Exceptions.py
/usr/local/lib/freenasOS/Installer.py
/usr/local/lib/freenasOS/Manifest.py
/usr/local/lib/freenasOS/Package.py
/usr/local/lib/freenasOS/Train.py
/usr/local/lib/freenasOS/Update.py
/usr/local/lib/freenasOS/__init__.py
/usr/local/libexec/verify_signature
/usr/local/bin/freenas-install
/usr/local/bin/manifest_util
/usr/local/bin/freenas-update
/usr/local/bin/freenas-verify
/usr/local/share/certs/freenas-update.pem
/usr/local/share/certs/iX-CA.pem
[Scripts]
# Have a post-upgrade script so it knows an upgrade is safe
post-upgrade =
true

View File

@@ -0,0 +1,16 @@
[Package]
name = freenasUI
comment = "FreeNAS User Interface"
desc = "FreeNAS UI"
www = http://www.freenas.org/
origin = freenas/ui
maintainer = dev@ixsystems.com
prefix = /
arch = freebsd:10:x86:64
licenselogic = or
licenses = [BSD, MIT, GPL]
[Files]
include = /usr/local/www/gui

View File

@@ -0,0 +1,3 @@
FreeBSD: {
enabled: no
}

View File

@@ -0,0 +1,4 @@
local: {
url: "file:///usr/ports/packages",
enabled: yes
}

View File

@@ -0,0 +1,5 @@
pcbsd-major: {
url: "http://pkg.cdn.pcbsd.org/10.0-RELEASE/amd64"
signature_type: "fingerprints",
enabled: false
}

View File

@@ -0,0 +1,3 @@
USE_PACKAGE_DEPENDS=yes
BATCH=yes
WRKDIRPREFIX=/wrkdirs

View File

@@ -0,0 +1,9 @@
NO_ZFS=yes
RESOLV_CONF=/etc/resolv.conf
BASEFS=${OBJDIR}/poudriere
POUDRIERE_DATA=${OBJDIR}/ports
USE_PORTLINT=no
USE_TMPFS=yes
GIT_URL=${ports_repo}
GIT_BRANCH=${ports_branch}
DISTFILES_CACHE=${ports_distfiles_cache}

29
build/config/upgrade.pyd Normal file
View File

@@ -0,0 +1,29 @@
#+
# Copyright (c) 2010-2015 iXsystems, Inc., All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc. OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
aux_file(name=e("${PRODUCT}-MANIFEST"), source=e("${PACKAGES_DESTDIR}/${PRODUCT}-MANIFEST"))
aux_file(name="ReleaseNotes", source=e("${BUILD_ROOT}/ReleaseNotes"))
aux_file(name="ChangeLog", source=e("${BUILD_ROOT}/ChangeLog"))
aux_file(name="NOTICE", source=e("${BUILD_ROOT}/NOTICE"))

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################

73
build/customize/remove-bits.py Executable file
View File

@@ -0,0 +1,73 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import sys
from utils import setup_env, sh
setup_env()
def main(destdir):
# Kill .pyo files
sh("find ${destdir}/usr/local -name '*.pyo' -delete")
# Kill includes
sh("find ${destdir}/usr/local/include \! -name 'pyconfig.h' -delete")
# Kill docs
sh('rm -rf ${destdir}/usr/local/share/doc')
sh('rm -rf ${destdir}/usr/local/share/gtk-doc')
# Kill gobject introspection xml
sh('rm -rf ${destdir}/usr/local/share/git-1.0')
# Kill info
sh('rm -rf ${destdir}/usr/local/info')
# Kill man pages
sh('rm -rf ${destdir}/usr/local/man')
# Kill examples
sh('rm -rf ${destdir}/usr/local/share/examples')
# Kill groff_fonts junk
sh('rm -rf ${destdir}/usr/share/groff_font')
sh('rm -rf ${destdir}/usr/share/tmac')
sh('rm -rf ${destdir}/usr/share/me')
# Kill static libraries
sh("find ${destdir}/usr/local -name '*.a' -or -name '*.la' -delete")
# magic.mgc is just a speed optimization
sh('rm -f ${destdir}/usr/share/misc/magic.mgc')
if __name__ == '__main__':
main(sys.argv[1])

71
build/customize/remove-gcc.py Executable file
View File

@@ -0,0 +1,71 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
from utils import setup_env, sh, chroot
setup_env()
files_to_save = [
"/usr/local/lib/gcc48/libstdc++.so.6",
"/usr/local/lib/gcc48/libstdc++.so",
"/usr/local/lib/gcc48/libstdc++.a",
"/usr/local/lib/gcc48/libmudflap.so.0",
"/usr/local/lib/gcc48/libmudflap.so",
"/usr/local/lib/gcc48/libmudflapth.so.0",
"/usr/local/lib/gcc48/libmudflapth.so",
"/usr/local/lib/gcc48/libssp.so.0",
"/usr/local/lib/gcc48/libssp.so",
"/usr/local/lib/gcc48/libgcc_s.so.1",
"/usr/local/lib/gcc48/libgcc_s.so",
"/usr/local/lib/gcc48/libquadmath.so.0",
"/usr/local/lib/gcc48/libquadmath.so",
"/usr/local/lib/gcc48/libquadmath.a",
"/usr/local/lib/gcc48/libgomp.spec",
"/usr/local/lib/gcc48/libgomp.so.1",
"/usr/local/lib/gcc48/libgomp.so",
"/usr/local/lib/gcc48/libitm.spec",
"/usr/local/lib/gcc48/libitm.so.1",
"/usr/local/lib/gcc48/libitm.so"
]
def main():
for i in files_to_save:
sh('mv ${WORLD_DESTDIR}/${i} ${WORLD_DESTDIR}/${i}.bak')
chroot('${WORLD_DESTDIR}', 'pkg delete -y -f gcc\* || true')
for i in files_to_save:
sh('mv ${WORLD_DESTDIR}/${i}.bak ${WORLD_DESTDIR}/${i}')
if __name__ == '__main__':
main()

View File

@@ -0,0 +1,40 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
from utils import setup_env, chroot
setup_env()
def main():
chroot('${WORLD_DESTDIR}', 'pkg clean -a -y')
if __name__ == '__main__':
main()

View File

@@ -0,0 +1,42 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
from utils import sh, info, setup_env
setup_env()
def main():
pass
if __name__ == '__main__':
info('Stripping installed binaries')
main()

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################

View File

@@ -0,0 +1,42 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
from utils import setup_env, setfile, e
setup_env()
def main():
rev = e('${GIT_REVISION}')
revstr = e('(${rev})') if rev else ''
setfile('${WORLD_DESTDIR}/etc/version', e('${PRODUCT} ${VERSION} ${revstr}'))
if __name__ == '__main__':
main()

3
build/hooks/README Normal file
View File

@@ -0,0 +1,3 @@
This directory contains optional custom hooks for the FreeNAS build process.
Their names should be reasonably self-explanatory about where they fit into
the build process.

101
build/lib/dsl.py Normal file
View File

@@ -0,0 +1,101 @@
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
import uuid
class GlobalsWrapper(dict):
def __init__(self, env):
super(GlobalsWrapper, self).__init__()
self.dict = {}
self.env = env
def __getitem__(self, item):
if item.isupper():
if item in self.dict:
return self.dict[item]
return self.env.get(item, None)
if item == 'e':
from utils import e
return e
if item == 'sh':
from utils import sh_str
return sh_str
if item == 'int':
return int
if item == 'str':
return str
if item == 'include':
return self.include
return self.wrap(item)
def __setitem__(self, key, value):
if key.isupper():
self.env[key] = value
else:
self.dict[key] = value
def wrap(self, name):
def fn(*args, **kwargs):
if args:
if name not in self.dict:
self.dict[name] = []
self.dict[name].extend(args)
if kwargs:
if name not in self.dict:
self.dict[name] = {}
ident = kwargs.get('name', str(uuid.uuid4()))
self.dict[name][ident] = kwargs
return fn
def include(self, filename):
d = load_file(filename, self.env)
for k, v in d.items():
if k in self.dict:
if isinstance(self.dict[k], dict):
self.dict[k].update(v)
elif isinstance(self.dict[k], list):
self.dict[k] += v
else:
self.dict[k] = v
def load_file(filename, env):
g = GlobalsWrapper(env)
execfile(os.path.expandvars(filename), g)
return g.dict

227
build/lib/utils.py Normal file
View File

@@ -0,0 +1,227 @@
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
import sys
import time
import datetime
import subprocess
import signal
import string
import signal
import inspect
from collections import defaultdict
from dsl import load_file
def interrupt(signal, frame):
error('Build interrupted by SIGINT')
def sh(*args, **kwargs):
logfile = kwargs.pop('log', None)
mode = kwargs.pop('mode', 'w')
nofail = kwargs.pop('nofail', False)
cmd = e(' '.join(args), **get_caller_vars())
if logfile:
sh('mkdir -p', os.path.dirname(logfile))
f = open(logfile, mode)
debug('sh: {0}', cmd)
ret = subprocess.call(cmd, stdout=f if logfile else None, stderr=subprocess.STDOUT, shell=True)
if ret != 0 and not nofail:
info('Failed command: {0}', cmd)
info('Returned value: {0}', ret)
error('Build failed')
return ret
def sh_str(*args, **kwargs):
logfile = kwargs.pop('log', None)
mode = kwargs.pop('mode', 'w')
cmd = e(' '.join(args), **get_caller_vars())
if logfile:
f = open(logfile, mode)
try:
return subprocess.check_output(cmd, shell=True).strip()
except subprocess.CalledProcessError:
return ''
def chroot(root, *args, **kwargs):
root = e(root, **get_caller_vars())
cmd = e(' '.join(args), **get_caller_vars())
return sh("chroot ${root} /bin/sh -c '${cmd}'", **kwargs)
def setup_env():
signal.signal(signal.SIGINT, interrupt)
dsl = load_file('${BUILD_CONFIG}/env.pyd', os.environ)
for k, v in dsl.items():
if k.isupper():
os.environ[k] = v
def env(name, default=None):
return os.getenv(name, default)
def readfile(filename):
filename = e(filename, **get_caller_vars())
with open(filename, 'r') as f:
return f.read().strip()
def setfile(filename, contents):
filename = e(filename, **get_caller_vars())
debug('setfile: {0}', filename)
if not os.path.isdir(os.path.dirname(filename)):
sh('mkdir -p', os.path.dirname(filename))
f = open(filename, 'w')
f.write(contents)
f.write('\n')
f.close()
def appendfile(filename, contents):
filename = e(filename, **get_caller_vars())
debug('appendfile: {0}', filename)
if not os.path.isdir(os.path.dirname(filename)):
sh('mkdir -p', os.path.dirname(filename))
f = open(filename, 'a')
f.write(contents)
f.write('\n')
def on_abort(func):
def abort():
info('Build aborted, cleaning up')
func()
signal.signal(signal.SIGINT, abort)
signal.signal(signal.SIGTERM, abort)
def get_caller_vars():
frame = inspect.currentframe()
try:
parent = frame.f_back.f_back
kwargs = parent.f_locals
kwargs.update(parent.f_globals)
finally:
del frame
return kwargs
def e(s, **kwargs):
s = os.path.expandvars(s)
if not kwargs:
kwargs = get_caller_vars()
t = string.Template(s)
d = defaultdict(lambda: '')
d.update(kwargs)
return t.safe_substitute(d)
def pathjoin(*args):
return os.path.join(*[os.path.expandvars(i) for i in args])
def objdir(path):
return os.path.join(e('${OBJDIR}'), path)
def template(filename, variables=None):
f = open(e(filename), 'r')
t = string.Template(f.read())
variables = variables or {}
variables.update(os.environ)
result = t.safe_substitute(**variables)
f.close()
return result
def glob(path):
import glob as g
return g.glob(e(path, **get_caller_vars()))
def walk(path):
path = e(path, **get_caller_vars())
for root, dirs, files in os.walk(path):
for name in files:
yield os.path.relpath(os.path.join(root, name), path)
for name in dirs:
yield os.path.relpath(os.path.join(root, name), path)
def sha256(filename, output=None):
filename = e(filename, **get_caller_vars())
if not output:
output = filename + '.sha256'
else:
output = e(output, **get_caller_vars())
setfile(output, sh_str("sha256 ${filename}"))
def import_function(filename, fname):
module = __import__(filename)
return getattr(module, fname)
def elapsed():
timestamp = env('BUILD_STARTED', str(int(time.time())))
td = int(timestamp)
return str(datetime.timedelta(seconds=time.time() - td))
def info(fmt, *args):
print '[{0}] ==> '.format(elapsed()) + e(fmt.format(*args))
def debug(fmt, *args):
if env('BUILD_LOGLEVEL') == 'DEBUG':
log(fmt, *args)
def log(fmt, *args):
print e(fmt.format(*args))
def error(fmt, *args):
print '[{0}] ==> ERROR: '.format(elapsed()) + e(fmt.format(*args))
sys.exit(1)

39
build/save_build.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/sh
#
# Script to capture the build
# This will save a copy of your built image
# to SAVED_BUILD_ENV_ROOT (XXX: move to nano_env?)
#
# We do this so developers can analyze crashdumps against
# the shipped image.
#
myname=`basename "$0"`
mydir=`dirname "$0"`
. $mydir/nano_env
if [ -z "$NANO_LABEL" ] ; then
echo "NANO_LABEL unset, please run this from the top level via:"
echo " make save-build-env"
exit 1
fi
: ${SAVED_BUILD_ENV_ROOT="/freenas/BSD/releng/${NANO_LABEL}/build_env/"}
: ${SAVED_VERSION_NAME=${VERSION}}
SAVED_BUILD_ENV_DESTDIR="${SAVED_BUILD_ENV_ROOT}/${SAVED_VERSION_NAME}"
if [ -e "${SAVED_BUILD_ENV_DESTDIR}" ] ; then
rm -rf ${SAVED_BUILD_ENV_DESTDIR}
fi
set -x
set -e
mkdir -p ${SAVED_BUILD_ENV_DESTDIR}
tar -C "$mydir/.." -cf - . | tar -C "${SAVED_BUILD_ENV_DESTDIR}" --no-same-permissions --no-same-owner -xf -
set +x
echo "Build saved to '$SAVED_BUILD_ENV_DESTDIR'"
exit 0

50
build/tools/apply-tag.py Executable file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
import sys
from dsl import load_file
from utils import sh, sh_str, info, error, env
dsl = load_file('${BUILD_CONFIG}/repos.pyd', os.environ)
def tag_repo(repo, tag):
sh("git --git-dir=${repo}/.git tag ${tag}")
if __name__ == '__main__':
if len(sys.argv) < 2:
error('Usage: apply-tag.py <tag>')
tag = sys.argv[1]
for i in dsl['repository'].values():
info('Tagging repository: {0}', i['name'])
tag_repo(i)

105
build/tools/build-gui.py Executable file
View File

@@ -0,0 +1,105 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
import sys
import glob
from utils import env, e, setup_env, sh, sh_str, info, debug, error, walk, objdir
logfile = objdir('logs/build-gui')
def cleandirs():
sh('mkdir -p ${GUI_STAGEDIR}')
sh('mkdir -p ${GUI_DESTDIR}')
sh('rm -rf ${GUI_STAGEDIR}/*')
sh('rm -rf ${GUI_DESTDIR}/*')
def copy():
sh('cp -a ${SRC_ROOT}/gui/ ${GUI_STAGEDIR}/')
def gplusplus_version():
return glob.glob('/usr/local/bin/g++??')[0]
def apply_npm_quirks():
q = []
if not os.path.islink('/usr/local/bin/g++'):
os.symlink(gplusplus_version(), '/usr/local/bin/g++')
q.append('g++')
if not os.path.islink('/usr/local/bin/c++'):
os.symlink(gplusplus_version(), '/usr/local/bin/c++')
q.append('c++')
return q
def remove_npm_quirks(quirks):
for i in quirks:
os.unlink(os.path.join('/usr/local/bin', i))
def install():
node_modules = e('${GUI_STAGEDIR}/node_modules')
bower = e('${node_modules}/bower/bin/bower')
grunt = e('${node_modules}/grunt-cli/bin/grunt')
os.chdir(e('${GUI_STAGEDIR}'))
sh('npm install grunt grunt-cli bower', log=logfile)
sh('npm install', log=logfile, mode='a')
sh(bower, '--allow-root install', log=logfile, mode='a')
sh(grunt, 'deploy --force --dir=${GUI_DESTDIR}', log=logfile, mode='a')
def create_plist():
with open(e('${GUI_DESTDIR}/gui-plist'), 'w') as f:
for i in walk('${GUI_DESTDIR}'):
if not os.path.isdir(e('${GUI_DESTDIR}/${i}')):
f.write(e('/usr/local/www/gui/${i}\n'))
with open(e('${GUI_STAGEDIR}/custom-plist')) as c:
f.write(c.read())
if __name__ == '__main__':
if env('SKIP_GUI'):
info('Skipping GUI build as instructed by setting SKIP_GUI')
sys.exit(0)
info('Building GUI')
info('Log file: {0}', logfile)
cleandirs()
copy()
q = apply_npm_quirks()
install()
remove_npm_quirks(q)
create_plist()

165
build/tools/build-os.py Executable file
View File

@@ -0,0 +1,165 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
import sys
from dsl import load_file
from utils import sh, sh_str, env, e, setup_env, objdir, info, debug, error
dsl = load_file('${BUILD_CONFIG}/config.pyd', os.environ)
arch = env('TARGET_ARCH', 'amd64')
makeconfbuild = objdir('make-build.conf')
kernconf = objdir(e('${KERNCONF}'))
kernlog = objdir('logs/buildkernel')
worldlog = objdir('logs/buildworld')
makejobs = None
def calculate_make_jobs():
global makejobs
jobs = sh_str('sysctl -n kern.smp.cpus')
if not jobs:
makejobs = 2
makejobs = 2 * int(jobs) + 1
debug('Using {0} make jobs', makejobs)
def create_make_conf_build():
conf = open(makeconfbuild, 'w')
for m in dsl['make_conf_build'].values():
for k, v in m.items():
conf.write('{0}={1}\n'.format(k, v))
conf.close()
def create_kernel_config():
conf = open(kernconf, 'w')
for i in dsl['kernel_config']:
f = open(os.path.join(env('BUILD_CONFIG'), i), 'r')
conf.write(f.read())
f.close()
conf.close()
def buildkernel():
modules = ' '.join(dsl['kernel_module'])
info('Building kernel from ${{TRUEOS_ROOT}}')
info('Log file: {0}', kernlog)
debug('Kernel configuration file: {0}', kernconf)
debug('Selected modules: {0}', modules)
sh(
"env MAKEOBJDIRPREFIX=${OBJDIR}",
"make",
"-j {0}".format(makejobs),
"-C ${TRUEOS_ROOT}",
"NO_KERNELCLEAN=YES",
"__MAKE_CONF={0}".format(makeconfbuild),
"KERNCONFDIR={0}".format(os.path.dirname(kernconf)),
"KERNCONF={0}".format(os.path.basename(kernconf)),
"MODULES_OVERRIDE='{0}'".format(modules),
"buildkernel",
log=kernlog
)
def buildworld():
info('Building world from ${{TRUEOS_ROOT}}')
info('Log file: {0}', worldlog)
debug('World make.conf: {0}', makeconfbuild)
sh(
"env MAKEOBJDIRPREFIX=${OBJDIR}",
"make",
"-j {0}".format(makejobs),
"-C ${TRUEOS_ROOT}",
"__MAKE_CONF={0}".format(makeconfbuild),
"NOCLEAN=YES",
"buildworld",
log=worldlog
)
def installworld(destdir, worldlog, distriblog):
info('Installing world in {0}', destdir)
info('Log file: {0}', worldlog)
sh(
"env MAKEOBJDIRPREFIX=${OBJDIR}",
"make",
"-C ${TRUEOS_ROOT}",
"installworld",
"DESTDIR=${destdir}",
"__MAKE_CONF=${makeconfbuild}",
log=worldlog
)
info('Creating distribution in {0}', destdir)
info('Log file: {0}', distriblog)
sh(
"env MAKEOBJDIRPREFIX=${OBJDIR}",
"make",
"-C ${TRUEOS_ROOT}",
"distribution",
"DESTDIR=${destdir}",
"__MAKE_CONF=${makeconfbuild}",
log=distriblog
)
def installkernel(destdir, log):
info('Installing kernel in {0}', log)
info('Log file: {0}', log)
modules = ' '.join(dsl['kernel_module'])
sh(
"env MAKEOBJDIRPREFIX=${OBJDIR}",
"make",
"-C ${TRUEOS_ROOT}",
"installkernel",
"DESTDIR=${destdir}",
"__MAKE_CONF=${makeconfbuild}",
"MODULES_OVERRIDE='{0}'".format(modules),
log=log
)
if __name__ == '__main__':
if env('SKIP_OS'):
info('Skipping buildworld & buildkernel as instructed by setting SKIP_OS')
sys.exit(0)
calculate_make_jobs()
create_make_conf_build()
create_kernel_config()
buildworld()
buildkernel()

119
build/tools/build-packages.py Executable file
View File

@@ -0,0 +1,119 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
import sys
import time
from dsl import load_file
from utils import sh, sh_str, e, setup_env, objdir, info, debug, error
dsl = load_file('${BUILD_CONFIG}/packages.pyd', os.environ)
tooldir = objdir('pkgtools')
pkgdir = objdir('packages')
pkgtoolslog = objdir('logs/build-pkgtools')
pkgversion = ''
sequence = ''
def read_repo_manifest():
global pkgversion
global sequence
versions = []
f = open(e("${BUILD_ROOT}/FreeBSD/repo-manifest"))
for i in f:
versions.append(i.split()[1])
pkgversion = '-'.join(versions)
sequence = sh_str('git show -s --format=%ct')
def build_pkgtools():
info('Building freenas-pkgtools')
info('Log file: {0}', pkgtoolslog)
sh(
"env MAKEOBJDIRPREFIX=${OBJDIR}",
"make -C ${SRC_ROOT}/freenas-pkgtools obj all install DESTDIR=${tooldir} PREFIX=/usr/local",
log=pkgtoolslog
)
sh(
"env MAKEOBJDIRPREFIX=${OBJDIR}",
"make -C ${SRC_ROOT}/freenas-pkgtools obj all install DESTDIR=${WORLD_DESTDIR} PREFIX=/usr/local",
log=pkgtoolslog
)
def build_packages():
info('Building packages')
sh('rm -rf ${pkgdir}/Packages')
sh('mkdir -p ${pkgdir}/Packages')
for i in dsl['package'].values():
template = i['template']
name = i['name']
sh(
"${tooldir}/usr/local/bin/create_package",
"-R ${WORLD_DESTDIR}",
"-T ${template}",
"-N ${name}",
"-V ${VERSION}",
'${pkgdir}/Packages/${name}-${VERSION}-${pkgversion}.tgz')
def create_manifest():
info('Creating package manifests')
pkgs = []
for i in dsl['package'].values():
name = i['name']
pkgs.append(e("${name}=${VERSION}-${pkgversion}"))
date = int(time.time())
train = e('${TRAIN}') or 'FreeNAS'
sh(
"env PYTHONPATH=${tooldir}/usr/local/lib",
"${tooldir}/usr/local/bin/create_manifest",
"-P ${pkgdir}/Packages",
"-S ${sequence}",
"-o ${pkgdir}/${PRODUCT}-${sequence}",
"-R ${PRODUCT}-${VERSION}",
"-T ${train}",
"-t ${date}",
*pkgs
)
sh('ln -sf ${PRODUCT}-${sequence} ${pkgdir}/${PRODUCT}-MANIFEST')
if __name__ == '__main__':
if e('${SKIP_PACKAGES}'):
info('Skipping build of following packages: ${SKIP_PACKAGES}')
read_repo_manifest()
build_pkgtools()
build_packages()
create_manifest()

164
build/tools/build-ports.py Executable file
View File

@@ -0,0 +1,164 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
import sys
import string
from dsl import load_file
from utils import sh, sh_str, env, e, objdir, pathjoin, setfile, setup_env, template, debug, error, on_abort, info
makejobs = 1
jailname = None
dsl = load_file('${BUILD_CONFIG}/ports.pyd', os.environ)
installer_dsl = load_file('${BUILD_CONFIG}/ports-installer.pyd', os.environ)
reposconf = load_file('${BUILD_CONFIG}/repos.pyd', os.environ)
jailconf = load_file('${BUILD_CONFIG}/jail.pyd', os.environ)
conf = load_file('${BUILD_CONFIG}/config.pyd', os.environ)
portslist = e('${POUDRIERE_ROOT}/etc/ports.conf')
portoptions = e('${POUDRIERE_ROOT}/etc/poudriere.d/options')
def calculate_make_jobs():
global makejobs
jobs = sh_str('sysctl -n kern.smp.cpus')
if not jobs:
makejobs = 2
makejobs = int(jobs) + 1
debug('Using {0} make jobs', makejobs)
def create_poudriere_config():
setfile('${POUDRIERE_ROOT}/etc/poudriere.conf', template('${BUILD_CONFIG}/templates/poudriere.conf', {
'ports_repo': reposconf['repository']['ports']['path'],
'ports_branch': reposconf['repository']['ports']['branch'],
'ports_distfiles_cache': e('${OBJDIR}/ports/distfiles')
}))
tree = e('${POUDRIERE_ROOT}/etc/poudriere.d/ports/p')
sh('mkdir -p', tree)
setfile(pathjoin(tree, 'mnt'), e('${PORTS_OVERLAY}'))
setfile(pathjoin(tree, 'method'), 'git')
def create_make_conf():
makeconf = e('${POUDRIERE_ROOT}/etc/poudriere.d/make.conf')
setfile(makeconf, template('${BUILD_CONFIG}/templates/poudriere-make.conf'))
def create_ports_list():
info('Creating ports list')
sh('rm -rf', portoptions)
f = open(portslist, 'w')
for port in installer_dsl['port'].values() + dsl['port'].values():
port_und = port['name'].replace('/', '_')
options_path = pathjoin(portoptions, port_und)
f.write('{0}\n'.format(port['name']))
sh('mkdir -p', options_path)
if 'options' in port:
opt = open(pathjoin(options_path, 'options'), 'w')
for o in port['options']:
opt.write('{0}\n'.format(o))
opt.close()
f.close()
def obtain_jail_name():
global jailname
for i in string.ascii_lowercase:
if sh('jls -q -n -j j${i}-p', log="/dev/null", nofail=True) != 0:
jailname = e('j${i}')
return
error('No jail names available')
def prepare_jail():
basepath = e('${POUDRIERE_ROOT}/etc/poudriere.d/jails/${jailname}')
sh('mkdir -p ${basepath}')
setfile(e('${basepath}/method'), 'git')
setfile(e('${basepath}/mnt'), e('${JAIL_DESTDIR}'))
setfile(e('${basepath}/version'), e('${FREEBSD_RELEASE_VERSION}'))
setfile(e('${basepath}/arch'), e('${BUILD_ARCH}'))
sh("jail -U root -c name=${jailname} path=${JAIL_DESTDIR} command=/sbin/ldconfig -m /lib /usr/lib /usr/lib/compat")
def merge_freenas_ports():
sh('mkdir -p ${PORTS_OVERLAY}/freenas')
sh('cp -a ${BUILD_ROOT}/nas_ports/freenas ${PORTS_OVERLAY}/')
def prepare_env():
for cmd in jailconf.get('copy', []).values():
dest = os.path.join(e('${JAIL_DESTDIR}'), cmd['dest'][1:])
sh('rm -rf ${dest}')
sh('cp -a', cmd['source'], dest)
for cmd in jailconf.get('link', []).values():
flags = '-o {0}'.format(cmd['flags']) if 'flags' in cmd else ''
dest = os.path.join(e('${JAIL_DESTDIR}'), cmd['dest'][1:])
sh('mkdir -p', os.path.dirname(dest))
sh('mount -t nullfs', flags, cmd['source'], dest)
def cleanup_env():
sh('rm -rf ${PORTS_OVERLAY}/freenas')
for cmd in jailconf.get('link', []).values():
sh('umount', cmd['source'])
def run():
sh('poudriere -e ${POUDRIERE_ROOT}/etc bulk -w -J', str(makejobs), '-f', portslist, '-j ${jailname} -p p')
if __name__ == '__main__':
if env('SKIP_PORTS'):
info('Skipping ports build as instructed by setting SKIP_PORTS')
sys.exit(0)
obtain_jail_name()
on_abort(cleanup_env)
calculate_make_jobs()
create_poudriere_config()
create_make_conf()
create_ports_list()
prepare_jail()
merge_freenas_ports()
prepare_env()
run()
cleanup_env()

31
build/tools/build-sdk.py Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
if __name__ == '__main__':
pass

43
build/tools/buildenv.py Executable file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
import sys
from utils import e, info, error, setup_env
def main():
setup_env()
os.execlp(sys.argv[1], *sys.argv[1:])
if __name__ == '__main__':
if len(sys.argv) < 2:
error('Usage: buildenv.py <prog> <args...>')
main()

65
build/tools/check-host.py Executable file
View File

@@ -0,0 +1,65 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
import sys
from utils import e, info, debug, error, sh
def check_build_sanity():
if len(e('${BUILD_ROOT}')) > 38:
error("Current path too long ({0} characters) for nullfs mounts during build", len(os.getcwd()))
def check_port(name, port):
debug('Checking for "{0}" command', name)
for i in e('${PATH}').split(':'):
if os.path.exists(e('${i}/${name}')):
return
error('Command {0} not found. Please run "pkg install {1}" or install from ports', name, port)
def check_build_tools():
check_port('git', 'devel/git')
check_port('pxz', 'archivers/pxz')
check_port('xz', 'archivers/xz')
check_port('python', 'lang/python')
check_port('python2', 'lang/python2')
check_port('poudriere', 'ports-mgmt/poudriere-devel')
check_port('grub-mkrescue', 'sysutils/grub2-pcbsd')
check_port('xorriso', 'sysutils/xorriso')
check_port('npm', 'www/npm')
check_port('gmake', 'devel/gmake')
if __name__ == '__main__':
info('Checking build environment...')
check_build_sanity()
check_build_tools()
info('Build environment is OK')

50
build/tools/check-sandbox.py Executable file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
from dsl import load_file
from utils import sh, sh_str, info, debug, error, setup_env, e
dsl = load_file('${BUILD_CONFIG}/repos.pyd', os.environ)
def check_sandbox():
if not os.path.exists(e('${BUILD_ROOT}/FreeBSD/.pulled')):
error('Sandbox is not fully checked out')
for i in dsl['repository'].values():
if not os.path.isdir(os.path.join(e('${BUILD_ROOT}'), i['path'], '.git')):
error('Sandbox is not fully checked out, {0} is missing', i['name'])
info('Sandbox is fully checked out')
if __name__ == '__main__':
debug('Checking sandbox')
check_sandbox()

69
build/tools/checkout.py Executable file
View File

@@ -0,0 +1,69 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
from dsl import load_file
from utils import sh, sh_str, info, debug, e, setfile, appendfile
dsl = load_file('${BUILD_CONFIG}/repos.pyd', os.environ)
manifest = {sh_str("git config --get remote.origin.url"): sh_str("git rev-parse --short HEAD")}
def checkout_repo(repo):
os.chdir(e('${BUILD_ROOT}'))
if os.path.isdir(os.path.join(repo['path'], '.git')):
os.chdir(repo['path'])
branch = sh_str('git rev-parse --abbrev-ref HEAD')
if branch != repo['branch']:
sh('git remote set-url origin', repo['url'])
sh('git fetch origin')
sh('git checkout', repo['branch'])
sh('git pull --rebase')
else:
sh('git clone', '-b', repo['branch'], repo['url'], repo['path'])
os.chdir(repo['path'])
manifest[repo['url']] = sh_str("git rev-parse --short HEAD")
def generate_manifest():
for k, v in manifest.items():
appendfile('${BUILD_ROOT}/FreeBSD/repo-manifest', e('${k} ${v}'))
if __name__ == '__main__':
for i in dsl['repository'].values():
info('Checkout: {0} -> {1}', i['name'], i['path'])
debug('Repository URL: {0}', i['url'])
debug('Local branch: {0}', i['branch'])
checkout_repo(i)
generate_manifest()
setfile('${BUILD_ROOT}/FreeBSD/.pulled', e('${PRODUCT}'))

View File

@@ -0,0 +1,40 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
from utils import sh, info
def main():
sh('umount -f ${PORTS_OVERLAY}')
sh('rm -rf ${PORTS_OVERLAY}')
if __name__ == '__main__':
info('Removing ports overlay')
main()

View File

@@ -0,0 +1,61 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
from dsl import load_file
from utils import sh, info, objdir, e, chroot, setup_env, setfile, sha256, template
dsl = load_file("${BUILD_CONFIG}/config.pyd", os.environ)
output = objdir("${NAME}.GUI_Upgrade")
def main():
sh("tar -c -p -f ${OBJDIR}/gui-boot.tar -C ${OBJDIR}/iso ./boot")
sh("tar -c -p -f ${OBJDIR}/gui-install-environment.tar -C ${OBJDIR}/instufs .")
sh(
"tar -c -p -f ${OBJDIR}/gui-packages.tar",
"-s '@^Packages@FreeNAS/Packages@'",
"-C ${OBJDIR}/packages ."
)
sh(
"tar -c -p -f ${output}.tar",
"-C ${INSTUFS_DESTDIR}/etc/avatar.conf",
"-C ${SRC_ROOT}/freenas-installer .",
"-C ${SRC_ROOT}/freenas-gui-upgrade .",
"-C ${OBJDIR} gui-boot.tar gui-install-environment.tar gui-packages.tar"
)
sh("${XZ} ${PXZ_ACCEL} -9 -z -v ${output}.tar")
sh("mv ${output}.tar.xz ${output}.txz")
sha256("${output}.txz")
if __name__ == "__main__":
info("Creating GUI upgrade image")
main()

355
build/tools/create-iso.py Executable file
View File

@@ -0,0 +1,355 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
from dsl import load_file
from utils import sh, info, objdir, e, chroot, glob, setup_env, setfile, template, sha256, import_function
dsl = load_file('${BUILD_CONFIG}/config.pyd', os.environ)
ports = load_file('${BUILD_CONFIG}/ports-installer.pyd', os.environ)
installworld = import_function('build-os', 'installworld')
installkernel = import_function('build-os', 'installkernel')
installworldlog = objdir('logs/iso-installworld')
installkernellog = objdir('logs/iso-installkernel')
distributionlog = objdir('logs/iso-distribution')
sysinstalllog = objdir('logs/iso-sysinstall')
imgfile = objdir('base.ufs')
output = objdir('${NAME}.iso')
purge_dirs = [
'/bin',
'/sbin',
'/usr/bin',
'/usr/sbin'
]
files_to_preserve = [
'/bin/sleep',
'/usr/bin/dialog',
'/usr/bin/dirname',
'/usr/bin/awk',
'/usr/bin/cut',
'/usr/bin/cmp',
'/usr/bin/find',
'/usr/bin/grep',
'/usr/bin/logger',
'/usr/bin/mkfifo',
'/usr/bin/mktemp',
'/usr/bin/sed',
'/usr/bin/sort',
'/usr/bin/tr',
'/usr/bin/uname',
'/usr/bin/xargs',
'/usr/sbin/diskinfo',
'/usr/sbin/vidcontrol'
'/sbin/geom',
'/bin/install_worker.sh',
'/bin/install_worker2.sh'
]
symlinks = {
'[': '/bin/[',
'badsect': '/sbin/badsect',
'bsdlabel': '/sbin/bsdlabel',
'bunzip2': '/usr/bin/bunzip2',
'bzcat': '/usr/bin/bzcat',
'bzip2': '/usr/bin/bzip2',
'camcontrol': '/sbin/camcontrol',
'cat': '/bin/cat',
'ccdconfig': '/sbin/ccdconfig',
'chflags': '/bin/chflags',
'chgrp': '/usr/bin/chgrp',
'chio': '/bin/chio',
'chmod': '/bin/chmod',
'chown': '/usr/sbin/chown',
'chroot': '/usr/sbin/chroot',
'clri': '/sbin/clri',
'cp': '/bin/cp',
'csh': '/bin/csh',
'date': '/bin/date',
'dd': '/bin/dd',
'devfs': '/sbin/devfs',
'df': '/bin/df',
'dhclient': '/sbin/dhclient',
'dhclient-script': '/sbin/dhclient-script',
'disklabel': '/sbin/disklabel',
'dmesg': '/sbin/dmesg',
'dump': '/sbin/dump',
'dumpfs': '/sbin/dumpfs',
'dumpon': '/sbin/dumpon',
'echo': '/bin/echo',
'ed': '/bin/ed',
'ex': '/usr/bin/ex',
'expr': '/bin/expr',
'fastboot': '/sbin/fastboot',
'fasthalt': '/sbin/fasthalt',
'fdisk': '/sbin/fdisk',
'fsck': '/sbin/fsck',
'fsck_4.2bsd': '/sbin/fsck_4.2bsd',
'fsck_ffs': '/sbin/fsck_ffs',
'fsck_msdosfs': '/sbin/fsck_msdosfs',
'fsck_ufs': '/sbin/fsck_ufs',
'fsdb': '/sbin/fsdb',
'fsirand': '/sbin/fsirand',
'gbde': '/sbin/gbde',
'getfacl': '/bin/getfacl',
'groups': '/usr/bin/groups',
'gunzip': '/usr/bin/gunzip',
'gzcat': '/usr/bin/gzcat',
'gzip': '/usr/bin/gzip',
'halt': '/sbin/halt',
'head': '/usr/bin/head',
'hostname': '/bin/hostname',
'id': '/usr/bin/id',
'ifconfig': '/sbin/ifconfig',
'init': '/sbin/init',
'kenv': '/bin/kenv',
'kill': '/bin/kill',
'kldconfig': '/sbin/kldconfig',
'kldload': '/sbin/kldload',
'kldstat': '/sbin/kldstat',
'kldunload': '/sbin/kldunload',
'ldconfig': '/sbin/ldconfig',
'less': '/usr/bin/less',
'link': '/bin/link',
'ln': '/bin/ln',
'ls': '/bin/ls',
'lzcat': '/usr/bin/lzcat',
'lzma': '/usr/bin/lzma',
'md5': '/sbin/md5',
'mdconfig': '/sbin/mdconfig',
'mdmfs': '/sbin/mdmfs',
'mkdir': '/bin/mkdir',
'mknod': '/sbin/mknod',
'more': '/usr/bin/more',
'mount': '/sbin/mount',
'mount_cd9660': '/sbin/mount_cd9660',
'mount_msdosfs': '/sbin/mount_msdosfs',
'mount_nfs': '/sbin/mount_nfs',
'mount_nullfs': '/sbin/mount_nullfs',
'mount_udf': '/sbin/mount_udf',
'mount_unionfs': '/sbin/mount_unionfs',
'mt': '/usr/bin/mt',
'mv': '/bin/mv',
'nc': '/usr/bin/nc',
'newfs': '/sbin/newfs',
'newfs_msdos': '/sbin/newfs_msdos',
'nextboot': '/sbin/nextboot',
'nos-tun': '/sbin/nos-tun',
'pc-sysinstall': '/usr/sbin/pc-sysinstall',
'pgrep': '/bin/pgrep',
'ping': '/sbin/ping',
'ping6': '/sbin/ping6',
'pkill': '/bin/pkill',
'ps': '/bin/ps',
'pwd': '/bin/pwd',
'rcorder': '/sbin/rcorder',
'rdump': '/sbin/rdump',
'realpath': '/bin/realpath',
'reboot': '/sbin/reboot',
'red': '/bin/red',
'restore': '/sbin/restore',
'rm': '/bin/rm',
'rmdir': '/bin/rmdir',
'route': '/sbin/route',
'routed': '/sbin/routed',
'rrestore': '/sbin/rrestore',
'rtquery': '/sbin/rtquery',
'rtsol': '/sbin/rtsol',
'savecore': '/sbin/savecore',
'setfacl': '/bin/setfacl',
'sh': '/bin/sh',
'spppcontrol': '/sbin/spppcontrol',
'stty': '/bin/stty',
'swapon': '/sbin/swapon',
'sync': '/bin/sync',
'sysctl': '/sbin/sysctl',
'tail': '/usr/bin/tail',
'tar': '/usr/bin/tar',
'tcsh': '/bin/tcsh',
'tee': '/usr/bin/tee',
'test': '/bin/test',
'tunefs': '/sbin/tunefs',
'umount': '/sbin/umount',
'unlink': '/bin/unlink',
'unlzma': '/usr/bin/unlzma',
'unxz': '/usr/bin/unxz',
'vi': '/usr/bin/vi',
'whoami': '/usr/bin/whoami',
'xz': '/usr/bin/xz',
'xzcat': '/usr/bin/xzcat',
'zcat': '/usr/bin/zcat',
'zfs': '/sbin/zfs',
'zpool': '/sbin/zpool',
'/bin/pgrep': '/usr/bin/pgrep',
'/bin/pkill': '/usr/bin/pkill',
'/.mount/boot': '/boot'
}
isodir = objdir('isodir')
instufs = objdir('instufs')
def create_iso_dirs():
sh('mkdir -p ${ISO_DESTDIR} ${INSTUFS_DESTDIR}')
sh('mkdir -p ${ISO_DESTDIR}/data')
sh('mkdir -p ${ISO_DESTDIR}/dev')
sh('mkdir -p ${ISO_DESTDIR}/.mount')
sh('mkdir -p ${ISO_DESTDIR}/mnt')
sh('mkdir -p ${ISO_DESTDIR}/tmp')
sh('mkdir -p ${ISO_DESTDIR}/boot/grub')
def create_ufs_dirs():
sh('mkdir -p ${INSTUFS_DESTDIR}/usr/local/pre-install')
sh('mkdir -p ${INSTUFS_DESTDIR}/usr/local/firmware')
sh('mkdir -p ${INSTUFS_DESTDIR}/usr/local/install')
sh('mkdir -p ${INSTUFS_DESTDIR}/usr/local/sbin')
sh('mkdir -p ${INSTUFS_DESTDIR}/.mount')
sh('mkdir -p ${INSTUFS_DESTDIR}/cdrom')
sh('mkdir -p ${INSTUFS_DESTDIR}/conf/default/etc')
sh('mkdir -p ${INSTUFS_DESTDIR}/conf/default/tmp')
sh('mkdir -p ${INSTUFS_DESTDIR}/conf/default/var')
sh('mkdir -p ${INSTUFS_DESTDIR}/tank')
sh('rm -rf ${INSTUFS_DESTDIR}/boot')
def setup_diskless():
sh('touch ${INSTUFS_DESTDIR}/etc/diskless')
sh('cp -a ${INSTUFS_DESTDIR}/etc/ ${INSTUFS_DESTDIR}/conf/default/etc')
sh('cp -a ${INSTUFS_DESTDIR}/var/ ${INSTUFS_DESTDIR}/conf/default/var')
def cleandirs():
info('Cleaning previous build products')
if os.path.isdir(e('${INSTUFS_DESTDIR}')):
sh('chflags -R 0 ${INSTUFS_DESTDIR}')
sh('rm -rf ${INSTUFS_DESTDIR}')
sh('rm -rf ${ISO_DESTDIR}')
def install_ports():
pkgs = ' '.join(ports['port'].keys())
info('Installing packages')
sh('mkdir -p ${INSTUFS_DESTDIR}/usr/local/etc/pkg/repos')
sh('cp ${BUILD_CONFIG}/templates/pkg-repos/local.conf ${INSTUFS_DESTDIR}/usr/local/etc/pkg/repos/')
chroot('${INSTUFS_DESTDIR}', 'env ASSUME_ALWAYS_YES=yes pkg install -r local -f ${pkgs}')
def install_pkgtools():
info('Installing freenas-pkgtools')
sh(
"env MAKEOBJDIRPREFIX=${OBJDIR}",
"make -C ${SRC_ROOT}/freenas-pkgtools obj all install DESTDIR=${INSTUFS_DESTDIR} PREFIX=/usr/local",
)
def mount_packages():
sh('mkdir -p ${INSTUFS_DESTDIR}/usr/ports/packages')
sh('mount -t nullfs ${OBJDIR}/ports/packages/ja-p ${INSTUFS_DESTDIR}/usr/ports/packages')
def umount_packages():
sh('umount ${INSTUFS_DESTDIR}/usr/ports/packages')
def install_files():
info('Copying installer files')
setfile('${INSTUFS_DESTDIR}/etc/avatar.conf', template('${BUILD_CONFIG}/templates/avatar.conf'))
def populate_ufsroot():
info('Populating UFS root')
for i in purge_dirs:
for name in glob('${INSTUFS_DESTDIR}${i}/*'):
name = os.path.basename(name)
if e('${i}/${name}') in files_to_preserve:
continue
sh('chflags -f 0 ${INSTUFS_DESTDIR}${i}/${name}')
sh('rm -f ${INSTUFS_DESTDIR}${i}/${name}')
for k, v in symlinks.items():
p = os.path.join('/rescue', k)
sh('ln -s ${p} ${INSTUFS_DESTDIR}${v}')
def copy_packages():
sh('mkdir -p ${ISO_DESTDIR}/${PRODUCT}')
sh('cp -R ${OBJDIR}/packages/Packages ${ISO_DESTDIR}/${PRODUCT}')
sh('cp ${OBJDIR}/packages/${PRODUCT}-MANIFEST ${ISO_DESTDIR}/')
def clean_ufs_image():
sh('${BUILD_ROOT}/build/customize/remove-bits.py ${INSTUFS_DESTDIR}')
def clean_iso_image():
sh("find ${ISO_DESTDIR}/boot -name '*.symbols' -delete")
def make_ufs_image():
sh('mkdir -p ${ISO_DESTDIR}/data')
sh('makefs -b 10% ${imgfile} ${INSTUFS_DESTDIR}')
sh('mkuzip -o ${ISO_DESTDIR}/data/base.ufs.uzip ${imgfile}')
def make_iso_image():
setfile('${ISO_DESTDIR}/boot/loader.conf', template('${BUILD_CONFIG}/templates/cdrom/loader.conf'))
setfile('${ISO_DESTDIR}/boot/grub/grub.cfg', template('${BUILD_CONFIG}/templates/cdrom/grub.cfg'))
setfile('${ISO_DESTDIR}/.mount.conf', template('${BUILD_CONFIG}/templates/cdrom/mount.conf'))
sh('cp ${WORLD_DESTDIR}/boot/device.hints ${ISO_DESTDIR}/boot/device.hints')
sh('grub-mkrescue -o ${output} ${ISO_DESTDIR} -- -volid ${CDROM_LABEL}')
sha256(output)
if __name__ == '__main__':
info("Creating ISO image")
cleandirs()
installworld(e('${INSTUFS_DESTDIR}'), installworldlog, distributionlog)
installkernel(e('${ISO_DESTDIR}'), installkernellog)
create_ufs_dirs()
mount_packages()
install_ports()
install_pkgtools()
umount_packages()
populate_ufsroot()
install_files()
copy_packages()
clean_ufs_image()
setup_diskless()
clean_iso_image()
create_iso_dirs()
make_ufs_image()
make_iso_image()

View File

@@ -0,0 +1,41 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
from utils import sh, info
def main():
sh('rm -rf ${PORTS_OVERLAY}')
sh('mkdir -p ${PORTS_OVERLAY}')
sh('mount_unionfs -o below ${PORTS_ROOT} ${PORTS_OVERLAY}')
if __name__ == '__main__':
info('Creating ports overlay')
main()

View File

@@ -0,0 +1,105 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
import json
from dsl import load_file
from utils import e, sh, sh_str, readfile, setfile, template, setup_env
dsl = load_file('${BUILD_CONFIG}/release.pyd', os.environ)
url = dsl['url']
def stage_release():
sh('mkdir -p ${RELEASE_STAGEDIR}/${BUILD_ARCH_SHORT}')
for ext in dsl['format']:
path = e('${OBJDIR}/${NAME}.${ext}')
if os.path.exists(path):
sh('mv ${path} ${RELEASE_STAGEDIR}/${BUILD_ARCH_SHORT}/')
sh('mv ${path}.sha256 ${RELEASE_STAGEDIR}/${BUILD_ARCH_SHORT}/')
def get_aux_files_desc():
for name, aux in dsl['aux_file'].items():
yield {
'filename': name,
'hash': sh_str("sha256 -q ${RELEASE_STAGEDIR}/${name}"),
}
def get_image_files_desc():
for ext in dsl['format']:
path = e('${RELEASE_STAGEDIR}/${BUILD_ARCH_SHORT}/${NAME}.${ext}')
filename = os.path.basename(path)
if os.path.exists(path):
yield {
'filename': filename,
'type': ext,
'hash': sh_str("sha256 -q ${path}"),
'url': e("${url}/${filename}")
}
def create_aux_files(dsl, dest):
for name, aux in dsl['aux_file'].items():
if not os.path.exists(aux['source']):
continue
if aux.get('template'):
f = template(aux['source'])
else:
f = readfile(aux['source'])
setfile('${dest}/${name}', f)
def create_json():
version = e('${VERSION}').split('-')[0]
build_type = e('${VERSION}').split('-')[1]
json_file = {
'name': e('${PRODUCT}'),
'version': e('${version}'),
'type': e('${build_type}'),
'date': e('${BUILD_TIMESTAMP}'),
'aux_files': list(get_aux_files_desc()),
'arch': {
e('${BUILD_ARCH}'): list(get_image_files_desc())
}
}
f = open(e("${RELEASE_STAGEDIR}/CHECKSUMS.json"), 'a')
json.dump(json_file, f, indent=4)
f.close()
if __name__ == '__main__':
stage_release()
create_aux_files(dsl, e('${RELEASE_STAGEDIR}'))
create_json()

View File

@@ -0,0 +1,48 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
from dsl import load_file
from utils import e, sh, setup_env, import_function
dsl = load_file('${BUILD_CONFIG}/upgrade.pyd', os.environ)
create_aux_files = import_function('create-release-distribution', 'create_aux_files')
def stage_upgrade():
sh('mkdir -p ${UPGRADE_STAGEDIR}')
sh('cp -R ${OBJDIR}/packages/Packages ${UPGRADE_STAGEDIR}/')
sh('rm -f ${BUILD_ROOT}/objs/LATEST')
sh('ln -sf ${SEQUENCE}-Update ${BUILD_ROOT}/objs/LATEST')
if __name__ == '__main__':
stage_upgrade()
create_aux_files(dsl, e('${UPGRADE_STAGEDIR}'))

46
build/tools/customize.py Executable file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
from dsl import load_file
from utils import sh, glob, objdir, info, setup_env
dsl = load_file('${BUILD_CONFIG}/config.pyd', os.environ)
def main():
for i in dsl['customize_task']:
logfile = objdir('logs/custom-${i}')
sh('${BUILD_ROOT}/build/customize/${i}.py ${WORLD_DESTDIR}', log=logfile)
if __name__ == '__main__':
info('Running customization tasks')
main()
info('Customization done')

40
build/tools/dumpenv.py Executable file
View File

@@ -0,0 +1,40 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
from utils import e, info, setup_env
def main():
info('Build environment:')
for key, value in os.environ.items():
print e('${key}: ${value}')
if __name__ == '__main__':
main()

52
build/tools/install-jail.py Executable file
View File

@@ -0,0 +1,52 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
import sys
from utils import sh, e, setup_env, objdir, info, import_function
installworldlog = objdir('logs/jail-installworld')
distributionlog = objdir('logs/jail-distribution')
installkernellog = objdir('logs/jail-installkernel')
installworld = import_function('build-os', 'installworld')
installkernel = import_function('build-os', 'installkernel')
if __name__ == '__main__':
if e('${SKIP_INSTALL_JAIL}'):
info('Skipping jail installation, as instructed by setting SKIP_INSTALL_JAIL')
sys.exit(0)
if os.path.isdir(e('${WORLD_DESTDIR}')):
sh('chflags -fR 0 ${JAIL_DESTDIR}')
sh('rm -rf ${JAIL_DESTDIR}')
sh('mkdir -p ${JAIL_DESTDIR}')
installworld(e('${JAIL_DESTDIR}'), installworldlog, distributionlog)
installkernel(e('${JAIL_DESTDIR}'), installkernellog)

73
build/tools/install-ports.py Executable file
View File

@@ -0,0 +1,73 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
import sys
import glob
from dsl import load_file
from utils import sh, setup_env, objdir, info, debug, error, setfile, e, on_abort, chroot
dsl = load_file('${BUILD_CONFIG}/ports.pyd', os.environ)
logfile = objdir('logs/pkg-install')
def mount_packages():
sh('mkdir -p ${WORLD_DESTDIR}/usr/ports/packages')
sh('mount -t nullfs ${OBJDIR}/ports/packages/ja-p ${WORLD_DESTDIR}/usr/ports/packages')
def umount_packages():
sh('umount ${WORLD_DESTDIR}/usr/ports/packages')
def create_pkgng_configuration():
sh('mkdir -p ${WORLD_DESTDIR}/usr/local/etc/pkg/repos')
for i in glob.glob(e('${BUILD_CONFIG}/templates/pkg-repos/*')):
fname = os.path.basename(i)
sh(e('cp ${i} ${WORLD_DESTDIR}/usr/local/etc/pkg/repos/${fname}'))
def install_ports():
pkgs = ' '.join(dsl['port'].keys())
chroot('${WORLD_DESTDIR}', 'env ASSUME_ALWAYS_YES=yes pkg install -r local -f ${pkgs}', log=logfile)
if __name__ == '__main__':
if e('${SKIP_PORTS_INSTALL}'):
info('Skipping ports install as instructed by setting SKIP_PORTS_INSTALL')
sys.exit(0)
info('Installing ports')
info('Log file: {0}', logfile)
on_abort(umount_packages)
mount_packages()
create_pkgng_configuration()
install_ports()
umount_packages()

52
build/tools/install-world.py Executable file
View File

@@ -0,0 +1,52 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import sys
import os
from utils import sh, sh_str, e, setup_env, objdir, info, debug, error, import_function
installworldlog = objdir('logs/dest-installworld')
distributionlog = objdir('logs/dest-distribution')
installkernellog = objdir('logs/dest-installkernel')
installworld = import_function('build-os', 'installworld')
installkernel = import_function('build-os', 'installkernel')
if __name__ == '__main__':
if e('${SKIP_INSTALL_WORLD}'):
info('Skipping world installation, as instructed by setting SKIP_INSTALL_WORLD')
sys.exit(0)
if os.path.isdir(e('${WORLD_DESTDIR}')):
sh('chflags -fR 0 ${WORLD_DESTDIR}')
sh('rm -rf ${WORLD_DESTDIR}')
sh('mkdir -p ${WORLD_DESTDIR}')
installworld(e('${WORLD_DESTDIR}'), installworldlog, distributionlog)
installkernel(e('${WORLD_DESTDIR}'), installkernellog)

View File

@@ -0,0 +1,41 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
from dsl import load_file
from utils import e, sh, info, setup_env
def main():
os.chdir(e('${PCBSD_ROOT}'))
sh('./mkports.sh ${PORTS_OVERLAY} ${DISTFILES_CACHE}')
if __name__ == '__main__':
info('Merging PC-BSD ports tree')
main()

47
build/tools/post-to-download.py Executable file
View File

@@ -0,0 +1,47 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
import sys
from utils import sh, sh_str, e, setup_env, info
def main():
user = sh_str('id -un')
if user == 'root':
user = 'jkh'
sh('ssh ${user}@${DOWNLOAD_HOST} rm -rf ${DOWNLOAD_TARGETDIR}')
sh('ssh ${user}@${DOWNLOAD_HOST} mkdir -p ${DOWNLOAD_TARGETDIR}')
sh('scp -pr ${RELEASE_STAGEDIR}/* ${user}@${DOWNLOAD_HOST}:${DOWNLOAD_TARGETDIR}/')
if __name__ == '__main__':
info('Pushing release to download server')
main()

42
build/tools/post-to-storage.py Executable file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
import sys
from utils import sh, sh_str, e, setup_env, info
def main():
name = os.path.basename(e('${RELEASE_STAGEDIR}'))
sh('cp -r ${RELEASE_STAGEDIR} ${IX_INTERNAL_PATH}/${name}')
if __name__ == '__main__':
info('Pushing release to internal storage')
main()

70
build/tools/post-to-upgrade.py Executable file
View File

@@ -0,0 +1,70 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
import sys
import tempfile
from utils import sh, sh_str, e, setup_env, objdir, info, import_function
create_aux_files = import_function('create-release-distribution', 'create_aux_files')
def main():
changelog = e('${CHANGELOG}')
ssh = e('${UPDATE_USER}@${UPDATE_HOST}')
temp_dest = sh_str("ssh ${ssh} mktemp -d /tmp/update-${PRODUCT}-XXXXXXXXX")
temp_changelog = sh_str("ssh ${ssh} mktemp /tmp/changelog-XXXXXXXXX")
sh('scp -r ${BUILD_ROOT}/objs/LATEST/. ${ssh}:${temp_dest}')
if changelog:
if changelog == '-':
print 'Enter changelog, ^D to end:'
changelog = sys.stdin.read()
sh('scp ${changelog} ${ssh}:${temp_changelog}')
sh(
"ssh ${ssh}",
"/usr/local/bin/freenas-release",
"-P ${PRODUCT}",
"-D ${UPDATE_DB}",
"--archive ${UPDATE_DEST}",
"-K ${FREENAS_KEYFILE}",
"-C ${temp_changelog}" if changelog else "",
"add ${temp_dest}"
)
sh("ssh ${ssh} rm -rf ${temp_dest}")
sh("ssh ${ssh} rm -rf ${temp_changelog}")
if __name__ == '__main__':
info('Pushing upgrade packages to update server')
main()

View File

@@ -0,0 +1,48 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
import os
from utils import glob, sh, setup_env
def main():
pkg_paths = []
pkg_names = []
for i in glob('${OBJDIR}/ports/packages/*/All/${package}*.txz'):
pkg_paths.append(i)
pkg_names.append(os.path.basename(i))
pkg_paths = ' '.join(pkg_paths)
pkg_names = ' '.join(pkg_names)
sh('scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${pkg_paths} ${host}:/tmp/')
sh('ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -t ${host} pkg add -f ${pkg_names}')
if __name__ == '__main__':
main()

38
build/tools/summary.py Executable file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env python2.7
#+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#####################################################################
from utils import info
def main():
info('Build completed')
info('Version string: ${PRODUCT} ${VERSION} (${REVISION})')
info('Total time taken: {0}')
if __name__ == '__main__':
pass