diff options
-rwxr-xr-x | build.sh | 5 | ||||
-rwxr-xr-x | build/scripts/build_freebsd.sh | 116 | ||||
-rw-r--r-- | build/scripts/common.subr | 65 | ||||
-rwxr-xr-x | build/scripts/create_core_pkg.sh | 172 | ||||
-rwxr-xr-x | build/scripts/git_checkout.sh | 106 | ||||
-rwxr-xr-x | build/scripts/install_freebsd.sh | 161 | ||||
-rw-r--r-- | src/etc/inc/filter_log.inc | 15 | ||||
-rw-r--r-- | src/etc/inc/interfaces.inc | 24 | ||||
-rw-r--r-- | src/etc/inc/openvpn.inc | 4 | ||||
-rwxr-xr-x | src/etc/rc.carpbackup | 15 | ||||
-rwxr-xr-x | src/etc/rc.carpmaster | 15 | ||||
-rw-r--r-- | src/usr/local/www/css/pfSense-BETA.css | 61 | ||||
-rw-r--r-- | src/usr/local/www/css/pfSense-dark-BETA.css | 63 | ||||
-rw-r--r-- | src/usr/local/www/pkg_mgr_installed.php | 9 | ||||
-rw-r--r-- | src/usr/local/www/status_dhcpv6_leases.php | 15 | ||||
-rw-r--r-- | src/usr/local/www/status_openvpn.php | 2 | ||||
-rw-r--r-- | src/usr/local/www/widgets/widgets/installed_packages.widget.php | 2 | ||||
-rw-r--r-- | tools/builder_common.sh | 198 | ||||
-rw-r--r-- | tools/builder_defaults.sh | 15 | ||||
-rwxr-xr-x | tools/scripts/clean.sh | 33 |
20 files changed, 847 insertions, 249 deletions
@@ -308,6 +308,9 @@ elif [ "$IMAGETYPE" = "all" ]; then _IMAGESTOBUILD="iso nanobsd nanobsd-vga memstick memstickserial" if [ "${TARGET}" = "amd64" ]; then _IMAGESTOBUILD="${_IMAGESTOBUILD} memstickadi" + if [ -n "${_IS_RELEASE}" ]; then + _IMAGESTOBUILD="${_IMAGESTOBUILD} ova" + fi fi else _IMAGESTOBUILD="${IMAGETYPE}" @@ -343,11 +346,9 @@ if [ -z "${_SKIP_REBUILD_PRESTAGE}" ]; then builder_setup # Build world, kernel and install - echo ">>> Building world for ISO... $FREEBSD_BRANCH ..." make_world # Build kernels - echo ">>> Building kernel configs: $BUILD_KERNELS for FreeBSD: $FREEBSD_BRANCH ..." build_all_kernels # Install kernel on installer diff --git a/build/scripts/build_freebsd.sh b/build/scripts/build_freebsd.sh new file mode 100755 index 0000000..e15c920 --- /dev/null +++ b/build/scripts/build_freebsd.sh @@ -0,0 +1,116 @@ +#!/bin/sh +# +# build_freebsd.sh +# +# part of pfSense (https://www.pfsense.org) +# Copyright (c) 2004-2016 Electric Sheep Fencing, LLC +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin + +scripts_path=$(dirname $(realpath $0)) + +if [ ! -f "${scripts_path}/common.subr" ]; then + echo >&2 "ERROR: common.subr is missing" + exit 1 +fi + +. ${scripts_path}/common.subr + +usage() { + cat >&2 <<END +Usage: $(basename $0) -s srcdir [-o objdir] [-h] + +Options: + -s srcdir -- Path to src directory + -o objdir -- Obj directory used to build + -W -- Skip buildworld + -K -- Skip buildkernel + -h -- Show this help and exit + +Environment: + __MAKE_CONF -- Path to make.conf + SRCCONF -- Path to src.conf + SRC_ENV_CONF -- Path to src-env.conf + KERNCONF -- Kernel names + MODULES_OVERRIDE -- List of kernel modules to build + TARGET -- Machine hardware name + TARGET_ARCH -- Machine processor arquitecture name +END + exit 1 +} + +unset skip_world +unset skip_kernel +while getopts s:o:WKh opt; do + case "$opt" in + s) + srcdir=$OPTARG + ;; + o) + objdir=$OPTARG + ;; + W) + skip_world=1 + ;; + K) + skip_kernel=1 + ;; + *) + usage + ;; + esac +done + +# Default obj dir to src/../obj +: ${objdir=$(realpath ${srcdir}/../obj)} + +[ -z "$srcdir" ] \ + && err "source directory is not defined" + +[ -e $srcdir -a ! -d $srcdir ] \ + && err "source path already exists and is not a directory" + +[ -n "$objdir" -a -e $objdir -a ! -d $objdir ] \ + && err "obj path already exists and is not a directory" + +for env_var in __MAKE_CONF SRCCONF SRC_ENV_CONF; do + eval "value=\${$env_var}" + [ -n "${value}" -a ! -f "${value}" ] \ + && err "${env_var} is pointing to a nonexistent file ${value}" +done + +[ ! -f ${srcdir}/sys/sys/param.h ] \ + && err "Source directory is missing sys/sys/param.h" + +ncpu=$(sysctl -n hw.ncpu) +njobs=$((ncpu*2)) +j="-j${njobs}" + +[ -n "${objdir}" ] \ + && export MAKEOBJDIRPREFIX=${objdir} + +[ -z "${skip_world}" ] \ + && run "Building world" \ + "make -C ${srcdir} -s ${j} buildworld" + +if [ -z "${skip_kernel}" ]; then + for kernel in ${KERNCONF:-pfSense}; do + run "Building kernel (${kernel})" \ + "make -C ${srcdir} -s ${j} KERNCONF=${kernel} buildkernel" + done +fi + +exit 0 diff --git a/build/scripts/common.subr b/build/scripts/common.subr new file mode 100644 index 0000000..3ceb468 --- /dev/null +++ b/build/scripts/common.subr @@ -0,0 +1,65 @@ +# +# ex: filetype=sh +# +# common.subr +# +# part of pfSense (https://www.pfsense.org) +# Copyright (c) 2004-2016 Electric Sheep Fencing, LLC +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Obtained from poudriere common.sh +eargs() { + local fname="$1" + shift + case $# in + 0) err "${fname}: No arguments expected" ;; + 1) err "${fname}: 1 argument expected: $1" ;; + *) err "${fname}: $# arguments expected: $*" ;; + esac +} + +err() { + [ $# -eq 1 ] || eargs err msg + local msg="$1" + + echo >&2 "====>> ERROR: $msg" + exit 1 +} + +run() { + [ $# -eq 2 ] || eargs run msg cmd + local msg="$1" + local cmd="$2" + + echo "====>> ${msg}" + ${cmd} 2>&1 + rc=$? + [ $rc -ne 0 ] \ + && err "Execution of '${cmd}' failed (rc = ${rc})" +} + +force_rm() { + [ $# -eq 1 ] || eargs force_rm directory + local directory="$1" + + [ "${directory}" = "/" ] \ + && err "Removing / is not a good idea" + + run "Removing immutable flags from ${directory}" \ + "chflags -R noschg ${directory}" + + run "Removing recursively ${directory}" \ + "rm -rf ${directory}" +} diff --git a/build/scripts/create_core_pkg.sh b/build/scripts/create_core_pkg.sh new file mode 100755 index 0000000..ad1f6c7 --- /dev/null +++ b/build/scripts/create_core_pkg.sh @@ -0,0 +1,172 @@ +#!/bin/sh +# +# create_core_pkg.sh +# +# part of pfSense (https://www.pfsense.org) +# Copyright (c) 2004-2016 Electric Sheep Fencing, LLC +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin + +scripts_path=$(dirname $(realpath $0)) + +if [ ! -f "${scripts_path}/common.subr" ]; then + echo >&2 "ERROR: common.subr is missing" + exit 1 +fi + +. ${scripts_path}/common.subr + +usage() { + cat >&2 <<END +Usage: $(basename $0) -t template -d destdir [-h] + +Options: + -t template -- Path to package template directory + -f flavor -- package flavor + -v version -- package version + -r root -- root directory containing package files + -F filter -- filter pattern to exclude files from plist + -d destdir -- Destination directory to create package + -h -- Show this help and exit + +Environment: + TMPDIR -- Temporary directory (default: /tmp) + PRODUCT_NAME -- Product name (default: pfSense) + PRODUCT_URL -- Product URL (default: https://www.pfsense.org) +END + exit 1 +} + +while getopts t:f:v:r:F:d:h opt; do + case "$opt" in + t) + template=$OPTARG + ;; + f) + flavor=$OPTARG + ;; + v) + version=$OPTARG + ;; + r) + root=$OPTARG + ;; + F) + filter=$OPTARG + ;; + d) + destdir=$OPTARG + ;; + *) + usage + ;; + esac +done + +[ -z "$template" ] \ + && err "template directory is not defined" + +[ -e $template -a ! -d $template ] \ + && err "template path is not a directory" + +[ -z "$destdir" ] \ + && err "destination directory is not defined" + +[ -e $destdir -a ! -d $destdir ] \ + && err "destination path already exists and is not a directory" + +: ${TMPDIR=/tmp} +: ${PRODUCT_NAME=pfSense} +: ${PRODUCT_URL=http://www.pfsense.org/} + +[ -d $destdir ] \ + || mkdir -p ${destdir} + +template_path=$(realpath $(dirname ${template})) +template_name=$(basename ${template}) +template_metadir=${template_path}/metadir +template_licensedir=${template_path}/_license + +[ -d ${template_metadir} ] \ + || err "template directory not found for package ${template_name}" + +scratchdir=$(mktemp -d -q ${TMPDIR:-/tmp}/${template_name}.XXXXXXX) + +[ -n "${scratchdir}" -a -d ${scratchdir} ] \ + || err "error creating temporary directory" + +trap "rm -rf ${scratchdir}" 1 2 15 EXIT + +metadir=${scratchdir}/${template_name}_metadir + +run "Copying metadata for package ${template_name}" \ + "cp -r ${template_metadir} ${metadir}" + +manifest=${metadir}/+MANIFEST +plist=${scratchdir}/${template_name}_plist +exclude_plist=${scratchdir}/${template_name}_exclude_plist + +if [ -f "${template_path}/pkg-plist" ]; then + cp ${template_path}/pkg-plist ${plist} +else + if [ -n "${filter}" ]; then + filter="-name ${filter}" + fi + (cd ${root} \ + && find . ${filter} -type f -or -type l \ + | sed 's,^.,,' \ + | sort -u \ + ) > ${plist} +fi + +if [ -f "${template_path}/exclude_plist" ]; then + cp ${template_path}/exclude_plist ${exclude_plist} +else + touch ${exclude_plist} +fi + +sed \ + -i '' \ + -e "s,%%PRODUCT_NAME%%,${PRODUCT_NAME},g" \ + -e "s,%%PRODUCT_URL%%,${PRODUCT_URL},g" \ + -e "s,%%FLAVOR%%,${flavor:+-}${flavor},g" \ + -e "s,%%FLAVOR_DESC%%,${flavor:+ (${flavor})},g" \ + -e "s,%%VERSION%%,${version},g" \ + ${metadir}/* \ + ${plist} \ + ${exclude_plist} + +if [ -f "${exclude_plist}" ]; then + sort -u ${exclude_plist} > ${plist}.exclude + mv ${plist} ${plist}.tmp + comm -23 ${plist}.tmp ${plist}.exclude > ${plist} + rm -f ${plist}.tmp ${plist}.exclude +fi + +# Add license information +if [ -d "${template_licensedir}" ]; then + portname=$(sed '/^name: /!d; s,^[^"]*",,; s,",,' ${metadir}/+MANIFEST) + licenses_dir="/usr/local/share/licenses/${portname}-${version}" + + mkdir -p ${root}${licenses_dir} + for f in ${template_licensedir}/*; do + cp ${f} ${licenses_dir} + echo "${licenses_dir}/$(basename ${f})" >> ${plist} + done +fi + +run "Creating core package ${template_name}" \ + "pkg create -o ${destdir} -p ${plist} -r ${root} -m ${metadir}" diff --git a/build/scripts/git_checkout.sh b/build/scripts/git_checkout.sh new file mode 100755 index 0000000..10c43ce --- /dev/null +++ b/build/scripts/git_checkout.sh @@ -0,0 +1,106 @@ +#!/bin/sh +# +# git_checkout.sh +# +# part of pfSense (https://www.pfsense.org) +# Copyright (c) 2004-2016 Electric Sheep Fencing, LLC +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin + +scripts_path=$(dirname $(realpath $0)) + +if [ ! -f "${scripts_path}/common.subr" ]; then + echo >&2 "ERROR: common.subr is missing" + exit 1 +fi + +. ${scripts_path}/common.subr + +usage() { + cat >&2 <<END +Usage: $(basename $0) -r repo_url -d destdir [-b branch] [-h] + +Options: + -r repo_url -- URL of desired git repository + -d destdir -- Directory to clone + -b branch -- Branch or tag to clone (default: master) + -h -- Show this help and exit + +Environment: + GIT_BIN -- Path to git binary +END + exit 1 +} + +branch="master" +while getopts r:d:b:h opt; do + case "$opt" in + r) + repo_url=$OPTARG + ;; + d) + destdir=$OPTARG + ;; + b) + branch=$OPTARG + ;; + *) + usage + ;; + esac +done + +[ -z "$repo_url" ] \ + && err "repository URL is not defined" + +[ -z "$destdir" ] \ + && err "destdir is not defined" + +[ -e $destdir -a ! -d $destdir ] \ + && err "destdir already exists and is not a directory" + +git=${GIT_BIN:-$(which git)} +if [ ! -x "${git}" ]; then + err "git binary is missing" +fi + +if [ -d "${destdir}/.git" ]; then + current_url=$(${git} -C ${destdir} config --get remote.origin.url) + + [ "${current_url}" != "${repo_url}" ] \ + && err "destination directory contains a different git " \ + "repository" + + run "Removing local changes from git repo ${repo_url} (${branch})" \ + "${git} -C ${destdir} reset -q --hard" + run "Removing leftovers from git repo ${repo_url} (${branch})" \ + "${git} -C ${destdir} clean -qfd" + run "Retrieving updates from git repo ${repo_url} (${branch})" \ + "${git} -C ${destdir} fetch -q origin" + run "Updating git repo ${repo_url} (${branch})" \ + "git -C ${destdir} checkout -q ${branch}" + + # Detect if it's a branch and rebase it + if ${git} -C ${destdir} show-ref -q --verify refs/heads/${branch}; then + run "Rebasing git repo ${repo_url} (${branch})" \ + "git -C ${destdir} rebase -q origin/${branch}" + fi +else + run "Cloning git repository ${repo_url} (${branch})" \ + "git clone -q -b ${branch} ${repo_url} ${destdir}" +fi + +exit 0 diff --git a/build/scripts/install_freebsd.sh b/build/scripts/install_freebsd.sh new file mode 100755 index 0000000..19b04eb --- /dev/null +++ b/build/scripts/install_freebsd.sh @@ -0,0 +1,161 @@ +#!/bin/sh +# +# install_freebsd.sh +# +# part of pfSense (https://www.pfsense.org) +# Copyright (c) 2004-2016 Electric Sheep Fencing, LLC +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin + +scripts_path=$(dirname $(realpath $0)) + +if [ ! -f "${scripts_path}/common.subr" ]; then + echo >&2 "ERROR: common.subr is missing" + exit 1 +fi + +. ${scripts_path}/common.subr + +usage() { + cat >&2 <<END +Usage: $(basename $0) -s srcdir -d destdir [-o objdir] [-iWKDhz] + +Options: + -s srcdir -- Path to src directory + -d destdir -- Destination directory to install + -o objdir -- Obj directory used to build + -i -- Include BSDInstall + -W -- Skip installworld + -K -- Skip installkernel + -D -- Skip distribution + -h -- Show this help and exit + -z -- gzip kernel + +Environment: + __MAKE_CONF -- Path to make.conf + SRCCONF -- Path to src.conf + SRC_ENV_CONF -- Path to src-env.conf + KERNCONF -- Kernel names + MODULES_OVERRIDE -- List of kernel modules to install + TARGET -- Machine hardware name + TARGET_ARCH -- Machine processor arquitecture name +END + exit 1 +} + +unset with_bsdinstall +unset skip_world +unset skip_kernel +unset skip_distribution +unset gzip_kernel +while getopts s:d:o:iWKDhz opt; do + case "$opt" in + s) + srcdir=$OPTARG + ;; + d) + destdir=$OPTARG + ;; + o) + objdir=$OPTARG + ;; + i) + with_bsdinstall=1 + ;; + W) + skip_world=1 + ;; + K) + skip_kernel=1 + ;; + D) + skip_distribution=1 + ;; + z) + gzip_kernel=1 + ;; + *) + usage + ;; + esac +done + +# Default obj dir to src/../obj +: ${objdir=$(realpath ${srcdir}../obj)} + +[ -z "$srcdir" ] \ + && err "source directory is not defined" + +[ -e $srcdir -a ! -d $srcdir ] \ + && err "source path already exists and is not a directory" + +[ -z "$destdir" ] \ + && err "destination directory is not defined" + +[ -e $destdir -a ! -d $destdir ] \ + && err "destination path already exists and is not a directory" + +[ -n "$objdir" -a -e $objdir -a ! -d $objdir ] \ + && err "obj path already exists and is not a directory" + +for env_var in __MAKE_CONF SRCCONF SRC_ENV_CONF; do + eval "value=\${$env_var}" + [ -n "${value}" -a ! -f "${value}" ] \ + && err "${env_var} is pointing to a nonexistent file ${value}" +done + +[ ! -f ${srcdir}/sys/sys/param.h ] \ + && err "Source directory is missing sys/sys/param.h" + +ncpu=$(sysctl -n hw.ncpu) +njobs=$((ncpu*2)) +j="-j${njobs}" + +[ -n "${objdir}" ] \ + && export MAKEOBJDIRPREFIX=${objdir} + +[ -z "${with_bsdinstall}" ] \ + && export WITHOUT_BSDINSTALL=yes + +[ -d $destdir ] \ + && force_rm ${destdir} + +export DESTDIR=${destdir} + +make_cmd="make -C ${srcdir} -s ${j}" + +[ -z "${skip_world}" ] \ + && run "Installing world" \ + "${make_cmd} installworld" + +if [ -z "${skip_kernel}" ]; then + run "Installing kernel" \ + "${make_cmd} KERNCONF=${KERNCONF:-pfSense} installkernel" + + [ -n "${gzip_kernel}" ] \ + && run "Compressing kernel" \ + "gzip -f9 ${destdir}/boot/kernel/kernel" +fi + +[ -z "${skip_distribution}" ] \ + && run "Installing distribution" \ + "${make_cmd} distribution" + +[ -n "${with_bsdinstall}" ] \ + && run "Copying /etc/rc.local to start bsdinstall" \ + "cp ${srcdir}/release/rc.local ${destdir}/etc" + +exit 0 diff --git a/src/etc/inc/filter_log.inc b/src/etc/inc/filter_log.inc index 4e1fd94..8690ee0 100644 --- a/src/etc/inc/filter_log.inc +++ b/src/etc/inc/filter_log.inc @@ -34,8 +34,9 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = "", $fil return; } + /* Safety belt to ensure we get enough lines for filtering without overloading the parsing code */ if ($filtertext) { - $tail = 5000; + $tail = 10000; } /* Always do a reverse tail, to be sure we're grabbing the 'end' of the log. */ @@ -82,29 +83,29 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = "", $fil # Construct RegEx for specific log file type. - if ($logfile_type == 'firewall') { + if ($logfile_type == 'firewall') { $pattern = "filterlog:"; } - else if ($logfile_type == 'system') { + else if ($logfile_type == 'system') { $pattern = "^" . $date_pattern . "\ +" . $host_pattern . "\ +" . $process_pid_pattern . "\ +" . $log_message_pattern . "$"; } - else if ($logfile_type == 'vpn_login') { + else if ($logfile_type == 'vpn_login') { $action_pattern = "\(.*?\)"; $type_pattern = "\(.*?\)"; $ip_address_pattern = "\(.*?\)"; $user_pattern = "\(.*?\)"; $pattern = "^" . $date_pattern . "\ +" . $host_pattern . "\ +" . $process_pattern . "\ +" . $action_pattern . "\,\ *" . $type_pattern . "\,\ *" . $ip_address_pattern . "\,\ *" . $user_pattern . "$"; } - else if ($logfile_type == 'vpn_service') { + else if ($logfile_type == 'vpn_service') { $type_pattern = "\(.*?\):"; $pid_pattern = "\(?:process\ +\([0-9:]*\)\)?"; $pattern = "^" . $date_pattern . "\ +" . $host_pattern . "\ +" . $type_pattern . "\ +" . $pid_pattern . "\ *" . $log_message_pattern . "$"; } - else if ($logfile_type == 'unknown') { + else if ($logfile_type == 'unknown') { $pattern = "^" . $date_pattern . "\ +" . $log_message_pattern . "$"; } - else { + else { $pattern = "^\(.*\)$"; } diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 76ea359..3c4a1d4 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -1764,8 +1764,8 @@ EOD; /* Omit this, we maintain the default route by other means, and it causes problems with * default gateway switching. See redmine #1837 for original issue - * re-enabling this for now to fix issue with missing default gateway with PPPoE in some - * edge case. redmine #6495 open to address. + * re-enabling this for now to fix issue with missing default gateway with PPPoE in some + * edge case. redmine #6495 open to address. */ if (($interface == "wan" && $founddefaultgw == false) || $setdefaultgw == true) { $setdefaultgw = true; @@ -3028,11 +3028,12 @@ function find_dhcp6c_process($interface) { return intval($pid); } + function kill_dhcp6client_process($interface) { if (empty($interface) || !does_interface_exist($interface)) { return; } - + $i = 0; while ((($pid = find_dhcp6c_process($interface)) != 0) && ($i < 3)) { /* 3rd time make it die for sure */ @@ -3044,7 +3045,6 @@ function kill_dhcp6client_process($interface) { unset($i); } - function interface_virtual_create($interface) { global $config; @@ -3982,7 +3982,7 @@ function interface_dhcpv6_configure($interface = "wan", $wancfg) { $rtsoldscript .= "/usr/local/sbin/dhcp6c {$debugOption} -c {$g['varetc_path']}/dhcp6c_{$interface}.conf -p {$g['varrun_path']}/dhcp6c_{$wanif}.pid {$wanif}\n"; $rtsoldscript .= "/usr/bin/logger -t rtsold \"Starting dhcp6 client for interface {$interface}({$wanif})\"\n"; /* non ipoe Process */ - if (!isset($wancfg['dhcp6withoutra'])) { + if (!isset($wancfg['dhcp6withoutra'])) { $rtsoldscript .= "if [ -f {$g['varrun_path']}/dhcp6c_{$wanif}.pid ]; then\n"; $rtsoldscript .= "\t/bin/pkill -F {$g['varrun_path']}/dhcp6c_{$wanif}.pid\n"; $rtsoldscript .= "\t/bin/sleep 1\n"; @@ -3991,10 +3991,10 @@ function interface_dhcpv6_configure($interface = "wan", $wancfg) { $rtsoldscript .= "\t/bin/sleep 1\n"; } $debugOption = isset($wancfg['dhcp6debug']) ? "-D" : "-d"; - if (!isset($wancfg['dhcp6withoutra'])){ + if (!isset($wancfg['dhcp6withoutra'])) { $rtsoldscript .= "/usr/local/sbin/dhcp6c {$debugOption} -c {$g['varetc_path']}/dhcp6c_{$interface}.conf -p {$g['varrun_path']}/dhcp6c_{$wanif}.pid {$wanif}\n"; $rtsoldscript .= "/usr/bin/logger -t rtsold \"Starting dhcp6 client for interface {$interface}({$wanif})\"\n"; - } + } /* Add wide-dhcp6c shell script here. Because we can not pass a argument to it. */ if (!@file_put_contents("{$g['varetc_path']}/rtsold_{$wanif}_script.sh", $rtsoldscript)) { printf("Error: cannot open rtsold_{$wanif}_script.sh in interface_dhcpv6_configure() for writing.\n"); @@ -4014,11 +4014,11 @@ function interface_dhcpv6_configure($interface = "wan", $wancfg) { sleep(2); } if (isset($wancfg['dhcp6withoutra'])) { - kill_dhcp6client_process($wanif); - - mwexec("/usr/local/sbin/dhcp6c {$debugOption} -x -c {$g['varetc_path']}/dhcp6c_wan.conf -p {$g['varrun_path']}/dhcp6c_{$wanif}.pid {$wanif}"); - mwexec("/usr/bin/logger -t mwtag 'Starting dhcp6 client for interface wan({$wanif} in IPoE mode)'"); - } + kill_dhcp6client_process($wanif); + + mwexec("/usr/local/sbin/dhcp6c {$debugOption} -c {$g['varetc_path']}/dhcp6c_wan.conf -p {$g['varrun_path']}/dhcp6c_{$wanif}.pid {$wanif}"); + mwexec("/usr/bin/logger -t mwtag 'Starting dhcp6 client for interface wan({$wanif} in IPoE mode)'"); + } mwexec("/usr/sbin/rtsold -1 -p {$g['varrun_path']}/rtsold_{$wanif}.pid -O {$g['varetc_path']}/rtsold_{$wanif}_script.sh {$wanif}"); /* NOTE: will be called from rtsold invoked script diff --git a/src/etc/inc/openvpn.inc b/src/etc/inc/openvpn.inc index f9093eb..91dc59e 100644 --- a/src/etc/inc/openvpn.inc +++ b/src/etc/inc/openvpn.inc @@ -1100,8 +1100,8 @@ function openvpn_restart($mode, $settings) { return; } - /* Do not start a client if we are a CARP backup on this vip! */ - if (($mode == "client") && (strstr($settings['interface'], "_vip") && get_carp_interface_status($settings['interface']) != "MASTER")) { + /* Do not start an instance if we are not CARP master on this vip! */ + if (strstr($settings['interface'], "_vip") && get_carp_interface_status($settings['interface']) != "MASTER") { return; } diff --git a/src/etc/rc.carpbackup b/src/etc/rc.carpbackup index a1b3a8e..b537411 100755 --- a/src/etc/rc.carpbackup +++ b/src/etc/rc.carpbackup @@ -81,9 +81,20 @@ if (is_array($config['openvpn']) && is_array($config['openvpn']['openvpn-client' if (is_array($config['openvpn']) && is_array($config['openvpn']['openvpn-server'])) { foreach ($config['openvpn']['openvpn-server'] as $settings) { + if (substr($settings['interface'], 0, 4) == '_vip') { + $openvpn_vip = $settings['interface']; + } else if (is_array($a_groups[$settings['interface']])) { + // interface is a gateway group, check CARP VIP + if (substr($a_groups[$settings['interface']][0]['vip'], 0, 4) == '_vip') { + $openvpn_vip = $a_groups[$settings['interface']][0]['vip']; + } + } else { + // this OpenVPN instance not on a CARP IP + continue; + } foreach ($vips as $vip) { - if ($settings['interface'] == "_vip{$vip['uniqid']}") { - log_error("Stopping OpenVPN instance on {$friendly_descr} because of transition to CARP backup."); + if ($openvpn_vip == "_vip{$vip['uniqid']}") { + log_error("Stopping OpenVPN server instance on {$friendly_descr} because of transition to CARP backup."); openvpn_restart('server', $settings); } } diff --git a/src/etc/rc.carpmaster b/src/etc/rc.carpmaster index 0b355cc..d536948 100755 --- a/src/etc/rc.carpmaster +++ b/src/etc/rc.carpmaster @@ -80,9 +80,20 @@ if (is_array($config['openvpn']) && is_array($config['openvpn']['openvpn-client' } if (is_array($config['openvpn']) && is_array($config['openvpn']['openvpn-server'])) { foreach ($config['openvpn']['openvpn-server'] as $settings) { + if (substr($settings['interface'], 0, 4) == '_vip') { + $openvpn_vip = $settings['interface']; + } else if (is_array($a_groups[$settings['interface']])) { + // interface is a gateway group, check CARP VIP + if (substr($a_groups[$settings['interface']][0]['vip'], 0, 4) == '_vip') { + $openvpn_vip = $a_groups[$settings['interface']][0]['vip']; + } + } else { + // this OpenVPN instance not on a CARP IP + continue; + } foreach ($vips as $vip) { - if ($settings['interface'] == "_vip{$vip['uniqid']}") { - log_error("Starting OpenVPN instance on {$friendly_descr} because of transition to CARP master."); + if ($openvpn_vip == "_vip{$vip['uniqid']}") { + log_error("Starting OpenVPN server instance on {$friendly_descr} because of transition to CARP master."); openvpn_restart('server', $settings); } } diff --git a/src/usr/local/www/css/pfSense-BETA.css b/src/usr/local/www/css/pfSense-BETA.css index 9805256..49f2dd5 100644 --- a/src/usr/local/www/css/pfSense-BETA.css +++ b/src/usr/local/www/css/pfSense-BETA.css @@ -22,14 +22,61 @@ /*** Experimental Changes Go Here ***/ -.panel-heading a:link, .panel-heading a:visited { - color: #404040; - text-decoration: underline; +body { + font-size: 12px; } -.panel-default>.panel-heading { - color: #404040; - background-color: #cccccc; - letter-spacing: 1px; +.navbar-nav { + padding: 5px 5px 0px 5px; } +table[data-sortable].sortable-theme-bootstrap { + font-size: 12px; +} + +.table>tbody>tr>td { + padding: 4px 4px 4px 10px; +} + +.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th { + padding: 4px 5px; +} + +a.fa, i.fa { + font-size: 14px; +} + +.breadcrumb { + padding: 8px 15px; + margin-bottom: 16px; + font-size: 18px; +} + +.nav>li>a { + padding: 10px 15px 10px 15px; +} + +.nav-pills { + margin-bottom: 16px; +} + +.dropdown-menu>li>a { + padding: 3px 20px; +} + +.panel-title { + font-size: 14px; +} + +.form-group { + padding: 5px 5px 5px 5px; +} + +.icon-embed-btn { + padding-right: 16px; + padding-bottom: 13px; +} + +.panel-heading { + padding: 5px 10px; +}
\ No newline at end of file diff --git a/src/usr/local/www/css/pfSense-dark-BETA.css b/src/usr/local/www/css/pfSense-dark-BETA.css index 8455799..c227213 100644 --- a/src/usr/local/www/css/pfSense-dark-BETA.css +++ b/src/usr/local/www/css/pfSense-dark-BETA.css @@ -21,3 +21,66 @@ @import url("/css/pfSense-dark.css"); /*** Experimental Changes Go Here ***/ + +body { + font-size: 12px; +} + +.navbar-nav { + padding: 5px 5px 0px 5px; +} + +table[data-sortable].sortable-theme-bootstrap { + font-size: 12px; +} + +.table>tbody>tr>td { + padding: 4px 4px 4px 10px; +} + +.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th { + padding: 4px 5px; +} + +a.fa, i.fa { + font-size: 14px; +} + +.breadcrumb { + padding: 8px 15px; + margin-bottom: 16px; + font-size: 18px; +} + +.nav>li>a { + padding: 10px 15px 10px 15px; +} + +.nav-pills { + margin-bottom: 16px; +} + +.dropdown-menu>li>a { + padding: 3px 20px; +} + +.panel-title { + font-size: 14px; +} + +.form-group { + padding: 5px 5px 5px 5px; +} + +.text-danger { + color: #F44336; +} + +.icon-embed-btn { + padding-right: 16px; + padding-bottom: 13px; +} + +.panel-heading { + padding: 5px 10px; +}
\ No newline at end of file diff --git a/src/usr/local/www/pkg_mgr_installed.php b/src/usr/local/www/pkg_mgr_installed.php index 33e75ef..8c862ad 100644 --- a/src/usr/local/www/pkg_mgr_installed.php +++ b/src/usr/local/www/pkg_mgr_installed.php @@ -67,8 +67,6 @@ function get_pkg_table() { exit; } - $pkgtbl .=' <div class="panel panel-default">'; - $pkgtbl .=' <div class="panel-heading"><h2 class="panel-title">' . gettext('Installed Packages') . '</h2></div>'; $pkgtbl .=' <div class="table-responsive">'; $pkgtbl .=' <table class="table table-striped table-hover table-condensed">'; $pkgtbl .=' <thead>'; @@ -162,7 +160,6 @@ function get_pkg_table() { } $pkgtbl .=' </td>'; $pkgtbl .=' <td>'; - $pkgtbl .=' <div class="row">'; $pkgtbl .=' <a title="' . sprintf(gettext("Remove package %s"), $pkg['name']) . '" href="pkg_mgr_install.php?mode=delete&pkg=' . $pkg['name'] . '" class="fa fa-trash"></a>'; @@ -178,7 +175,6 @@ function get_pkg_table() { $pkgtbl .=' <a target="_blank" title="' . gettext("View more information") . '" href="' . htmlspecialchars($pkg['www']) . '" class="fa fa-info"></a>'; } - $pkgtbl .=' </div>'; $pkgtbl .=' </td>'; $pkgtbl .=' </tr>'; } @@ -200,7 +196,6 @@ function get_pkg_table() { $pkgtbl .=' </p>'; $pkgtbl .=' <p><span class="text-warning">' . gettext("Newer version available") . '</span></p>'; $pkgtbl .=' <p><span class="text-danger">' . gettext("Package is configured but not (fully) installed") . '</span></p>'; - $pkgtbl .=' </div>'; return $pkgtbl; } @@ -216,8 +211,8 @@ display_top_tabs($tab_array); ?> <div class="panel panel-default"> - <div class="panel-heading"><h2 class="panel-title"><?=gettext('Packages')?></h2></div> - <div id="pkgtbl" class="panel-body table-responsive"> + <div class="panel-heading"><h2 class="panel-title"><?=gettext('Installed Packages')?></h2></div> + <div id="pkgtbl" class="panel-body"> <div id="waitmsg"> <?php print_info_box(gettext("Please wait while the list of packages is retrieved and formatted.") . ' <i class="fa fa-cog fa-spin"></i>'); ?> </div> diff --git a/src/usr/local/www/status_dhcpv6_leases.php b/src/usr/local/www/status_dhcpv6_leases.php index c85edd6..e6fa0ed 100644 --- a/src/usr/local/www/status_dhcpv6_leases.php +++ b/src/usr/local/www/status_dhcpv6_leases.php @@ -97,17 +97,14 @@ function adjust_gmt($dt) { } } - $timezone = $config['system']['timezone']; - $ts = strtotime($dt . " GMT"); if ($dhcpv6leaseinlocaltime == "yes") { - $this_tz = new DateTimeZone($timezone); - $dhcp_lt = new DateTime(strftime("%I:%M:%S%p", $ts), $this_tz); - $offset = $this_tz->getOffset($dhcp_lt); - $ts = $ts + $offset; - return strftime("%Y/%m/%d %I:%M:%S%p", $ts); - } else { - return strftime("%Y/%m/%d %H:%M:%S", $ts); + $ts = strtotime($dt . " GMT"); + if ($ts !== false) { + return strftime("%Y/%m/%d %I:%M:%S%p", $ts); + } } + /* If we did not need to convert to local time or the conversion failed, just return the input. */ + return $dt; } function remove_duplicate($array, $field) { diff --git a/src/usr/local/www/status_openvpn.php b/src/usr/local/www/status_openvpn.php index dc8058f..0ff285f 100644 --- a/src/usr/local/www/status_openvpn.php +++ b/src/usr/local/www/status_openvpn.php @@ -82,7 +82,7 @@ include("head.inc"); ?> return; } - $('tr[name="r:' + values[1] + ":" + values[2] + '"]').each( + $('tr[id="r:' + values[1] + ":" + values[2] + '"]').each( function(index,row) { $(row).fadeOut(1000); } ); } diff --git a/src/usr/local/www/widgets/widgets/installed_packages.widget.php b/src/usr/local/www/widgets/widgets/installed_packages.widget.php index 8958345..38c45ce 100644 --- a/src/usr/local/www/widgets/widgets/installed_packages.widget.php +++ b/src/usr/local/www/widgets/widgets/installed_packages.widget.php @@ -48,7 +48,6 @@ if ($_REQUEST && $_REQUEST['ajax']) { print("<thead>\n"); print( "<tr>\n"); print( "<th>" . gettext("Name") . "</th>\n"); - print( "<th>" . gettext("Category") . "</th>\n"); print( "<th>" . gettext("Version") . "</th>\n"); print( "<th>" . gettext("Actions") . "</th>\n"); print( "</tr>\n"); @@ -100,7 +99,6 @@ if ($_REQUEST && $_REQUEST['ajax']) { print("<tr>\n"); print( '<td><span class="' . $txtcolor . '">' . $pkg['shortname'] . "</span></td>\n"); - print( "<td>" . implode(' ', $pkg['categories']) . "</td>\n"); print( "<td>\n"); print( '<i title="' . $status . '" class="fa fa-' . $statusicon . '"></i> '); diff --git a/tools/builder_common.sh b/tools/builder_common.sh index 3890d0d..50ef95c 100644 --- a/tools/builder_common.sh +++ b/tools/builder_common.sh @@ -84,87 +84,16 @@ core_pkg_create() { local _root="${4}" local _filter="${5}" - [ -d "${CORE_PKG_TMP}" ] \ - && rm -rf ${CORE_PKG_TMP} - - local _templates_path=${BUILDER_TOOLS}/templates/core_pkg/${_template} - local _template_metadir=${_templates_path}/metadir - local _metadir=${CORE_PKG_TMP}/${_template}_metadir - - if [ ! -d ${_template_metadir} ]; then - echo "ERROR: Template dir not found for pkg ${_template}" - exit - fi - - mkdir -p ${CORE_PKG_TMP} - - cp -r ${_template_metadir} ${_metadir} - - local _manifest=${_metadir}/+MANIFEST - local _plist=${CORE_PKG_TMP}/${_template}_plist - local _exclude_plist=${CORE_PKG_TMP}/${_template}_exclude_plist - - if [ -f "${_templates_path}/pkg-plist" ]; then - cp ${_templates_path}/pkg-plist ${_plist} - else - if [ -n "${_filter}" ]; then - _filter="-name ${_filter}" - fi - (cd ${_root} && find . ${_filter} -type f -or -type l | sed 's,^.,,' | sort -u) > ${_plist} - fi - - if [ -f "${_templates_path}/exclude_plist" ]; then - cp ${_templates_path}/exclude_plist ${_exclude_plist} - else - touch ${_exclude_plist} - fi - - sed \ - -i '' \ - -e "s,%%PRODUCT_NAME%%,${PRODUCT_NAME},g" \ - -e "s,%%PRODUCT_URL%%,${PRODUCT_URL},g" \ - -e "s,%%FLAVOR%%,${_flavor:+-}${_flavor},g" \ - -e "s,%%FLAVOR_DESC%%,${_flavor:+ (${_flavor})},g" \ - -e "s,%%VERSION%%,${_version},g" \ - ${_metadir}/* \ - ${_plist} \ - ${exclude_plist} - - if [ -f "${_exclude_plist}" ]; then - sort -u ${_exclude_plist} > ${_plist}.exclude - mv ${_plist} ${_plist}.tmp - comm -23 ${_plist}.tmp ${_plist}.exclude > ${_plist} - rm -f ${_plist}.tmp ${plist}.exclude - fi - - # Add license information - local _portname=$(sed '/^name: /!d; s,^[^"]*",,; s,",,' ${_metadir}/+MANIFEST) - local _licenses_dir="/usr/local/share/licenses/${_portname}-${_version}" - mkdir -p ${_root}${_licenses_dir} - cp ${BUILDER_ROOT}/LICENSE ${_root}${_licenses_dir}/APACHE20 - echo "This package has a single license: APACHE20 (Apache License 2.0)." \ - > ${_root}${_licenses_dir}/LICENSE - cat <<EOF >${_root}${_licenses_dir}/catalog.mk -_LICENSE=APACHE20 -_LICENSE_NAME=Apache License 2.0 -_LICENSE_PERMS=dist-mirror dist-sell pkg-mirror pkg-sell auto-accept -_LICENSE_GROUPS=FSF OSI -_LICENSE_DISTFILES= -EOF - cat <<EOF >>${_plist} -${_licenses_dir}/catalog.mk -${_licenses_dir}/LICENSE -${_licenses_dir}/APACHE20 -EOF - - mkdir -p ${CORE_PKG_REAL_PATH}/All - if ! pkg create -o ${CORE_PKG_REAL_PATH}/All -p ${_plist} -r ${_root} -m ${_metadir}; then - echo ">>> ERROR: Error building package ${_template} ${_flavor}" - print_error_pfS - fi - - # Cleanup _licenses_dir - rm -rf ${_root}${_licenses_dir} + local _template_path=${BUILDER_TOOLS}/templates/core_pkg/${_template} + + ${BUILDER_SCRIPTS}/create_core_pkg.sh \ + -t "${_template_path}" \ + -f "${_flavor}" \ + -v "${_version}" \ + -r "${_root}" \ + -F "${_filter}" \ + -d "${CORE_PKG_REAL_PATH}/All" \ + || print_error_pfS } # This routine will output that something went wrong @@ -176,12 +105,8 @@ print_error_pfS() { echo echo "NOTE: a lot of times you can run './build.sh --clean-builder' to resolve." echo - if [ "$1" != "" ]; then - echo $1 - fi [ -n "${LOGFILE}" -a -f "${LOGFILE}" ] && \ echo "Log saved on ${LOGFILE}" && \ - tail -n20 ${LOGFILE} >&2 echo kill $$ exit 1 @@ -315,11 +240,10 @@ make_world() { return fi - makeargs="${MAKEJ}" - echo ">>> Building world for ${TARGET} architecture... (Starting - $(LC_ALL=C date))" | tee -a ${LOGFILE} - echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} ${makeargs} buildworld" | tee -a ${LOGFILE} - (script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} ${makeargs} buildworld || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE} - echo ">>> Building world for ${TARGET} architecture... (Finished - $(LC_ALL=C date))" | tee -a ${LOGFILE} + echo ">>> $(LC_ALL=C date) - Starting build world for ${TARGET} architecture..." | tee -a ${LOGFILE} + script -aq $LOGFILE ${BUILDER_SCRIPTS}/build_freebsd.sh -K -s ${FREEBSD_SRC_DIR} \ + || print_error_pfS + echo ">>> $(LC_ALL=C date) - Finished build world for ${TARGET} architecture..." | tee -a ${LOGFILE} LOGFILE=${BUILDER_LOGS}/installworld.${TARGET} echo ">>> LOGFILE set to $LOGFILE." | tee -a ${LOGFILE} @@ -327,37 +251,25 @@ make_world() { [ -d "${INSTALLER_CHROOT_DIR}" ] \ || mkdir -p ${INSTALLER_CHROOT_DIR} - makeargs="${MAKEJ} DESTDIR=${INSTALLER_CHROOT_DIR}" - echo ">>> Installing world for ${TARGET} architecture... (Starting - $(LC_ALL=C date))" | tee -a ${LOGFILE} - echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} ${makeargs} installworld" | tee -a ${LOGFILE} - (script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} ${makeargs} installworld || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE} - cp ${FREEBSD_SRC_DIR}/release/rc.local ${INSTALLER_CHROOT_DIR}/etc - echo ">>> Installing world for ${TARGET} architecture... (Finished - $(LC_ALL=C date))" | tee -a ${LOGFILE} - - echo ">>> Distribution world for ${TARGET} architecture... (Starting - $(LC_ALL=C date))" | tee -a ${LOGFILE} - echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} ${makeargs} distribution " | tee -a ${LOGFILE} - (script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} ${makeargs} distribution || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE} - echo ">>> Distribution world for ${TARGET} architecture... (Finished - $(LC_ALL=C date))" | tee -a ${LOGFILE} - - makeargs="${MAKEJ} WITHOUT_BSDINSTALL=1 DESTDIR=${STAGE_CHROOT_DIR}" - echo ">>> Installing world for ${TARGET} architecture... (Starting - $(LC_ALL=C date))" | tee -a ${LOGFILE} - echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} ${makeargs} installworld" | tee -a ${LOGFILE} - (script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} ${makeargs} installworld || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE} - echo ">>> Installing world for ${TARGET} architecture... (Finished - $(LC_ALL=C date))" | tee -a ${LOGFILE} - - echo ">>> Distribution world for ${TARGET} architecture... (Starting - $(LC_ALL=C date))" | tee -a ${LOGFILE} - echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} ${makeargs} distribution " | tee -a ${LOGFILE} - (script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} ${makeargs} distribution || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE} - echo ">>> Distribution world for ${TARGET} architecture... (Finished - $(LC_ALL=C date))" | tee -a ${LOGFILE} + echo ">>> Installing world with bsdinstall for ${TARGET} architecture..." | tee -a ${LOGFILE} + script -aq $LOGFILE ${BUILDER_SCRIPTS}/install_freebsd.sh -i -K \ + -s ${FREEBSD_SRC_DIR} \ + -d ${INSTALLER_CHROOT_DIR} \ + || print_error_pfS + + echo ">>> Installing world without bsdinstall for ${TARGET} architecture..." | tee -a ${LOGFILE} + script -aq $LOGFILE ${BUILDER_SCRIPTS}/install_freebsd.sh -K \ + -s ${FREEBSD_SRC_DIR} \ + -d ${STAGE_CHROOT_DIR} \ + || print_error_pfS + # XXX It must go to the scripts [ -d "${STAGE_CHROOT_DIR}/usr/local/bin" ] \ || mkdir -p ${STAGE_CHROOT_DIR}/usr/local/bin - makeargs="${MAKEJ} DESTDIR=${STAGE_CHROOT_DIR}" + makeargs="DESTDIR=${STAGE_CHROOT_DIR}" echo ">>> Building and installing crypto tools and athstats for ${TARGET} architecture... (Starting - $(LC_ALL=C date))" | tee -a ${LOGFILE} - echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR}/tools/tools/crypto ${makeargs} clean all install " | tee -a ${LOGFILE} (script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR}/tools/tools/crypto ${makeargs} clean all install || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE} # XXX FIX IT -# echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR}/tools/tools/ath/athstats ${makeargs} clean all install" | tee -a ${LOGFILE} # (script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR}/tools/tools/ath/athstats ${makeargs} clean all install || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE} echo ">>> Building and installing crypto tools and athstats for ${TARGET} architecture... (Finished - $(LC_ALL=C date))" | tee -a ${LOGFILE} @@ -826,7 +738,7 @@ create_ova_image() { fi echo "Done!" | tee -a ${LOGFILE} - rm -f ${OVA_TMP}/i${OVFRAW} + rm -f ${OVA_TMP}/${OVFRAW} ova_setup_ovf_template @@ -1444,42 +1356,28 @@ update_freebsd_sources() { local _clone_params="--depth 1 --single-branch" fi - if [ ! -d "${FREEBSD_SRC_DIR}" ]; then - mkdir -p ${FREEBSD_SRC_DIR} - fi - if [ -n "${NO_BUILDWORLD}" -a -n "${NO_BUILDKERNEL}" ]; then echo ">>> NO_BUILDWORLD and NO_BUILDKERNEL set, skipping update of freebsd sources" | tee -a ${LOGFILE} return fi - echo -n ">>> Obtaining FreeBSD sources ${FREEBSD_BRANCH}..." - local _FREEBSD_BRANCH=${FREEBSD_BRANCH:-"devel"} - local _CLONE=1 + echo ">>> Obtaining FreeBSD sources (${FREEBSD_BRANCH})..." + ${BUILDER_SCRIPTS}/git_checkout.sh \ + -r ${FREEBSD_REPO_BASE} \ + -d ${FREEBSD_SRC_DIR} \ + -b ${FREEBSD_BRANCH} - if [ -d "${FREEBSD_SRC_DIR}/.git" ]; then - CUR_BRANCH=$(cd ${FREEBSD_SRC_DIR} && git branch | grep '^\*' | cut -d' ' -f2) - if [ ${_full} -eq 0 -a "${CUR_BRANCH}" = "${_FREEBSD_BRANCH}" ]; then - _CLONE=0 - ( cd ${FREEBSD_SRC_DIR} && git clean -fd; git fetch origin; git reset --hard origin/${_FREEBSD_BRANCH} ) 2>&1 | grep -C3 -i -E 'error|fatal' - else - rm -rf ${FREEBSD_SRC_DIR} - fi - fi - - if [ ${_CLONE} -eq 1 ]; then - ( git clone --branch ${_FREEBSD_BRANCH} ${_clone_params} ${FREEBSD_REPO_BASE} ${FREEBSD_SRC_DIR} ) 2>&1 | grep -C3 -i -E 'error|fatal' - fi - - if [ ! -d "${FREEBSD_SRC_DIR}/.git" ]; then + if [ $? -ne 0 -o ! -d "${FREEBSD_SRC_DIR}/.git" ]; then echo ">>> ERROR: It was not possible to clone FreeBSD src repo" print_error_pfS fi if [ -n "${GIT_FREEBSD_COSHA1}" ]; then - ( cd ${FREEBSD_SRC_DIR} && git checkout ${GIT_FREEBSD_COSHA1} ) 2>&1 | grep -C3 -i -E 'error|fatal' + echo -n ">>> Checking out desired commit (${GIT_FREEBSD_COSHA1})... " + ( git -C ${FREEBSD_SRC_DIR} checkout ${GIT_FREEBSD_COSHA1} ) 2>&1 | \ + grep -C3 -i -E 'error|fatal' + echo "Done!" fi - echo "Done!" } pkg_chroot() { @@ -1610,12 +1508,10 @@ buildkernel() { export KERNCONF=$(basename ${KERNELCONF}) fi - echo ">>> KERNCONFDIR: ${KERNCONFDIR}" - echo ">>> ARCH: ${TARGET_ARCH}" - - makeargs="${MAKEJ}" - echo ">>> Builder is running the command: script -aq $LOGFILE make $makeargs buildkernel KERNCONF=${KERNCONF}" | tee -a $LOGFILE - (script -q $LOGFILE make -C ${FREEBSD_SRC_DIR} $makeargs buildkernel KERNCONF=${KERNCONF} || print_error_pfS;) | egrep '^>>>' + echo ">>> $(LC_ALL=C date) - Starting build kernel for ${TARGET} architecture..." | tee -a ${LOGFILE} + script -aq $LOGFILE ${BUILDER_SCRIPTS}/build_freebsd.sh -W -s ${FREEBSD_SRC_DIR} \ + || print_error_pfS + echo ">>> $(LC_ALL=C date) - Finished build kernel for ${TARGET} architecture..." | tee -a ${LOGFILE} } # Imported from FreeSBIE @@ -1633,10 +1529,11 @@ installkernel() { fi mkdir -p ${STAGE_CHROOT_DIR}/boot - makeargs="${MAKEJ} DESTDIR=${_destdir}" - echo ">>> Builder is running the command: script -aq $LOGFILE make ${makeargs} installkernel KERNCONF=${KERNCONF}" | tee -a $LOGFILE - (script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} ${makeargs} installkernel KERNCONF=${KERNCONF} || print_error_pfS;) | egrep '^>>>' - gzip -f9 ${_destdir}/boot/kernel/kernel + echo ">>> Installing kernel (${KERNCONF}) for ${TARGET} architecture..." | tee -a ${LOGFILE} + script -aq $LOGFILE ${BUILDER_SCRIPTS}/install_freebsd.sh -W -D -z \ + -s ${FREEBSD_SRC_DIR} \ + -d ${_destdir} \ + || print_error_pfS } # Launch is ran first to setup a few variables that we need @@ -2026,7 +1923,6 @@ EOF fi echo -n ">>> Creating jail ${jail_name}, it may take some time... " | tee -a ${LOGFILE} - # XXX: Change -m to git when it's available in poudriere if ! script -aq ${LOGFILE} poudriere jail -c -j "${jail_name}" -v ${FREEBSD_BRANCH} \ -a ${jail_arch} -m git -U ${FREEBSD_REPO_BASE_POUDRIERE} ${native_xtools} >/dev/null 2>&1; then echo "" | tee -a ${LOGFILE} diff --git a/tools/builder_defaults.sh b/tools/builder_defaults.sh index 23d3e78..3167fa6 100644 --- a/tools/builder_defaults.sh +++ b/tools/builder_defaults.sh @@ -37,6 +37,7 @@ if [ ! -d "${BUILDER_ROOT}" ]; then fi export BUILDER_TOOLS=${BUILDER_TOOLS:-"${BUILDER_ROOT}/tools"} +export BUILDER_SCRIPTS=${BUILDER_SCRIPTS:-"${BUILDER_ROOT}/build/scripts"} if [ ! -d "${BUILDER_TOOLS}" ]; then echo ">>> ERROR: BUILDER_TOOLS is invalid" @@ -106,7 +107,8 @@ else export GIT_REPO_BRANCH_OR_TAG="${_cur_git_repo_branch_or_tag}" fi # Use vX_Y instead of RELENG_X_Y for poudriere to make it shorter -POUDRIERE_BRANCH=$(echo "${GIT_REPO_BRANCH_OR_TAG}" | sed 's,RELENG_,v,') +# Replace . by _ to make tag names look correct +POUDRIERE_BRANCH=$(echo "${GIT_REPO_BRANCH_OR_TAG}" | sed 's,RELENG_,v,; s,\.,_,g') GIT_REPO_BASE=$(git -C ${BUILDER_ROOT} config --get remote.origin.url | sed -e 's,/[^/]*$,,') @@ -141,17 +143,6 @@ export KERNEL_BUILD_PATH=${KERNEL_BUILD_PATH:-"${SCRATCHDIR}/kernels"} # Do not touch builder /usr/obj export MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX:-"${SCRATCHDIR}/obj"} -# Controls how many concurrent make processes are run for each stage -_CPUS="" -if [ -z "${NO_MAKEJ}" ]; then - _CPUS=$(expr $(sysctl -n kern.smp.cpus) '*' 2) - if [ -n "${_CPUS}" ]; then - _CPUS="-j${_CPUS}" - fi -fi - -export MAKEJ=${MAKEJ:-"${_CPUS}"} - export MODULES_OVERRIDE=${MODULES_OVERRIDE:-"i2c ipmi ndis ipfw ipdivert dummynet fdescfs opensolaris zfs glxsb if_stf coretemp amdtemp aesni sfxge hwpmc vmm nmdm ix ixv"} # Area that the final image will appear in diff --git a/tools/scripts/clean.sh b/tools/scripts/clean.sh deleted file mode 100755 index e0b601a..0000000 --- a/tools/scripts/clean.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# -# clean.sh -# -# part of pfSense (https://www.pfsense.org) -# Copyright (c) 2015-2016 Electric Sheep Fencing, LLC -# All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -sed -i '' 's/> </></g' $1 ; -sed -i '' 's/ / /g' $1 ; -sed -i '' 's/\s+$//g' $1 ; -sed -i '' 's/ width="17" height="17" border="0"//g' $1 ; -sed -i '' 's/<td [^>]+listhdrr[^>]+>/<th>/g' $1 ; -sed -i '' 's/<body[^>]*>//g' $1 ; -sed -i '' 's/<\(table\|td\|span\|div\)[^>]\+>/<\1>/g' $1 ; -sed -i '' 's/<?php include("fbegin.inc"); ?>//g' $1 ; -sed -i '' 's/<?php include("fend.inc"); ?>/<?php include("foot.inc"); ?>/g' $1 ; -sed -i '' 's/<?php echo /<?=/g' $1 ; -sed -i '' 's/;\s*?>/?>/g' $1 ; -sed -i '' 's/<?\s*=\s*/<?=/g' $1 ; -sed -i '' 's/ <> / != /g' $1 ; |