StarlingX open source release updates
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
This commit is contained in:
parent
2cfd128c20
commit
cfe45dadae
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
*.swp
|
||||
/cgcs-centos-repo
|
||||
/cgcs-tis-repo
|
||||
/cgcs-3rd-party-repo
|
202
LICENSE
Normal file
202
LICENSE
Normal file
@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
3
addons/.gitignore
vendored
Normal file
3
addons/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/wr-avs
|
||||
/wr-cgcs
|
||||
|
19
build-data/unbuilt_rpm_patterns
Normal file
19
build-data/unbuilt_rpm_patterns
Normal file
@ -0,0 +1,19 @@
|
||||
[-]locale[-]
|
||||
[-]doc[-]
|
||||
[-]dbg[-]
|
||||
vswitch-staticdev
|
||||
guest-scale-agent-staticdev
|
||||
vim-spell
|
||||
openssh-server-sysvinit
|
||||
openstack-neutron-linuxbridge
|
||||
^libcacard-
|
||||
^kernel-bootwrapper
|
||||
^kernel-doc-
|
||||
^kernel-abi-whitelists
|
||||
^kernel-debug-
|
||||
^kernel-kdump
|
||||
^kernel-rt-bootwrapper
|
||||
^kernel-rt-doc-
|
||||
^kernel-rt-abi-whitelists
|
||||
^kernel-rt-debug-
|
||||
^kernel-rt-kdump
|
78
build-tools/Cached_Data.txt
Normal file
78
build-tools/Cached_Data.txt
Normal file
@ -0,0 +1,78 @@
|
||||
Data on an source rpm:
|
||||
|
||||
location:
|
||||
${MY_WORKSPACE}/${BUILD_TYPE}/rpmbuild/SPECS/${SRPM_FILE_NAME}/
|
||||
|
||||
files:
|
||||
*.spec # spec file found in the source rpm
|
||||
|
||||
subdirectories:
|
||||
NAMES/ # Directory contains an emtpy file, where the file name
|
||||
# is the name of the source rpm.
|
||||
|
||||
SERVICES/ # Directory contains zero or more emtpy files, where the
|
||||
# file name is the name of the service provided by one
|
||||
# or more of the rpms.
|
||||
|
||||
BUILDS/ # Directory contains emtpy files, where the file name is
|
||||
# the name of a binary rpm built from the source rpm.
|
||||
|
||||
BUILDS_VR/ # Directory contains emtpy files, where the file name is
|
||||
# the name-verion-release of a binary rpm built from the
|
||||
# source rpm.
|
||||
|
||||
location:
|
||||
${MY_WORKSPACE}/${BUILD_TYPE}/rpmbuild/SOURCES/${SRPM_FILE_NAME}/
|
||||
|
||||
files:
|
||||
BIG # if it exists, it contains one line, the numeric value
|
||||
# extracted from build_srpms.data if the line
|
||||
# BUILD_IS_BIG=### if present.
|
||||
# This is the estimated filesystem size (GB) required to
|
||||
# host a mock build of the package.
|
||||
# Note: not all parallel build environments are the same
|
||||
# size. The smallest build environmnet is 3 GB and this
|
||||
# is sufficient for most packages. Don't bother adding a
|
||||
# BUILD_IS_BIG=### directive unless 3 gb is proven to be
|
||||
# insufficient.
|
||||
|
||||
SLOW # if it exists, it contains one line, the numeric value i
|
||||
# extracted from build_srpms.data if the line
|
||||
# BUILD_IS_SLOW=### if present.
|
||||
# This is the estimated build time (minutes) required to
|
||||
# host perform a mock build of the package.
|
||||
# Note: Currently we only use this value as a boolean.
|
||||
# Non-zero and we try to start the build of this package
|
||||
# earlier rather than later. Build times >= 3 minutes are
|
||||
# worth anotating. Else don't bother adding a
|
||||
# BUILD_IS_SLOW=### directive
|
||||
e.g.
|
||||
|
||||
cd $MY_WORKSPACE/std/rpmbuild/SPECS/openstack-cinder-9.1.1-0.tis.40.src.rpm
|
||||
find .
|
||||
./BUILDS
|
||||
./BUILDS/openstack-cinder
|
||||
./BUILDS/python-cinder
|
||||
./BUILDS/python-cinder-tests
|
||||
./NAMES
|
||||
./NAMES/openstack-cinder
|
||||
./SERVICES
|
||||
./SERVICES/cinder
|
||||
./BUILDS_VR
|
||||
./BUILDS_VR/openstack-cinder-9.1.1-0.tis.40
|
||||
./BUILDS_VR/python-cinder-9.1.1-0.tis.40
|
||||
./BUILDS_VR/python-cinder-tests-9.1.1-0.tis.40
|
||||
./openstack-cinder.spec
|
||||
|
||||
|
||||
e.g.
|
||||
cd $MY_WORKSPACE/std/rpmbuild/SOURCES/kernel-3.10.0-514.16.1.el7.29.tis.src.rpm
|
||||
find .
|
||||
./BIG
|
||||
./SLOW
|
||||
|
||||
cat ./BIG
|
||||
8
|
||||
|
||||
cat ./SLOW
|
||||
12
|
70
build-tools/audit-pkgs
Executable file
70
build-tools/audit-pkgs
Executable file
@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
|
||||
rpm_compare () {
|
||||
local r="$1"
|
||||
local r2="$2"
|
||||
local line
|
||||
local f=$(basename $r)
|
||||
local f2=$(basename $r2)
|
||||
|
||||
rpm -q --dump --nosignature -p $r | awk ' { print $1 "\n" $1 " " $5 " " $6 " " $7 " " $8 " " $9 " " $10 " " $11 } ' > /tmp/dump.new
|
||||
rpm -q --dump --nosignature -p $r2 | awk ' { print $1 "\n" $1 " " $5 " " $6 " " $7 " " $8 " " $9 " " $10 " " $11 } ' > /tmp/dump.old
|
||||
first_line=1
|
||||
diff -y -W 200 --suppress-common-lines /tmp/dump.new /tmp/dump.old | grep '|' |
|
||||
while read -r line; do
|
||||
left=$(echo "$line" | awk -F '|' '{ print $1 }')
|
||||
right=$(echo "$line" | awk -F '|' '{ print $2 }')
|
||||
left_f=$(echo "$left" | awk '{ print $1 }')
|
||||
right_f=$(echo "$right" | awk '{ print $1 }')
|
||||
if [ "$left_f" != "$right_f" ];then
|
||||
continue
|
||||
fi
|
||||
if [ $first_line -eq 1 ]; then
|
||||
echo ""
|
||||
echo "$f vs $f2"
|
||||
first_line=0
|
||||
fi
|
||||
echo "$line"
|
||||
done
|
||||
}
|
||||
|
||||
echo ""
|
||||
echo "======================================================"
|
||||
echo "Auditing built packages vs unpatched upstream packages"
|
||||
echo "======================================================"
|
||||
for r in $(find $MY_WORKSPACE/*/rpmbuild/RPMS -name '*.rpm' | grep -v '.src.rpm' | grep -v debuginfo); do
|
||||
f=$(basename $r)
|
||||
f2=$(echo $f | sed 's#[.]tis[.][0-9]*[.]#.#' | sed 's#[.]tis[.]#.#')
|
||||
r2=$(find $MY_REPO/cgcs-centos-repo/Binary/ -name $f2)
|
||||
if [ "$r2" == "" ]; then
|
||||
# Probably one of our own
|
||||
# echo "Couldn't find '$f2'"
|
||||
continue
|
||||
fi
|
||||
rpm_compare "$r" "$r2"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "============================"
|
||||
echo "Auditing built for conflicts"
|
||||
echo "============================"
|
||||
grep 'conflicts with file from package' -r --binary-files=without-match $MY_WORKSPACE/*/results/ |
|
||||
while read -r line; do
|
||||
w=$(echo "$line" | awk '{ print $8 }')".rpm"
|
||||
w2=$(echo "$line" | awk '{ print $14 }')".rpm"
|
||||
echo "$w $w2"
|
||||
done | sort --unique | sed 's#bash-completion-1:#bash-completion-#' |
|
||||
while read -r line2; do
|
||||
f=$(echo "$line2" | awk '{ print $1 }')
|
||||
f2=$(echo "$line2" | awk '{ print $2 }')
|
||||
r=$(find $MY_REPO/cgcs-centos-repo/Binary/ $MY_WORKSPACE/*/rpmbuild/RPMS -name $f)
|
||||
r2=$(find $MY_REPO/cgcs-centos-repo/Binary/ $MY_WORKSPACE/*/rpmbuild/RPMS -name $f2)
|
||||
# echo ""
|
||||
# echo "$f vs $f2"
|
||||
# echo "$r vs $r2"
|
||||
if [ "$r" != "" ] && [ "$r2" != "" ]; then
|
||||
rpm_compare "$r" "$r2"
|
||||
fi
|
||||
done
|
||||
|
||||
|
86
build-tools/branching/branch_and_tag.sh
Executable file
86
build-tools/branching/branch_and_tag.sh
Executable file
@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
|
||||
# The purpose of this script is to create branches and tags that follow a convention
|
||||
# If the desired branch already exists, it is skipped.
|
||||
# If the desired tag already exists, it is skipped.
|
||||
|
||||
OLD_TAG=vCGCS_DEV_0018
|
||||
NEW_TAG=vCGCS_DEV_0019
|
||||
|
||||
OLD_BRANCH=CGCS_DEV_0018
|
||||
NEW_BRANCH=CGCS_DEV_0019
|
||||
|
||||
if [ -z "$MY_REPO" ]; then
|
||||
echo "MY_REPO is unset"
|
||||
exit 1
|
||||
else
|
||||
echo "MY_REPO is set to '$MY_REPO'"
|
||||
fi
|
||||
|
||||
if [ -d "$MY_REPO" ]; then
|
||||
cd $MY_REPO
|
||||
echo "checking out and pulling old branch"
|
||||
wrgit checkout $OLD_BRANCH
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: wrgit checkout $OLD_BRANCH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wrgit pull
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: wrgit pull"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Could not change to diectory '$MY_REPO'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Finding subgits"
|
||||
SUBGITS=`find . -type d -name ".git" | sed "s%/\.git$%%"`
|
||||
|
||||
# Go through all subgits and create the NEW_BRANCH if it does not already exist
|
||||
# Go through all subgits and create the NEW_TAG if it does not already exist
|
||||
for subgit in $SUBGITS; do
|
||||
echo ""
|
||||
echo ""
|
||||
pushd $subgit > /dev/null
|
||||
git fetch
|
||||
git fetch --tags
|
||||
# check if destination branch already exists
|
||||
echo "$subgit"
|
||||
branch_check=`git branch -a --list $NEW_BRANCH`
|
||||
if [ -z "$branch_check" ]
|
||||
then
|
||||
echo "Creating $NEW_BRANCH"
|
||||
git checkout $OLD_BRANCH
|
||||
git checkout -b $NEW_BRANCH
|
||||
git push origin $NEW_BRANCH:$NEW_BRANCH
|
||||
else
|
||||
echo "$NEW_BRANCH already exists"
|
||||
fi
|
||||
tag_check=`git tag -l $NEW_TAG`
|
||||
if [ -z "$tag_check" ]
|
||||
then
|
||||
echo "Creating $NEW_TAG"
|
||||
# create tag
|
||||
git checkout $NEW_BRANCH
|
||||
git pull origin
|
||||
git tag $NEW_TAG
|
||||
git push origin $NEW_TAG
|
||||
else
|
||||
echo "$NEW_TAG already exists"
|
||||
fi
|
||||
|
||||
popd > /dev/null
|
||||
done
|
||||
|
||||
echo "All done. branches and tags are pushed"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
56
build-tools/branching/create_branches_and_tags.sh
Executable file
56
build-tools/branching/create_branches_and_tags.sh
Executable file
@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ x"$1" = x ] ; then
|
||||
echo "ERROR: You must specify a name to create branches and tags"
|
||||
exit 1
|
||||
fi
|
||||
branch=$1
|
||||
tag="v$branch"
|
||||
|
||||
|
||||
|
||||
echo "Finding subgits"
|
||||
SUBGITS=`find . -type d -name ".git" | sed "s%/\.git$%%"`
|
||||
|
||||
# Go through all subgits and create the branch and tag if they does not already exist
|
||||
for subgit in $SUBGITS; do
|
||||
echo ""
|
||||
echo ""
|
||||
pushd $subgit > /dev/null
|
||||
|
||||
# check if destination branch already exists
|
||||
echo "$subgit"
|
||||
branch_check=`git branch -a --list $branch`
|
||||
if [ -z "$branch_check" ]
|
||||
then
|
||||
echo "Creating branch $branch"
|
||||
git checkout -b $branch
|
||||
if [ $? != 0 ] ; then
|
||||
echo "ERROR: Could not exec: git checkout -b $branch"
|
||||
popd > /dev/null
|
||||
exit 1
|
||||
fi
|
||||
# git push origin $branch:$branch
|
||||
else
|
||||
echo "Branch $branch already exists"
|
||||
git checkout $branch
|
||||
fi
|
||||
|
||||
tag_check=`git tag -l $tag`
|
||||
if [ -z "$tag_check" ]
|
||||
then
|
||||
echo "Creating tag $tag"
|
||||
git tag $tag
|
||||
if [ $? != 0 ] ; then
|
||||
echo "ERROR: Could not exec: git tag $tag"
|
||||
popd > /dev/null
|
||||
exit 1
|
||||
fi
|
||||
# git push origin $tag
|
||||
else
|
||||
echo "Tag $tag already exists"
|
||||
fi
|
||||
|
||||
popd > /dev/null
|
||||
done
|
||||
|
36
build-tools/branching/create_tags.sh
Executable file
36
build-tools/branching/create_tags.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ x"$1" = x ] ; then
|
||||
echo "ERROR: You must specify a name to create tags"
|
||||
exit 1
|
||||
fi
|
||||
tag=$1
|
||||
|
||||
|
||||
echo "Finding subgits"
|
||||
SUBGITS=`find . -type d -name ".git" | sed "s%/\.git$%%"`
|
||||
|
||||
# Go through all subgits and create the tag if it does not already exist
|
||||
for subgit in $SUBGITS; do
|
||||
echo ""
|
||||
echo ""
|
||||
pushd $subgit > /dev/null
|
||||
|
||||
tag_check=`git tag -l $tag`
|
||||
if [ -z "$tag_check" ]
|
||||
then
|
||||
echo "Creating tag $tag"
|
||||
git tag $tag
|
||||
if [ $? != 0 ] ; then
|
||||
echo "ERROR: Could not exec: git tag $tag"
|
||||
popd > /dev/null
|
||||
exit 1
|
||||
fi
|
||||
# git push origin $tag
|
||||
else
|
||||
echo "Tag $tag already exists"
|
||||
fi
|
||||
|
||||
popd > /dev/null
|
||||
done
|
||||
|
42
build-tools/branching/push_branches_tags.sh
Executable file
42
build-tools/branching/push_branches_tags.sh
Executable file
@ -0,0 +1,42 @@
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
if [ x"$1" = x ] ; then
|
||||
echo "ERROR: You must specify a name to create branches and tags"
|
||||
exit 1
|
||||
fi
|
||||
branch=$1
|
||||
tag="v$branch"
|
||||
|
||||
|
||||
|
||||
echo "Finding subgits"
|
||||
SUBGITS=`find . -type d -name ".git" | sed "s%/\.git$%%"`
|
||||
|
||||
# Go through all subgits and create the branch and tag if they does not already exist
|
||||
for subgit in $SUBGITS; do
|
||||
echo ""
|
||||
echo ""
|
||||
pushd $subgit > /dev/null
|
||||
|
||||
# check if destination branch already exists
|
||||
echo "$subgit"
|
||||
echo "Pushing branch $branch"
|
||||
git push origin $branch:$branch
|
||||
if [ $? != 0 ] ; then
|
||||
echo "ERROR: Could not exec: git push origin $branch:$branch"
|
||||
popd > /dev/null
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Pushing tag $tag"
|
||||
git push origin $tag
|
||||
if [ $? != 0 ] ; then
|
||||
echo "ERROR: Could not exec: git push origin $tag"
|
||||
popd > /dev/null
|
||||
exit 1
|
||||
fi
|
||||
|
||||
popd > /dev/null
|
||||
done
|
||||
|
29
build-tools/branching/push_tags.sh
Executable file
29
build-tools/branching/push_tags.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ x"$1" = x ] ; then
|
||||
echo "ERROR: You must specify a name to push tags"
|
||||
exit 1
|
||||
fi
|
||||
tag=$1
|
||||
|
||||
|
||||
echo "Finding subgits"
|
||||
SUBGITS=`find . -type d -name ".git" | sed "s%/\.git$%%"`
|
||||
|
||||
# Go through all subgits and create the tag if it does not already exist
|
||||
for subgit in $SUBGITS; do
|
||||
echo ""
|
||||
echo ""
|
||||
pushd $subgit > /dev/null
|
||||
|
||||
echo "Creating tag $tag"
|
||||
git push origin $tag
|
||||
if [ $? != 0 ] ; then
|
||||
echo "ERROR: Could not exec: git push origin $tag"
|
||||
popd > /dev/null
|
||||
exit 1
|
||||
fi
|
||||
|
||||
popd > /dev/null
|
||||
done
|
||||
|
338
build-tools/build-guest
Executable file
338
build-tools/build-guest
Executable file
@ -0,0 +1,338 @@
|
||||
#!/bin/env bash
|
||||
|
||||
#
|
||||
# Build the tis-centos-image.img or tis-centos-image-rt.img file
|
||||
#
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# NOTE: TMP_DIR must end in '/'
|
||||
# NOTE: /tmp/ is now tmpfs like. Can't be trusted across multiple mock commands
|
||||
# TMP_DIR=/tmp/
|
||||
TMP_DIR=/
|
||||
|
||||
# Use RPMs from the std build only, for now
|
||||
export BUILD_TYPE=std
|
||||
export MY_BUILD_DIR_TOP=$MY_BUILD_DIR
|
||||
|
||||
function init_vars {
|
||||
# Output path (current dir unless MY_WORKSPACE defined)
|
||||
OUTPUT_DIR="$PWD/export"
|
||||
if [ ! -z "$MY_WORKSPACE" ] && [ -d "$MY_WORKSPACE" ] ; then
|
||||
OUTPUT_DIR="$MY_WORKSPACE/export"
|
||||
CGCS_REPO_DIR="$MY_WORKSPACE/rpmbuild/RPMS"
|
||||
fi
|
||||
|
||||
if [ -n "$MY_GUEST_DIR" ]; then
|
||||
GUEST_DIR=$MY_GUEST_DIR
|
||||
else
|
||||
GUEST_DIR=$MY_WORKSPACE/guest
|
||||
fi
|
||||
|
||||
MOCK=/usr/bin/mock
|
||||
if [ $VERBOSE -eq 0 ]; then
|
||||
MOCK="$MOCK -q"
|
||||
fi
|
||||
|
||||
# Path to guest configuration
|
||||
GUEST_BUILD_DIR=$DIR/build_guest
|
||||
GUEST_BUILD_CMD=$GUEST_BUILD_DIR/build-guest-image.py
|
||||
if [ $VERBOSE -eq 1 ]; then
|
||||
GUEST_BUILD_CMD="$GUEST_BUILD_CMD -x"
|
||||
fi
|
||||
|
||||
if [ $BUILD_MODE == 'std' ]; then
|
||||
OUTPUT_FILE=$OUTPUT_DIR/tis-centos-guest.img
|
||||
elif [ $BUILD_MODE == 'rt' ]; then
|
||||
OUTPUT_FILE=$OUTPUT_DIR/tis-centos-guest-rt.img
|
||||
else
|
||||
printf " Error -- unknown BUILD_MODE '$BUILD_MODE'\n";
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function check_vars {
|
||||
# Where to store data
|
||||
printf "Finding cgcs-root\n"
|
||||
printf " Checking \$MY_REPO (value \"$MY_REPO\")\n"
|
||||
|
||||
if [ ! -z "$MY_REPO" ] && [ -d "$MY_REPO" ] ; then
|
||||
INTERNAL_REPO_ROOT=$MY_REPO
|
||||
printf " Found!\n"
|
||||
fi
|
||||
|
||||
if [ -z "$INTERNAL_REPO_ROOT" ] ; then
|
||||
printf " No joy -- checking \$MY_REPO_ROOT_DIR (value \"$MY_REPO_ROOT_DIR\")\n"
|
||||
if [ ! -z "$MY_REPO_ROOT_DIR" ] && [ -d "$MY_REPO_ROOT_DIR/cgcs-root" ] ; then
|
||||
INTERNAL_REPO_ROOT=$MY_REPO_ROOT_DIR/cgcs-root
|
||||
printf " Found!\n"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$INTERNAL_REPO_ROOT" ] ; then
|
||||
printf " No joy -- checking for \$MY_WORKSPACE/cgcs-root\n"
|
||||
if [ -d "$MY_WORKSPACE/cgcs-root" ] ; then
|
||||
INTERNAL_REPO_ROOT=$MY_WORKSPACE/cgcs-root
|
||||
printf " Found!\n"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$INTERNAL_REPO_ROOT" ] ; then
|
||||
printf " Error -- could not locate cgcs-root repo.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "x$MY_BUILD_CFG" == "x" ];then
|
||||
printf " Error -- reqiure MY_BUILD_CFG to be defined.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RELEASE_INFO=$INTERNAL_REPO_ROOT/addons/wr-cgcs/layers/cgcs/middleware/recipes-common/build-info/release-info.inc
|
||||
export PLATFORM_RELEASE=$(source $RELEASE_INFO && echo $PLATFORM_RELEASE)
|
||||
}
|
||||
|
||||
|
||||
function create_rootfs {
|
||||
printf "\nCreating guest file system\n"
|
||||
|
||||
mkdir -p $GUEST_DIR
|
||||
if [ $? -ne 0 ]; then
|
||||
printf " Error -- Could not create $GUEST_DIR\n";
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Place build-time environment variables in mock configuration
|
||||
GUEST_ENV="${MY_BUILD_ENVIRONMENT}-guest"
|
||||
GUEST_CFG=$GUEST_DIR/$MY_BUILD_ENVIRONMENT_FILE
|
||||
|
||||
MY_BUILD_ENVIRONMENT=$GUEST_ENV ${DIR}/modify-build-cfg $GUEST_CFG
|
||||
if [ $? -ne 0 ]; then
|
||||
printf " Error -- Could not update $GUEST_CFG\n";
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Setup mock directories for the guest
|
||||
if [ -d /localdisk/loadbuild/mock ]; then
|
||||
LNK=/localdisk/loadbuild/mock/$GUEST_ENV
|
||||
if [ ! -L $LNK ]; then
|
||||
ln -s $GUEST_DIR $LNK
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d /localdisk/loadbuild/mock-cache ]; then
|
||||
mkdir -p $GUEST_DIR/cache
|
||||
LNK=/localdisk/loadbuild/mock-cache/$GUEST_ENV
|
||||
if [ ! -L $LNK ]; then
|
||||
ln -s $GUEST_DIR/cache $LNK
|
||||
fi
|
||||
fi
|
||||
|
||||
# Setup mock chroot environment
|
||||
$MOCK -r $GUEST_CFG --clean && $MOCK -r $GUEST_CFG --init
|
||||
if [ $? -ne 0 ]; then
|
||||
printf " Error -- Failed to setup guest mock chroot\n";
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Install the RPMs to the root filesystem
|
||||
|
||||
# Note that the "rt" build needs access to both local-std and local-rt repos
|
||||
local EXTRA_REPOS=""
|
||||
|
||||
if [ $BUILD_MODE == 'std' ]; then
|
||||
INC_RPM_LIST=$(grep -v '^#' ${GUEST_BUILD_DIR}/rpm-install-list.txt)
|
||||
TIS_RPM_LIST=$(grep -v '^#' ${GUEST_BUILD_DIR}/image.inc)
|
||||
elif [ $BUILD_MODE == 'rt' ]; then
|
||||
INC_RPM_LIST=$(grep -v '^#' ${GUEST_BUILD_DIR}/rpm-install-list-rt.txt)
|
||||
TIS_RPM_LIST=$(grep -v '^#' ${GUEST_BUILD_DIR}/image-rt.inc)
|
||||
EXTRA_REPOS="--enablerepo local-rt"
|
||||
else
|
||||
printf " Error -- unknown BUILD_MODE '$BUILD_MODE'\n";
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$MOCK -r $GUEST_CFG --install ${INC_RPM_LIST} ${TIS_RPM_LIST} ${EXTRA_REPOS}
|
||||
if [ $? -ne 0 ]; then
|
||||
printf " Error -- Failed to install RPM packages\n";
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Remove RPMs that are not required in image (pruned package list)
|
||||
# NOTE: these are automatically installed from the mock init not
|
||||
# through dependencies.
|
||||
EXC_RPM_LIST=$(grep -v '^#' ${GUEST_BUILD_DIR}/rpm-remove-list.txt)
|
||||
|
||||
$MOCK -r $GUEST_CFG --remove ${EXC_RPM_LIST}
|
||||
if [ $? -ne 0 ]; then
|
||||
printf " Error -- Failed to remove RPM packages\n";
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf " Done\n"
|
||||
}
|
||||
|
||||
|
||||
function update_rootfs {
|
||||
printf "\nCustomizing guest file system\n"
|
||||
|
||||
# Copy over skeleton configuration files
|
||||
for GUEST_ROOTFS in $GUEST_BUILD_DIR/rootfs $GUEST_BUILD_DIR/rootfs-$BUILD_MODE;
|
||||
do
|
||||
for f in $(cd $GUEST_ROOTFS && find . -type f | cut -c3-);
|
||||
do
|
||||
echo "$MOCK -r $GUEST_CFG --copyin $GUEST_ROOTFS/$f $f"
|
||||
$MOCK -r $GUEST_CFG --copyin $GUEST_ROOTFS/$f $f
|
||||
if [ $? -ne 0 ]; then
|
||||
printf " Error -- Failed to copyin file $f\n";
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# Run the root file system setup script inside the chroot
|
||||
ROOTFS_SETUP=rootfs-setup.sh
|
||||
$MOCK -r $GUEST_CFG --copyin $GUEST_BUILD_DIR/$ROOTFS_SETUP $TMP_DIR && \
|
||||
if [ $BUILD_MODE == 'rt' ]; then
|
||||
ROOTFS_SETUP_CMD="$TMP_DIR$ROOTFS_SETUP --rt"
|
||||
elif [ $BUILD_MODE == 'std' ]; then
|
||||
ROOTFS_SETUP_CMD="$TMP_DIR$ROOTFS_SETUP --std"
|
||||
else
|
||||
ROOTFS_SETUP_CMD="$TMP_DIR$ROOTFS_SETUP"
|
||||
fi
|
||||
$MOCK -r $GUEST_CFG --chroot "$ROOTFS_SETUP_CMD"
|
||||
if [ $? -ne 0 ]; then
|
||||
printf " Error -- Failed to run guest $ROOTFS_SETUP\n";
|
||||
exit 1
|
||||
fi
|
||||
$MOCK -r $GUEST_CFG --chroot "rm -f $TMP_DIR$ROOTFS_SETUP"
|
||||
if [ $? -ne 0 ]; then
|
||||
printf " Error -- Failed to delete $ROOTFS_SETUP from guest\n";
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf " Done\n"
|
||||
}
|
||||
|
||||
|
||||
function build_image {
|
||||
# Build the image
|
||||
printf "\nBuilding guest image $OUTPUT_FILE\n"
|
||||
|
||||
mkdir -p $OUTPUT_DIR
|
||||
if [ $? -ne 0 ]; then
|
||||
printf " Error -- Could not create $OUTPUT_DIR\n";
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build guest rootfs archive
|
||||
ROOTFS_SPACE=$((500*1024*1024))
|
||||
ROOTFS_TAR=rootfs.tar
|
||||
ROOTFS_EXCLUDE=rootfs-exclude.txt
|
||||
|
||||
$MOCK -r $GUEST_CFG --copyin $GUEST_BUILD_DIR/$ROOTFS_EXCLUDE $TMP_DIR
|
||||
$MOCK -r $GUEST_CFG --chroot -- tar -cf $TMP_DIR$ROOTFS_TAR -X $TMP_DIR$ROOTFS_EXCLUDE --numeric-owner /
|
||||
$MOCK -r $GUEST_CFG --copyout $TMP_DIR$ROOTFS_TAR $GUEST_DIR
|
||||
$MOCK -r $GUEST_CFG --chroot -- rm -f $TMP_DIR$ROOTFS_TAR
|
||||
|
||||
$GUEST_BUILD_CMD -i $GUEST_DIR/$ROOTFS_TAR -o $OUTPUT_FILE -s $ROOTFS_SPACE
|
||||
if [ $? -ne 0 ]; then
|
||||
printf " Error -- Failed to build guest image\n";
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf " Done\n"
|
||||
}
|
||||
|
||||
|
||||
function clean_guest {
|
||||
printf "\nCleaning the guest $GUEST_DIR\n"
|
||||
|
||||
if [ ! -e $GUEST_DIR ]; then
|
||||
printf " Done...nothing to do\n";
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Place build-time environment variables in mock configuration
|
||||
GUEST_ENV="${MY_BUILD_ENVIRONMENT}-guest"
|
||||
GUEST_CFG=$GUEST_DIR/$MY_BUILD_ENVIRONMENT_FILE
|
||||
|
||||
if [ ! -e $GUEST_CFG ]; then
|
||||
MY_BUILD_ENVIRONMENT=$GUEST_ENV ${DIR}/modify-build-cfg $GUEST_CFG
|
||||
if [ $? -ne 0 ]; then
|
||||
printf " Error -- Could not update $GUEST_CFG\n";
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
$MOCK -r $GUEST_CFG --clean
|
||||
$MOCK -r $GUEST_CFG --scrub=cache
|
||||
|
||||
rm -rf $GUEST_DIR
|
||||
if [ $? -ne 0 ]; then
|
||||
printf " Error -- Failed to remove guest $GUEST_DIR\n";
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf " Done\n"
|
||||
}
|
||||
|
||||
#############################################
|
||||
# Main code
|
||||
#############################################
|
||||
|
||||
usage () {
|
||||
echo ""
|
||||
echo "Usage: "
|
||||
echo " build-guest [--rt | --std] [--verbose]"
|
||||
echo " build-guest [--help]"
|
||||
echo " build-guest [--clean]"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Default argument values
|
||||
HELP=0
|
||||
CLEAN=0
|
||||
VERBOSE=0
|
||||
BUILD_MODE='std'
|
||||
|
||||
# read the options
|
||||
TEMP=`getopt -o h --long clean --long rt --long std --long verbose -n 'test.sh' -- "$@"`
|
||||
eval set -- "$TEMP"
|
||||
|
||||
# extract options and their arguments into variables.
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-h|--help) HELP=1 ; shift ;;
|
||||
--clean) CLEAN=1 ; shift ;;
|
||||
--verbose) VERBOSE=1 ; shift ;;
|
||||
--rt) BUILD_MODE='rt' ; shift ;;
|
||||
--std) BUILD_MODE='std' ; shift ;;
|
||||
--) shift ; break ;;
|
||||
*) echo "Internal error!" ; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $HELP -eq 1 ]; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
(
|
||||
printf "\n*****************************\n"
|
||||
printf "Create Titanium Cloud/CentOS Guest Image\n"
|
||||
printf "*****************************\n\n"
|
||||
|
||||
init_vars
|
||||
check_vars
|
||||
|
||||
if [ $CLEAN -eq 1 ]; then
|
||||
clean_guest
|
||||
exit 0
|
||||
fi
|
||||
|
||||
create_rootfs
|
||||
update_rootfs
|
||||
build_image
|
||||
|
||||
) 2>&1 | stdbuf -o0 awk '{ print strftime("%H:%M:%S"), $0; fflush(); }' ; exit ${PIPESTATUS[0]}
|
94
build-tools/build-img
Executable file
94
build-tools/build-img
Executable file
@ -0,0 +1,94 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Build an IMG file capable of being booted in a virtual environment
|
||||
# The default settings are vda device which the Cumulus environment expects
|
||||
# and controller mode
|
||||
|
||||
usage () {
|
||||
echo ""
|
||||
echo "Usage: "
|
||||
echo " build-img [--cpe] [--dest <filename>] [--part [1 | 2]]"
|
||||
echo " --dest <tis.img>"
|
||||
echo " --cpe Boots in CPE mode. Default is controller mode."
|
||||
echo ""
|
||||
}
|
||||
|
||||
DEST_ISO=bootimage_auto.iso
|
||||
DEST_IMG=tis.img
|
||||
AUTO_MODE=controller
|
||||
HELP=0
|
||||
PART=0
|
||||
|
||||
# read the options
|
||||
TEMP=`getopt -o hp:d: --long help,cpe,part:,dest: -n 'test.sh' -- "$@"`
|
||||
eval set -- "$TEMP"
|
||||
|
||||
# extract options and their arguments into variables.
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-h|--help) HELP=1 ; shift ;;
|
||||
--cpe) AUTO_MODE=cpe; shift ;;
|
||||
-d | --dest) DEST_IMG="$2"; shift; shift ;;
|
||||
-p | --part) PART="$2"; shift; shift ;;
|
||||
--) shift ; break ;;
|
||||
*) echo "Internal error!" ; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $HELP -eq 1 ]; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo PART=$PART
|
||||
|
||||
# Step 1: Build an ISO that autoboots
|
||||
|
||||
# Cumulus default device is vda
|
||||
if [ $PART -ne 2 ]; then
|
||||
build-iso --file bootimage_auto.iso --auto $AUTO_MODE --device vda --cumulus
|
||||
fi
|
||||
|
||||
# Step 2: Convert the ISO to IMG
|
||||
if [ $PART -ne 1 ]; then
|
||||
if [ ! -e "/dev/loop-control" -o ! -e "/dev/kvm" ]; then
|
||||
CMD="cd $MY_WORKSPACE/export; \
|
||||
$MY_REPO/addons/wr-cgcs/layers/cgcs/extras.ND/scripts/install_iso_to_disk_image.sh bootimage_auto.iso $DEST_IMG"
|
||||
|
||||
if [ "$HOSTNAME" == "yow-cgts3-centos7" ]; then
|
||||
echo "Attempting to run kvm_iso_to_img on yow-cgts3-lx"
|
||||
ssh -o StrictHostKeyChecking=no yow-cgts3-lx "$CMD"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to run update-efiboot-image on yow-cgts3-lx"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$HOSTNAME" == "yow-cgts2-centos7" ]; then
|
||||
echo "Attempting to run kvm_iso_to_img on yow-cgts2-lx"
|
||||
ssh -o StrictHostKeyChecking=no yow-cgts2-lx "$CMD"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to run update-efiboot-image on yow-cgts2-lx"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "$MY_WORKSPACE/export/$DEST_IMG" ]; then
|
||||
printf "\n"
|
||||
printf "****************************************************************** \n"
|
||||
printf "No kvm and/or loop device on this machine. To complete the build \n"
|
||||
printf "please copy '$MY_WORKSPACE/export/bootimage_auto.iso' to a machine \n"
|
||||
printf "that supports kvm and loop devices and run ... \n"
|
||||
printf " $MY_REPO/addons/wr-cgcs/layers/cgcs/extras.ND/scripts/install_iso_to_disk_image.sh bootimage_auto.iso $DEST_IMG\n"
|
||||
printf "****************************************************************** \n"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "$MY_WORKSPACE/export/$DEST_IMG" ]; then
|
||||
(
|
||||
cd $MY_WORKSPACE/export
|
||||
$MY_REPO/addons/wr-cgcs/layers/cgcs/extras.ND/scripts/install_iso_to_disk_image.sh bootimage_auto.iso $DEST_IMG
|
||||
exit $?
|
||||
)
|
||||
fi
|
||||
fi
|
||||
|
702
build-tools/build-iso
Executable file
702
build-tools/build-iso
Executable file
@ -0,0 +1,702 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Build the export/bootimage.iso file
|
||||
#
|
||||
# This script uses environment variables to determine the source of
|
||||
# packages, and bundles the packages into a bootable .iso
|
||||
#
|
||||
# It starts by building a basic "vanilla CentOS" ISO, and then adds our
|
||||
# packages to it.
|
||||
|
||||
usage () {
|
||||
echo ""
|
||||
echo "Usage: "
|
||||
echo " build-iso [--auto <mode>] [--file <filename>] [--device <device>] [--skip-sign]"
|
||||
echo " --file <bootimage.iso> destination ISO file"
|
||||
echo " --auto <controller|cpe> Modify kickstart to auto-install controller or cpe mode"
|
||||
echo " --device <sda> Use a different boot/rootds device (default is sda)"
|
||||
echo " --skip-sign do not add file signature to RPMs"
|
||||
echo ""
|
||||
}
|
||||
|
||||
MY_YUM_CONF=""
|
||||
|
||||
NPROCS=$(nproc)
|
||||
|
||||
export MOCK=/usr/bin/mock
|
||||
|
||||
CREATEREPO=$(which createrepo_c)
|
||||
if [ $? -ne 0 ]; then
|
||||
CREATEREPO="createrepo"
|
||||
fi
|
||||
|
||||
# TEMPORARY: Check for isohybrid now to give a warning about installing pkg
|
||||
if [ ! -f /usr/bin/isohybrid ]; then
|
||||
echo "Missing required utility: /usr/bin/isohybrid"
|
||||
echo "Installation of syslinux is required:"
|
||||
echo " sudo yum install -y syslinux"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function install_pkg_list {
|
||||
local PKGLIST=$1
|
||||
if [ "x$PKGLIST" == "x" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
OLD_PWD=$PWD
|
||||
|
||||
echo "Installing packages listed in $PKGLIST and dependancies"
|
||||
\rm -f $OUTPUT_DIR/dist/report_deps.txt
|
||||
$CREATEREPO $CGCS_REPO_DIR
|
||||
$CREATEREPO $CGCS_RT_REPO_DIR
|
||||
|
||||
\cp -v $MY_YUM_CONF $OUTPUT_DIR
|
||||
|
||||
\cd $OUTPUT_DIST_DIR/isolinux/Packages
|
||||
$INTERNAL_REPO_ROOT/build-tools/build_iso/cgts_deps.sh --deps=$PKGLIST
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "Could not install dependencies"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# clean up
|
||||
echo "Removing local-std yum repo $CGCS_REPO_DIR/repodata"
|
||||
echo "Removing local-rt yum repo $CGCS_RT_REPO_DIR/repodata"
|
||||
|
||||
\cd $OLD_PWD
|
||||
}
|
||||
|
||||
# Generate the report of where all packages come from
|
||||
function make_report {
|
||||
local PKGLISTFILES=$@
|
||||
if [ "x$PKGLISTFILES" == "x" ]; then
|
||||
return 1
|
||||
fi
|
||||
echo "MAKING $REPORT_FILE"
|
||||
echo "-----------------" >> $REPORT_FILE
|
||||
|
||||
echo "ISO REPORT" > $REPORT_FILE
|
||||
date >> $REPORT_FILE
|
||||
echo "-----------------" >> $REPORT_FILE
|
||||
|
||||
echo " " >> $REPORT_FILE
|
||||
echo "-----------------" >> $REPORT_FILE
|
||||
echo "EXPLICIT INCLUDES" >> $REPORT_FILE
|
||||
echo "-----------------" >> $REPORT_FILE
|
||||
for PKGLIST in $PKGLISTFILES; do
|
||||
while read PKG; do
|
||||
PKG=`echo $PKG | sed "s/#.*//"`;
|
||||
if [ "${PKG}x" != "x" ]; then
|
||||
echo $PKG >> $REPORT_FILE
|
||||
fi
|
||||
done < $PKGLIST
|
||||
done
|
||||
|
||||
echo " " >> $REPORT_FILE
|
||||
echo "-----------------" >> $REPORT_FILE
|
||||
echo " PACKAGES " >> $REPORT_FILE
|
||||
echo "-----------------" >> $REPORT_FILE
|
||||
cat $BUILT_REPORT | sort | uniq >> $REPORT_FILE
|
||||
|
||||
echo " " >> $REPORT_FILE
|
||||
echo "-----------------" >> $REPORT_FILE
|
||||
echo " WARNINGS " >> $REPORT_FILE
|
||||
echo "-----------------" >> $REPORT_FILE
|
||||
|
||||
# Note that the warnings file may have multiple lines for the same
|
||||
# missing dependency. A sort | uniq solves this so we don't duplicate
|
||||
# warnings
|
||||
cat $WARNINGS_REPORT | sort | uniq >> $REPORT_FILE
|
||||
|
||||
echo "ISO REPORT: $REPORT_FILE"
|
||||
}
|
||||
|
||||
function init_vars {
|
||||
#####################################
|
||||
# Input definitions
|
||||
|
||||
# Where all CentOS packages live
|
||||
# Where essential CentOS (minimal install) packages live
|
||||
INTERNAL_REPO_ROOT=
|
||||
# Where our own packages live
|
||||
CGCS_REPO_DIR=$MY_WORKSPACE/std/rpmbuild/RPMS
|
||||
CGCS_RT_REPO_DIR=$MY_WORKSPACE/rt/rpmbuild/RPMS
|
||||
|
||||
MY_YUM_CONF=$(create-yum-conf)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: create-yum-conf failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DISTRO_REPO_DIR=$(for d in $(grep baseurl $MY_YUM_CONF | grep file: | awk -F : '{print $2}' | sed 's:///:/:g'); do if [ -d $d/images ]; then echo $d ;fi; done)
|
||||
|
||||
#####################################
|
||||
# Output definitons
|
||||
|
||||
# where to put stuff (curent dir unless MY_WORKSPACE defined)
|
||||
OUTPUT_DIR="$PWD/export"
|
||||
if [ ! -z "$MY_WORKSPACE" ] && [ -d "$MY_WORKSPACE" ] ; then
|
||||
OUTPUT_DIR="$MY_WORKSPACE/export"
|
||||
CGCS_REPO_DIR="$MY_WORKSPACE/std/rpmbuild/RPMS"
|
||||
CGCS_RT_REPO_DIR="$MY_WORKSPACE/rt/rpmbuild/RPMS"
|
||||
fi
|
||||
|
||||
# Directory in which to populate files to be distributed
|
||||
if [ $CUMULUS -eq 0 ]; then
|
||||
OUTPUT_DIST_DIR=$OUTPUT_DIR/dist
|
||||
else
|
||||
OUTPUT_DIST_DIR=$OUTPUT_DIR/dist-cumulus
|
||||
fi
|
||||
|
||||
# Package disc image
|
||||
OUTPUT_FILE=$OUTPUT_DIR/$DEST_FILE
|
||||
|
||||
# Generate an error if the output file is below this threshold
|
||||
MINIMUM_EXPECTED_SIZE=500000000
|
||||
|
||||
|
||||
# report variables
|
||||
REPORT_FILE=$OUTPUT_DIR/report.txt
|
||||
BUILT_REPORT=$OUTPUT_DIR/local.txt
|
||||
CLOUD_REPORT=$OUTPUT_DIR/cloud.txt
|
||||
CLOUD_COMMON_REPORT=$OUTPUT_DIR/cloudcommon.txt
|
||||
CENTOS_REPORT=$OUTPUT_DIR/centos.txt
|
||||
EPEL_REPORT=$OUTPUT_DIR/epel.txt
|
||||
WARNINGS_REPORT=$OUTPUT_DIR/warnings.txt
|
||||
|
||||
\rm -f $REPORT_FILE
|
||||
\rm -f $BUILT_REPORT
|
||||
\rm -f $CLOUD_REPORT
|
||||
\rm -f $CLOUD_COMMON_REPORT
|
||||
\rm -f $CENTOS_REPORT
|
||||
\rm -f $WARNINGS_REPORT
|
||||
}
|
||||
|
||||
# check input variables
|
||||
function check_vars {
|
||||
# Where to store data
|
||||
printf "Finding cgcs-root\n"
|
||||
printf " Checking \$MY_REPO (value \"$MY_REPO\")\n"
|
||||
|
||||
if [ ! -z "$MY_REPO" ] && [ -d "$MY_REPO" ] ; then
|
||||
INTERNAL_REPO_ROOT=$MY_REPO
|
||||
printf " Found!\n"
|
||||
fi
|
||||
|
||||
if [ -z "$INTERNAL_REPO_ROOT" ] ; then
|
||||
printf " No joy -- checking \$MY_REPO_ROOT_DIR (value \"$MY_REPO_ROOT_DIR\")\n"
|
||||
if [ ! -z "$MY_REPO_ROOT_DIR" ] && [ -d "$MY_REPO_ROOT_DIR/cgcs-root" ] ; then
|
||||
INTERNAL_REPO_ROOT=$MY_REPO_ROOT_DIR/cgcs-root
|
||||
printf " Found!\n"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$INTERNAL_REPO_ROOT" ] ; then
|
||||
printf " No joy -- checking for \$MY_WORKSPACE/cgcs-root\n"
|
||||
if [ -d "$MY_WORKSPACE/cgcs-root" ] ; then
|
||||
INTERNAL_REPO_ROOT=$MY_WORKSPACE/cgcs-root
|
||||
printf " Found!\n"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$INTERNAL_REPO_ROOT" ] ; then
|
||||
printf " Error -- could not locate cgcs-root repo.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf "\nChecking that we can access $DISTRO_REPO_DIR\n"
|
||||
if [ ! -d "$DISTRO_REPO_DIR" ] ; then
|
||||
printf " Error -- could not access $DISTRO_REPO_DIR\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e "$DISTRO_REPO_DIR/repodata" ] ; then
|
||||
printf " Error -- $DISTRO_REPO_DIR is there, but does not seem sane\n"
|
||||
fi
|
||||
|
||||
printf "\nOkay, input looks fine...\n\n"
|
||||
printf "Creating output directory $OUTPUT_DIST_DIR\n"
|
||||
if [ $CLEAN_FLAG -eq 1 ]; then
|
||||
echo " Cleaning..."
|
||||
if [ -e $OUTPUT_DIST_DIR ] ; then
|
||||
chmod -R a+w $OUTPUT_DIST_DIR
|
||||
\rm -rf $OUTPUT_DIST_DIR
|
||||
fi
|
||||
if [ -e $OUTPUT_DIST_DIR ] ; then
|
||||
printf "Error: could not remove old $OUTPUT_DIST_DIR\n"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
\mkdir -p $OUTPUT_DIST_DIR
|
||||
if [ ! -d $OUTPUT_DIST_DIR ] ; then
|
||||
printf "Error: could not create $OUTPUT_DIST_DIR\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RELEASE_INFO=$INTERNAL_REPO_ROOT/addons/wr-cgcs/layers/cgcs/middleware/recipes-common/build-info/release-info.inc
|
||||
export PLATFORM_RELEASE=$(source $RELEASE_INFO && echo $PLATFORM_RELEASE)
|
||||
|
||||
echo " Done"
|
||||
echo ""
|
||||
}
|
||||
|
||||
function init_output_dir {
|
||||
echo "Creating base output directory in $OUTPUT_DIST_DIR"
|
||||
\mkdir -p $OUTPUT_DIST_DIR/isolinux/images
|
||||
\mkdir -p $OUTPUT_DIST_DIR/isolinux/ks
|
||||
\mkdir -p $OUTPUT_DIST_DIR/isolinux/LiveOS
|
||||
\mkdir -p $OUTPUT_DIST_DIR/isolinux/Packages
|
||||
\mkdir -p $OUTPUT_DIST_DIR/utils
|
||||
|
||||
\mkdir -p $OUTPUT_DIST_DIR/isolinux/EFI
|
||||
# This directory will contains files required for the PXE network installer
|
||||
\mkdir -p $OUTPUT_DIST_DIR/isolinux/pxeboot
|
||||
|
||||
echo " Copying base files"
|
||||
|
||||
# Generate .discinfo file
|
||||
date +%s.%N > $OUTPUT_DIST_DIR/isolinux/.discinfo
|
||||
echo $PLATFORM_RELEASE >> $OUTPUT_DIST_DIR/isolinux/.discinfo
|
||||
echo "x86_64" >> $OUTPUT_DIST_DIR/isolinux/.discinfo
|
||||
|
||||
\cp -L -ru $DISTRO_REPO_DIR/isolinux/* $OUTPUT_DIST_DIR/isolinux/
|
||||
\cp -L -ru $DISTRO_REPO_DIR/images/pxeboot $OUTPUT_DIST_DIR/isolinux/images/
|
||||
|
||||
echo " Installing startup files"
|
||||
|
||||
\cp -L $INTERNAL_REPO_ROOT/addons/wr-cgcs/layers/cgcs/mwa-beas/bsp-files/centos.syslinux.cfg $OUTPUT_DIST_DIR/isolinux/syslinux.cfg
|
||||
\cp -L $INTERNAL_REPO_ROOT/addons/wr-cgcs/layers/cgcs/mwa-beas/bsp-files/centos.syslinux.cfg $OUTPUT_DIST_DIR/isolinux/isolinux.cfg
|
||||
sed -i 's/wr_usb_boot/oe_iso_boot/' $OUTPUT_DIST_DIR/isolinux/isolinux.cfg
|
||||
|
||||
# Modify the isolinux.cfg to auto install if requested
|
||||
# Option 0 is Controller(serial). Option 2 is CPE serial.
|
||||
if [ "$AUTO_INSTALL" == "controller" ] ; then
|
||||
echo "Modifying ISO to auto-install controller load"
|
||||
perl -p -i -e 's/timeout 0/timeout 1\ndefault 0/' $OUTPUT_DIST_DIR/isolinux/isolinux.cfg
|
||||
elif [ "$AUTO_INSTALL" == "cpe" ] ; then
|
||||
echo "Modifying ISO to auto-install CPE (combined load)"
|
||||
perl -p -i -e 's/timeout 0/timeout 1\ndefault 2/' $OUTPUT_DIST_DIR/isolinux/isolinux.cfg
|
||||
fi
|
||||
|
||||
# Modify the device if requested
|
||||
if [ ! -z "$DEVICE" ] ; then
|
||||
echo "Modifying ISO to use device $DEVICE"
|
||||
perl -p -i -e "s/device=sda/device=${DEVICE}/g" $OUTPUT_DIST_DIR/isolinux/isolinux.cfg
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Copy UEFI files
|
||||
\cp -L -ru $DISTRO_REPO_DIR/EFI/* $OUTPUT_DIST_DIR/isolinux/EFI/
|
||||
\cp -L $INTERNAL_REPO_ROOT/addons/wr-cgcs/layers/cgcs/mwa-beas/bsp-files/grub.cfg $OUTPUT_DIST_DIR/isolinux/EFI/BOOT/grub.cfg
|
||||
\cp -L $INTERNAL_REPO_ROOT/addons/wr-cgcs/layers/cgcs/mwa-beas/bsp-files/pxeboot_grub.cfg $OUTPUT_DIST_DIR/isolinux/pxeboot/pxeboot_grub.cfg
|
||||
|
||||
# Update the efiboot.img (See https://wiki.archlinux.org/index.php/Remastering_the_Install_ISO)
|
||||
# We need to mount the image file, replace the grub.cfg file with the Titanium Cloud one, and unmount.
|
||||
# Script update-efiboot-image will do this. If there is not loop device on the build machine
|
||||
# then this script must be executed manually prior.
|
||||
|
||||
if [ ! -e "/dev/loop-control" -a ! -f "$OUTPUT_DIR/efiboot.img" ]; then
|
||||
CMD="export PROJECT=$PROJECT; \
|
||||
export SRC_BUILD_ENVIRONMENT=$SRC_BUILD_ENVIRONMENT; \
|
||||
export MY_BUILD_ENVIRONMENT=$MY_BUILD_ENVIRONMENT; \
|
||||
export MY_BUILD_ENVIRONMENT_FILE=$MY_BUILD_ENVIRONMENT_FILE; \
|
||||
export MY_BUILD_DIR=$MY_BUILD_DIR; \
|
||||
export MY_WORKSPACE=$MY_WORKSPACE; \
|
||||
export MY_REPO=$MY_REPO; \
|
||||
export MY_BUILD_CFG=$MY_BUILD_CFG; \
|
||||
export MY_MOCK_ROOT=$MY_MOCK_ROOT; \
|
||||
export PATH=$MY_REPO/build-tools:\$PATH; \
|
||||
update-efiboot-image"
|
||||
|
||||
if [ "$HOSTNAME" == "yow-cgts3-centos7" ]; then
|
||||
echo "Attempting to run update-efiboot-image on yow-cgts3-lx"
|
||||
ssh -o StrictHostKeyChecking=no yow-cgts3-lx "$CMD"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to run update-efiboot-image on yow-cgts3-lx"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$HOSTNAME" == "yow-cgts2-centos7" ]; then
|
||||
echo "Attempting to run update-efiboot-image on yow-cgts2-lx"
|
||||
ssh -o StrictHostKeyChecking=no yow-cgts2-lx "$CMD"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to run update-efiboot-image on yow-cgts2-lx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -e "/dev/loop-control" -a ! -f "$OUTPUT_DIR/efiboot.img" ]; then
|
||||
printf "\n**************************************************************************************************** \n"
|
||||
printf "No loop device on this machine. Please ensure $OUTPUT_DIR/efiboot.img \n"
|
||||
printf "exist prior to executing build-iso by. It can be created by running \n"
|
||||
printf " $INTERNAL_REPO_ROOT/build-tools/update-efiboot-image \n"
|
||||
printf "on a machine that does support a loop device. Please ensure all standard \n"
|
||||
printf "build environment variables are defined (e.g. MY_REPO, MY_WORKSPACE, etc.). \n"
|
||||
printf " \n"
|
||||
printf "e.g. If building on yow-cgts3-centos7, you'll want to run the script on \n"
|
||||
printf " yow-cgts3-lx which shares the same file system, but supports loop devices \n"
|
||||
printf "****************************************************************************************************** \n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f "$OUTPUT_DIR/efiboot.img" ]; then
|
||||
|
||||
# The script update-efiboot-image was run outside the build-iso script, do nothing.
|
||||
printf " The image file $OUTPUT_DIR/efiboot.img already exist\n"
|
||||
else
|
||||
printf " The image file $OUTPUT_DIR/efiboot.img does not exist \n"
|
||||
if [ ! -f "$INTERNAL_REPO_ROOT/build-tools/update-efiboot-image" ]; then
|
||||
printf "*** Error: script update-efiboot-image does not exist *** \n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run the script
|
||||
$INTERNAL_REPO_ROOT/build-tools/update-efiboot-image
|
||||
RET=$?
|
||||
if [ $RET != 0 ]; then
|
||||
printf "*** Error: update-efiboot-image script returned failure $RET *** \n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
\cp -L $OUTPUT_DIR/efiboot.img $OUTPUT_DIST_DIR/isolinux/images/
|
||||
\rm -f $OUTPUT_DIR/efiboot.img
|
||||
|
||||
# Copy and set up pxeboot setup files
|
||||
\cp $INTERNAL_REPO_ROOT/addons/wr-cgcs/layers/cgcs/mwa-beas/bsp-files/pxeboot_setup.sh $OUTPUT_DIST_DIR/isolinux/pxeboot_setup.sh
|
||||
\cp $INTERNAL_REPO_ROOT/addons/wr-cgcs/layers/cgcs/mwa-beas/bsp-files/pxeboot.cfg $OUTPUT_DIST_DIR/isolinux/pxeboot/pxeboot.cfg
|
||||
chmod +x $OUTPUT_DIST_DIR/isolinux/pxeboot_setup.sh
|
||||
|
||||
\rm -f $OUTPUT_DIST_DIR/comps.xml
|
||||
\cp -L $INTERNAL_REPO_ROOT/build-tools/build_iso/comps.xml.gz $OUTPUT_DIST_DIR/
|
||||
gunzip $OUTPUT_DIST_DIR/comps.xml.gz
|
||||
|
||||
TMP_DIR=$MY_WORKSPACE/tmp
|
||||
\mkdir -p $TMP_DIR
|
||||
TMPDIR=$TMP_DIR yum clean all -c $MY_YUM_CONF
|
||||
\rm -rf $TMP_DIR/yum-$USER-*
|
||||
echo " Done"
|
||||
echo ""
|
||||
}
|
||||
|
||||
function final_touches {
|
||||
OLD_PWD=$PWD
|
||||
|
||||
# Update the comps.xml
|
||||
if [ ! -f $OUTPUT_DIST_DIR/comps.xml.bak ]; then
|
||||
\cp $OUTPUT_DIST_DIR/comps.xml $OUTPUT_DIST_DIR/comps.xml.bak
|
||||
fi
|
||||
|
||||
python $INTERNAL_REPO_ROOT/addons/wr-cgcs/layers/cgcs/mwa-beas/bsp-files/platform_comps.py \
|
||||
--pkgdir $OUTPUT_DIST_DIR/isolinux/Packages \
|
||||
--groups $OUTPUT_DIST_DIR/comps.xml
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to update comps.xml"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# create the repo
|
||||
\cd $OUTPUT_DIST_DIR/isolinux
|
||||
$CREATEREPO -q -g ../comps.xml .
|
||||
|
||||
# build the ISO
|
||||
printf "Building image $OUTPUT_FILE\n"
|
||||
\cd $OUTPUT_DIST_DIR
|
||||
chmod 664 isolinux/isolinux.bin
|
||||
mkisofs -o $OUTPUT_FILE \
|
||||
-R -D -A 'oe_iso_boot' -V 'oe_iso_boot' \
|
||||
-quiet \
|
||||
-b isolinux.bin -c boot.cat -no-emul-boot \
|
||||
-boot-load-size 4 -boot-info-table \
|
||||
-eltorito-alt-boot \
|
||||
-e images/efiboot.img \
|
||||
-no-emul-boot \
|
||||
isolinux/
|
||||
|
||||
isohybrid --uefi $OUTPUT_FILE
|
||||
implantisomd5 $OUTPUT_FILE
|
||||
|
||||
\cd $OLD_PWD
|
||||
}
|
||||
|
||||
function extract_pkg_from_local_repo {
|
||||
local repodir=$1
|
||||
local pkgname=$2
|
||||
|
||||
local pkgfile=$(repoquery --repofrompath local,${repodir} --location -q ${pkgname})
|
||||
if [ -z "${pkgfile}" ]; then
|
||||
echo "Could not find package $pkgname in $repodir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rpm2cpio ${pkgfile/file://} | cpio -idmv
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to extract files from ${pkgfile/file://}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function extract_installer_files {
|
||||
# Changes to copied files here must also be reflected in patch-iso
|
||||
|
||||
CGCSDIR=$INTERNAL_REPO_ROOT/addons/wr-cgcs/layers/cgcs
|
||||
PKGDIR=$OUTPUT_DIST_DIR/isolinux/Packages
|
||||
|
||||
(
|
||||
\cd $OUTPUT_DIR
|
||||
\rm -rf kickstarts extra_cfgs kickstart.work
|
||||
\mkdir kickstarts extra_cfgs kickstart.work
|
||||
|
||||
echo "Retrieving kickstarts..."
|
||||
|
||||
\cd kickstart.work
|
||||
|
||||
extract_pkg_from_local_repo ${CGCS_REPO_DIR} platform-kickstarts
|
||||
extract_pkg_from_local_repo ${CGCS_REPO_DIR} platform-kickstarts-pxeboot
|
||||
extract_pkg_from_local_repo ${CGCS_REPO_DIR} platform-kickstarts-extracfgs
|
||||
|
||||
\cp --preserve=all www/pages/feed/rel-*/*.cfg pxeboot/*.cfg ../kickstarts/ &&
|
||||
\cp --preserve=all extra_cfgs/*.cfg ../extra_cfgs/
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to copy extracted kickstarts"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
\cd ..
|
||||
|
||||
# Copy kickstarts to ISO
|
||||
\cp --preserve=all kickstarts/controller_ks.cfg $OUTPUT_DIST_DIR/isolinux/ks.cfg
|
||||
# Modify the kickstart to shutdown instead of reboot if doing an auto install
|
||||
if [ ! -z "$AUTO_INSTALL" ] ; then
|
||||
sed -i 's/^reboot --eject/shutdown/' $OUTPUT_DIST_DIR/isolinux/ks.cfg
|
||||
fi
|
||||
|
||||
\mv kickstarts/pxeboot* $OUTPUT_DIST_DIR/isolinux/pxeboot/
|
||||
\cp --preserve=all kickstarts/* $OUTPUT_DIST_DIR/isolinux
|
||||
|
||||
# Update OAM interface for cumulus auto install
|
||||
if [ $CUMULUS -eq 1 ]; then
|
||||
# Cumulus wants tty1
|
||||
perl -p -i -e 's/console=tty0/console=tty1/' $OUTPUT_DIST_DIR/isolinux/isolinux.cfg
|
||||
|
||||
# CUMULUS setup scripts specify ens3 for OAM
|
||||
OAM_IFNAME=ens3
|
||||
|
||||
cat <<EOM >> $OUTPUT_DIST_DIR/isolinux/ks.cfg
|
||||
%post
|
||||
#For cumulus tis on tis automated install
|
||||
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-${OAM_IFNAME}
|
||||
IPADDR=10.10.10.3
|
||||
NETMASK=255.255.255.0
|
||||
BOOTPROTO=static
|
||||
ONBOOT=yes
|
||||
DEVICE=${OAM_IFNAME}
|
||||
MTU=1500
|
||||
GATEWAY=10.10.10.1
|
||||
EOF
|
||||
%end
|
||||
EOM
|
||||
fi
|
||||
|
||||
# For PXE boot network installer
|
||||
|
||||
echo ${OUTPUT_DIST_DIR}/isolinux/Packages
|
||||
|
||||
local WORKDIR=pxe-network-installer.content
|
||||
local ORIG_PWD=$PWD
|
||||
|
||||
\rm -rf $WORKDIR
|
||||
\mkdir $WORKDIR
|
||||
\cd $WORKDIR
|
||||
|
||||
extract_pkg_from_local_repo ${CGCS_REPO_DIR} pxe-network-installer
|
||||
extract_pkg_from_local_repo ${CGCS_REPO_DIR} grub2-efi-pxeboot
|
||||
|
||||
\mkdir -p $OUTPUT_DIST_DIR/isolinux/pxeboot/EFI/centos/x86_64-efi
|
||||
|
||||
\cp --preserve=all pxeboot/pxelinux.0 pxeboot/menu.c32 pxeboot/chain.c32 $OUTPUT_DIST_DIR/isolinux/pxeboot &&
|
||||
\cp --preserve=all pxeboot/EFI/centos/x86_64-efi/* $OUTPUT_DIST_DIR/isolinux/pxeboot/EFI/centos/x86_64-efi/ &&
|
||||
\cp --preserve=all pxeboot/EFI/grubx64.efi $OUTPUT_DIST_DIR/isolinux/pxeboot/EFI/
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Could not copy all files from installer"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
\cp --preserve=all www/pages/feed/rel-*/LiveOS/squashfs.img $OUTPUT_DIST_DIR/isolinux/LiveOS
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Could not copy squashfs from LiveOS"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Replace vmlinuz and initrd.img with our own pre-built ones
|
||||
\rm -f \
|
||||
$OUTPUT_DIST_DIR/isolinux/vmlinuz \
|
||||
$OUTPUT_DIST_DIR/isolinux/images/pxeboot/vmlinuz \
|
||||
$OUTPUT_DIST_DIR/isolinux/initrd.img \
|
||||
$OUTPUT_DIST_DIR/isolinux/images/pxeboot/initrd.img
|
||||
\cp --preserve=all pxeboot/rel-*/installer-bzImage_1.0 \
|
||||
$OUTPUT_DIST_DIR/isolinux/vmlinuz &&
|
||||
\cp --preserve=all pxeboot/rel-*/installer-bzImage_1.0 \
|
||||
$OUTPUT_DIST_DIR/isolinux/images/pxeboot/vmlinuz &&
|
||||
\cp --preserve=all pxeboot/rel-*/installer-intel-x86-64-initrd_1.0 \
|
||||
$OUTPUT_DIST_DIR/isolinux/initrd.img &&
|
||||
\cp --preserve=all pxeboot/rel-*/installer-intel-x86-64-initrd_1.0 \
|
||||
$OUTPUT_DIST_DIR/isolinux/images/pxeboot/initrd.img
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Failed to copy installer images"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
\cd $ORIG_PWD
|
||||
\rm -rf $WORKDIR
|
||||
)
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function setup_upgrades_files {
|
||||
# Changes to copied files here must also be reflected in patch-iso
|
||||
|
||||
# Copy the upgrade files
|
||||
UPGRADES_DIR="$OUTPUT_DIST_DIR/isolinux/upgrades"
|
||||
\rm -rf $UPGRADES_DIR
|
||||
\mkdir -p $UPGRADES_DIR
|
||||
\cp $INTERNAL_REPO_ROOT/addons/wr-cgcs/layers/cgcs/mwa-beas/bsp-files/upgrades/* $UPGRADES_DIR
|
||||
sed -i "s/xxxSW_VERSIONxxx/${PLATFORM_RELEASE}/g" $UPGRADES_DIR/metadata.xml
|
||||
chmod +x $UPGRADES_DIR/*.sh
|
||||
# Write the version out (used in upgrade scripts - this is the same as SW_VERSION)
|
||||
echo "VERSION=$PLATFORM_RELEASE" > $UPGRADES_DIR/version
|
||||
}
|
||||
|
||||
function sign_iso {
|
||||
# Sign the .iso with the developer private key
|
||||
# Sigining with the formal key is only to be done for customer release
|
||||
# builds
|
||||
local isofilename=$(basename $OUTPUT_DIR/$DEST_FILE)
|
||||
local isofilenoext="${isofilename%.*}"
|
||||
openssl dgst -sha256 -sign ${MY_REPO}/build-tools/signing/dev-private-key.pem -binary -out $OUTPUT_DIR/$isofilenoext.sig $OUTPUT_DIR/$DEST_FILE
|
||||
}
|
||||
|
||||
#############################################
|
||||
# Main code
|
||||
#############################################
|
||||
|
||||
# Check args
|
||||
HELP=0
|
||||
CLEAN_FLAG=1 # TODO -- doesn't yet work without --clean
|
||||
DEST_FILE=bootimage.iso
|
||||
AUTO_FLAG=0
|
||||
AUTO_INSTALL=""
|
||||
CUMULUS=0
|
||||
SIGN_RPM_FILES=1
|
||||
DEVICE=""
|
||||
|
||||
# read the options
|
||||
TEMP=`getopt -o hf:a:d: --long help,file:,auto:,device:,cumulus,clean,skip-sign -n 'test.sh' -- "$@"`
|
||||
eval set -- "$TEMP"
|
||||
|
||||
# extract options and their arguments into variables.
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-h|--help) HELP=1 ; shift ;;
|
||||
--clean) CLEAN_FLAG=1 ; shift ;;
|
||||
--skip-sign) SIGN_RPM_FILES=0 ; shift ;;
|
||||
--cumulus) CUMULUS=1 ; shift ;;
|
||||
-f | --file) DEST_FILE="$2"; shift; shift ;;
|
||||
-d | --device) DEVICE="$2"; shift; shift ;;
|
||||
-a | --auto) AUTO_FLAG=1; AUTO_INSTALL="$2"; shift; shift ;;
|
||||
--) shift ; break ;;
|
||||
*) echo "Internal error!" ; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $AUTO_FLAG -eq 1 ]; then
|
||||
if [[ "$AUTO_INSTALL" != "controller" && "$AUTO_INSTALL" != "cpe" ]] ; then
|
||||
echo "Unsupported --auto value: $AUTO_INSTALL"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $HELP -eq 1 ]; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
(
|
||||
printf "\n*************************\n"
|
||||
printf "Create Titanium Cloud/CentOS Boot CD\n"
|
||||
printf "*************************\n\n"
|
||||
|
||||
# Init variables
|
||||
init_vars
|
||||
check_vars
|
||||
PKGLIST_MINIMAL=$INTERNAL_REPO_ROOT/build-tools/build_iso/minimal_rpm_list.txt
|
||||
PKGLIST_TI=$INTERNAL_REPO_ROOT/build-tools/build_iso/image.inc
|
||||
PKGLIST_DEV=$INTERNAL_REPO_ROOT/build-tools/build_iso/image-dev.inc
|
||||
|
||||
# Create skeleton build dir
|
||||
init_output_dir
|
||||
|
||||
# Create the vanilla DVD
|
||||
echo "Copying vanilla CentOS RPMs"
|
||||
install_pkg_list $PKGLIST_MINIMAL
|
||||
|
||||
# Find all CGCS packages
|
||||
# SAL exit 0
|
||||
echo "Installing Titanium Cloud packages"
|
||||
install_pkg_list $PKGLIST_TI
|
||||
if [ $? -eq 2 ]; then
|
||||
exit 1
|
||||
fi
|
||||
if [ "x${RELEASE_BUILD}" == "x" ]; then
|
||||
echo "Installing Titanium Cloud developer packages"
|
||||
install_pkg_list ${PKGLIST_DEV}
|
||||
if [ $? -eq 2 ]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Extract installer files
|
||||
extract_installer_files
|
||||
|
||||
# Upgrades files
|
||||
setup_upgrades_files
|
||||
|
||||
# add file signatures to all rpms
|
||||
if [ $SIGN_RPM_FILES -ne 0 ]; then
|
||||
sign-rpms -d $OUTPUT_DIST_DIR/isolinux/Packages
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "failed to add file signatures to RPMs"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Finalize and build ISO
|
||||
final_touches
|
||||
|
||||
# Sign the ISO
|
||||