build/compress: compression stage; closes #56

This commit is contained in:
Franco Fichtner 2018-06-28 18:27:23 +02:00
parent 29d0b629c9
commit c2ec836005
3 changed files with 57 additions and 4 deletions

View File

@ -23,10 +23,10 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
STEPS= arm base boot chroot clean core distfiles download \
dvd info kernel nano plugins ports prefetch print \
rebase release rename serial sign skim test update \
upload verify vga vm xtools
STEPS= arm base boot chroot clean compress core distfiles download \
dvd info kernel nano plugins ports prefetch print rebase \
release rename serial sign skim test update upload verify \
vga vm xtools
SCRIPTS= batch nightly refresh pkg_fingerprint pkg_sign
.PHONY: ${STEPS}

View File

@ -374,6 +374,14 @@ they can be printed selectively using:
# make print-<variable1>[,<variable2>]
Compressing images
------------------
For distribution images are compressed ussing bzip2(1). This can
be invoked manually using:
# make compress-<image1>[,<image2>]
Composite build steps
---------------------

45
build/compress.sh Normal file
View File

@ -0,0 +1,45 @@
#!/bin/sh
# Copyright (c) 2018 Franco Fichtner <franco@opnsense.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.
set -e
SELF=compress
. ./common.sh
for ARG in ${@}; do
case ${ARG} in
arm|dvd|nano|serial|vga|vm)
for FILE in $(find ${IMAGESDIR} -name \
"*-${PRODUCT_FLAVOUR}-${ARG}-*" \! -name "*.bz2"); do
echo -n ">>> Compressing ${ARG} image... "
bzip2 ${FILE}
echo "done"
done
;;
esac
done