|
Packit |
857059 |
#!/bin/bash
|
|
Packit |
857059 |
# BEGIN_ICS_COPYRIGHT8 ****************************************
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# Copyright (c) 2015, Intel Corporation
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# Redistribution and use in source and binary forms, with or without
|
|
Packit |
857059 |
# modification, are permitted provided that the following conditions are met:
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# * Redistributions of source code must retain the above copyright notice,
|
|
Packit |
857059 |
# this list of conditions and the following disclaimer.
|
|
Packit |
857059 |
# * Redistributions in binary form must reproduce the above copyright
|
|
Packit |
857059 |
# notice, this list of conditions and the following disclaimer in the
|
|
Packit |
857059 |
# documentation and/or other materials provided with the distribution.
|
|
Packit |
857059 |
# * Neither the name of Intel Corporation nor the names of its contributors
|
|
Packit |
857059 |
# may be used to endorse or promote products derived from this software
|
|
Packit |
857059 |
# without specific prior written permission.
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Packit |
857059 |
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit |
857059 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
Packit |
857059 |
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
|
Packit |
857059 |
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Packit |
857059 |
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
Packit |
857059 |
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
Packit |
857059 |
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
Packit |
857059 |
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit |
857059 |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# END_ICS_COPYRIGHT8 ****************************************
|
|
Packit |
857059 |
# Environment variable: BUILD_ISO=y will enable generation of ISO Images,
|
|
Packit |
857059 |
# Any other value disables hence saving disk space for developer builds
|
|
Packit |
857059 |
# If BUILD_ISO is not defined, it defaults based on RELEASE_TAG
|
|
Packit |
857059 |
# y - if release tag starts with R (eg. an offical build)
|
|
Packit |
857059 |
# n - if release tag does not start with R (eg. a developer build)
|
|
Packit |
857059 |
|
|
Packit |
857059 |
MKZFTREE=${MKZFTREE:-$TL_DIR/MakeTools/zisofs-tools/mkzftree}
|
|
Packit |
857059 |
PATCH_BRAND=${PATCH_BRAND:-$TL_DIR/MakeTools/patch_version/patch_brand}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
Usage()
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
echo "Usage: makeiso.sh [-z] [-l 'label'] file.iso dir" >&2
|
|
Packit |
857059 |
echo " default label is dir name" >&2
|
|
Packit |
857059 |
echo " -z - create compressed CD" >&2
|
|
Packit |
857059 |
exit 2
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
label=
|
|
Packit |
857059 |
opts=
|
|
Packit |
857059 |
zflag=n
|
|
Packit |
857059 |
while getopts zl: param
|
|
Packit |
857059 |
do
|
|
Packit |
857059 |
case $param in
|
|
Packit |
857059 |
l)
|
|
Packit |
857059 |
label="$OPTARG";;
|
|
Packit |
857059 |
z)
|
|
Packit |
857059 |
zflag=y
|
|
Packit |
857059 |
opts="$opts -z";;
|
|
Packit |
857059 |
?)
|
|
Packit |
857059 |
Usage;;
|
|
Packit |
857059 |
esac
|
|
Packit |
857059 |
done
|
|
Packit |
857059 |
shift $((OPTIND -1))
|
|
Packit |
857059 |
|
|
Packit |
857059 |
if [ $# -ne 2 ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
Usage
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
|
|
Packit |
857059 |
if [ x"$BUILD_ISO" = x ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
# default based on RELEASE_TAG
|
|
Packit |
857059 |
if [ x`echo $RELEASE_TAG|cut -c1` = xR ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
BUILD_ISO=y
|
|
Packit |
857059 |
else
|
|
Packit |
857059 |
BUILD_ISO=n
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
if [ x"$BUILD_ISO" != xy ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
echo "Iso Image Generation Disabled"
|
|
Packit |
857059 |
echo "export BUILD_ISO=y to enable"
|
|
Packit |
857059 |
exit 0
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
|
|
Packit |
857059 |
iso=$1
|
|
Packit |
857059 |
dir=$2
|
|
Packit |
857059 |
|
|
Packit |
857059 |
if [ ! -d $dir ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
echo "makeiso.sh: $dir is not a directory" >&2
|
|
Packit |
857059 |
Usage
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
|
|
Packit |
857059 |
if [ -z "$label" ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
label="$dir"
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
|
|
Packit |
857059 |
if [ "$zflag" = y ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
echo "Compressing $dir into $dir.comp..."
|
|
Packit |
857059 |
$MKZFTREE -p 5 $dir $dir.comp
|
|
Packit |
857059 |
srcdir=$dir.comp
|
|
Packit |
857059 |
else
|
|
Packit |
857059 |
srcdir=$dir
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
echo "Creating $iso using $srcdir, Label is $label..."
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# TBD -copyright file
|
|
Packit |
857059 |
# TBD -abstract file
|
|
Packit |
857059 |
author=`$PATCH_BRAND "$BUILD_BRAND"`
|
|
Packit |
857059 |
mkisofs $opts -A "$label" -p "$author" -P "$author" -sysid "$label" -V "$label" -volset "$label" -volset-size 1 -volset-seqno 1 -o $iso -r -L $srcdir
|
|
Packit |
857059 |
|
|
Packit |
857059 |
if [ "$zflag" = y ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
rm -rf $dir.comp
|
|
Packit |
857059 |
fi
|