summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-06-20 08:52:42 -0300
committerRenato Botelho <renato@netgate.com>2016-06-20 08:59:32 -0300
commitb0d0498cdeae246f9fc08e26deb3e7515187cb3d (patch)
tree5a37c7a0b409da44e67a35b1be70b5238ebb90fc
parent6beef1bf87563eabf19cb7a56a90a1d23fc434c5 (diff)
downloadpfsense-b0d0498cdeae246f9fc08e26deb3e7515187cb3d.zip
pfsense-b0d0498cdeae246f9fc08e26deb3e7515187cb3d.tar.gz
Add the hability of building images with custom logos on build scripts
-rwxr-xr-xbuild.sh8
-rw-r--r--tools/builder_common.sh36
-rw-r--r--tools/builder_defaults.sh3
3 files changed, 37 insertions, 10 deletions
diff --git a/build.sh b/build.sh
index c5cdd6e..85c4f5c 100755
--- a/build.sh
+++ b/build.sh
@@ -409,7 +409,13 @@ for _IMGTOBUILD in $_IMAGESTOBUILD; do
create_iso_image
;;
memstick)
- create_memstick_image
+ if [ -n "${MEMSTICK_VARIANTS}" ]; then
+ for _variant in ${MEMSTICK_VARIANTS}; do
+ create_memstick_image ${_variant}
+ done
+ else
+ create_memstick_image
+ fi
;;
memstickserial)
create_memstick_serial_image
diff --git a/tools/builder_common.sh b/tools/builder_common.sh
index e3e07d7..b87e267 100644
--- a/tools/builder_common.sh
+++ b/tools/builder_common.sh
@@ -1110,7 +1110,8 @@ create_final_staging_area() {
customize_stagearea_for_image() {
local _image_type="$1"
- local _default_config=""
+ local _default_config="" # filled with $2 below
+ local _image_variant="$3"
if [ -n "$2" ]; then
_default_config="$2"
@@ -1174,6 +1175,14 @@ customize_stagearea_for_image() {
/usr/local/bin/sqlite3 ${_db} "update repodata set value='${_new}' where key='packagesite'"
done
fi
+
+ if [ -n "$_image_variant" -a \
+ -d ${BUILDER_TOOLS}/templates/custom_logos/${_image_variant} ]; then
+ mkdir -p ${FINAL_CHROOT_DIR}/usr/local/share/${PRODUCT_NAME}/custom_logos
+ cp -f \
+ ${BUILDER_TOOLS}/templates/custom_logos/${_image_variant}/*.png \
+ ${FINAL_CHROOT_DIR}/usr/local/share/${PRODUCT_NAME}/custom_logos
+ fi
}
create_distribution_tarball() {
@@ -1225,6 +1234,8 @@ create_iso_image() {
}
create_memstick_image() {
+ local _variant="$1"
+
LOGFILE=${BUILDER_LOGS}/memstick.${TARGET}
if [ "${MEMSTICKPATH}" = "" ]; then
echo ">>> MEMSTICKPATH is empty skipping generation of memstick image!" | tee -a ${LOGFILE}
@@ -1233,26 +1244,33 @@ create_memstick_image() {
mkdir -p $(dirname ${MEMSTICKPATH})
- customize_stagearea_for_image "memstick"
+ local _image_path=${MEMSTICKPATH}
+ if [ -n "${_variant}" ]; then
+ _image_path=$(echo "$_image_path" | \
+ sed "s/-memstick-/-memstick-${_variant}-/")
+ VARIANTIMAGES="${VARIANTIMAGES}${VARIANTIMAGES:+ }${_image_path}"
+ fi
+
+ customize_stagearea_for_image "memstick" "" $_variant
install_default_kernel ${DEFAULT_KERNEL}
echo cdrom > $FINAL_CHROOT_DIR/etc/platform
- echo ">>> Creating memstick to ${MEMSTICKPATH}." 2>&1 | tee -a ${LOGFILE}
+ echo ">>> Creating memstick to ${_image_path}." 2>&1 | tee -a ${LOGFILE}
echo "/dev/ufs/${PRODUCT_NAME} / ufs ro 0 0" > ${FINAL_CHROOT_DIR}/etc/fstab
echo "kern.cam.boot_delay=10000" >> ${FINAL_CHROOT_DIR}/boot/loader.conf.local
create_distribution_tarball
- makefs -B little -o label=${PRODUCT_NAME},version=2 ${MEMSTICKPATH} ${FINAL_CHROOT_DIR}
+ makefs -B little -o label=${PRODUCT_NAME},version=2 ${_image_path} ${FINAL_CHROOT_DIR}
if [ $? -ne 0 ]; then
- if [ -f ${MEMSTICKPATH} ]; then
- rm -f $MEMSTICKPATH
+ if [ -f ${_image_path} ]; then
+ rm -f $_image_path
fi
echo ">>> ERROR: Something wrong happened during MEMSTICK image creation. STOPPING!" | tee -a ${LOGFILE}
print_error_pfS
fi
- MD=$(mdconfig -a -t vnode -f $MEMSTICKPATH)
+ MD=$(mdconfig -a -t vnode -f $_image_path)
# Just in case
trap "mdconfig -d -u ${MD}" 1 2 15 EXIT
gpart create -s BSD ${MD} 2>&1 >> ${LOGFILE}
@@ -1260,7 +1278,7 @@ create_memstick_image() {
gpart add -t freebsd-ufs ${MD} 2>&1 >> ${LOGFILE}
trap "-" 1 2 15 EXIT
mdconfig -d -u ${MD} 2>&1 | tee -a ${LOGFILE}
- gzip -qf $MEMSTICKPATH &
+ gzip -qf $_image_path &
_bg_pids="${_bg_pids}${_bg_pids:+ }$!"
echo ">>> MEMSTICK created: $(LC_ALL=C date)" | tee -a ${LOGFILE}
@@ -2286,7 +2304,7 @@ snapshots_create_latest_symlink() {
snapshots_create_sha256() {
local _img=""
- for _img in ${ISOPATH} ${MEMSTICKPATH} ${MEMSTICKSERIALPATH} ${MEMSTICKADIPATH} ${OVAPATH}; do
+ for _img in ${ISOPATH} ${MEMSTICKPATH} ${MEMSTICKSERIALPATH} ${MEMSTICKADIPATH} ${OVAPATH} ${VARIANTIMAGES}; do
if [ -f "${_img}.gz" ]; then
_img="${_img}.gz"
fi
diff --git a/tools/builder_defaults.sh b/tools/builder_defaults.sh
index 3a7f79a..fc9049e 100644
--- a/tools/builder_defaults.sh
+++ b/tools/builder_defaults.sh
@@ -376,6 +376,9 @@ export MEMSTICKPATH=${MEMSTICKPATH:-"${IMAGES_FINAL_DIR}/installer/${PRODUCT_NAM
export MEMSTICKSERIALPATH=${MEMSTICKSERIALPATH:-"${IMAGES_FINAL_DIR}/installer/${PRODUCT_NAME}${PRODUCT_NAME_SUFFIX}-memstick-serial-${PRODUCT_VERSION}${PRODUCT_REVISION:+-p}${PRODUCT_REVISION}-${TARGET}${TIMESTAMP_SUFFIX}.img"}
export MEMSTICKADIPATH=${MEMSTICKADIPATH:-"${IMAGES_FINAL_DIR}/installer/${PRODUCT_NAME}${PRODUCT_NAME_SUFFIX}-memstick-ADI-${PRODUCT_VERSION}${PRODUCT_REVISION:+-p}${PRODUCT_REVISION}-${TARGET}${TIMESTAMP_SUFFIX}.img"}
export OVAPATH=${OVAPATH:-"${IMAGES_FINAL_DIR}/virtualization/${PRODUCT_NAME}${PRODUCT_NAME_SUFFIX}-${PRODUCT_VERSION}${PRODUCT_REVISION:+-p}${PRODUCT_REVISION}-${TARGET}${TIMESTAMP_SUFFIX}.ova"}
+export MEMSTICK_VARIANTS=${MEMSTICK_VARIANTS:-}
+export VARIANTIMAGES=""
+export VARIANTUPDATES=""
# nanobsd templates
export NANOBSD_IMG_TEMPLATE=${NANOBSD_IMG_TEMPLATE:-"${PRODUCT_NAME}${PRODUCT_NAME_SUFFIX}-${PRODUCT_VERSION}${PRODUCT_REVISION:+-p}${PRODUCT_REVISION}-%%SIZE%%-${TARGET}-%%TYPE%%${TIMESTAMP_SUFFIX}.img"}
OpenPOWER on IntegriCloud