Browse Source

Build finished successfully

We now have the basics for building HardenedBSD and publishing built
artifacts. Note that this is just a functionality check-in before more
extensive work. The build is currently performed with hard-coded
variables. Obviously, that will need to change to a dynamic config file.

Signed-off-by:	Shawn Webb <shawn.webb@hardenedbsd.org>
pull/4/head
Shawn Webb 11 months ago
parent
commit
9747d40c00
Signed by: shawn.webb <shawn.webb@hardenedbsd.org> GPG Key ID: FF2E67A277F8E1FA
3 changed files with 93 additions and 4 deletions
  1. +20
    -0
      bin/ci.sh
  2. +37
    -4
      lib/build.sh
  3. +36
    -0
      lib/publish.sh

+ 20
- 0
bin/ci.sh View File

@@ -24,7 +24,27 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.

. ./lib/build.sh
. ./lib/publish.sh

main() {
HBSD_BUILDNUMBER=1
HBSD_KERNEL=HARDENEDBSD
HBSD_NJOBS=4
HBSD_OBJRELDIR=/usr/obj/usr/src/amd64.amd64/release
HBSD_PUBDIR=/build/pub
HBSD_SRC=/usr/src
HBSD_STAGEDIR=/build/stage
HBSD_TARGET=amd64
HBSD_TARGET_ARCH=amd64

build_hardenedbsd && \
build_release && \
stage_release && \
sign_release && \
publish_release && \
kick_publisher_tires
return ${?}
}

main ${0} $*


+ 37
- 4
lib/build.sh View File

@@ -30,15 +30,17 @@ build_hardenedbsd() {

cd ${HBSD_SRC}
make \
-n ${NJOBS} \
-j ${HBSD_NJOBS} \
TARGET=${HBSD_TARGET} \
TARGET_ARCH=${HBSD_TARGET_ARCH} \
-DNO_CLEAN \
buildworld
make \
-n ${NJOBS} \
-j ${HBSD_NJOBS} \
TARGET=${HBSD_TARGET} \
TARGET_ARCH=${HBSD_TARGET_ARCH} \
KERNCONF=${HBSD_KERNEL} \
-DNO_KERNELCLEAN \
buildkernel
)
return ${?}
@@ -71,9 +73,40 @@ stage_release() {
local f
local file

for file in $(find ${HBSD_OBJRELDIR} -maxdepth 1 -name '*.iso' - -name '*.img'); do
mkdir -p \
${HBSD_STAGEDIR} \
${HBSD_PUBDIR}

for file in $(find ${HBSD_OBJRELDIR} -maxdepth 1 \
-name '*.iso' \
-o -name '*.img' \
-o -name '*.txz' \
-o -name 'MANIFEST'); do
f=${file##*/}
mv ${file} ${HBSD_STAGEDIR}/${f}
xz -c9 ${HBSD_STAGEDIR}/${f} > ${HBSD_STAGEDIR}/${f}.xz
xz -kc9 ${HBSD_STAGEDIR}/${f} > ${HBSD_STAGEDIR}/${f}.xz
done
return 0
}

sign_release() {
(
cd ${HBSD_STAGEDIR}
for file in $(find . \
-name '*.txz' \
-o -name '*.img' \
-o -name '*.iso' \
-o -name 'MANIFEST'); do
f=${file##*/}
sha256 ${f} >> CHECKSUMS.SHA256
sha512 ${f} >> CHECKSUMS.SHA512
if [ ! -z "${HBSD_GPG_KEY}" ]; then
gpg --sign -a --detach \
-u ${HBSD_GPG_KEY} \
-o ${f}.asc \
${f}
fi
done
)
return 0
}

+ 36
- 0
lib/publish.sh View File

@@ -0,0 +1,36 @@
#!/bin/sh
#-
# Copyright (c) 2019 HardenedBSD
# Author: Shawn Webb <shawn.webb@hardenedbsd.org>
#
# 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 THE AUTHOR 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.

publish_release() {
mv ${HBSD_STAGEDIR} ${HBSD_PUBDIR}/${HBSD_BUILDNUMBER}
return ${?}
}

kick_publisher_tires() {
# This function is for those mirrors that require push rather
# than pull. For now: nothing to see here; move along.
return 0
}

Loading…
Cancel
Save