build-guest: accept extra RPMs on command line
- Accept additional RPM file names or package names to be installed into the guest image - Don't fail if build-info/release-info.inc doesn't exist Story: 2009108 Task: 42968 Signed-off-by: Davlet Panech <davlet.panech@windriver.com> Change-Id: Id532f3cfcd7bb16d8ca4c6bdf7615fe6d79f41b1
This commit is contained in:
parent
0f1e54c8be
commit
55fdee2aee
@ -101,12 +101,11 @@ function check_vars {
|
|||||||
|
|
||||||
RELEASE_INFO="$(get_release_info)"
|
RELEASE_INFO="$(get_release_info)"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "ERROR: failed to find a release info file."
|
echo "WARNING: failed to find a release info file."
|
||||||
exit 1
|
else
|
||||||
|
export PLATFORM_RELEASE=$(source "$RELEASE_INFO" && echo $PLATFORM_RELEASE)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
export PLATFORM_RELEASE=$(source "$RELEASE_INFO" && echo $PLATFORM_RELEASE)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -169,7 +168,7 @@ function create_rootfs {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$MOCK -r $GUEST_CFG --install ${INC_RPM_LIST} ${TIS_RPM_LIST} ${EXTRA_REPOS}
|
$MOCK -r $GUEST_CFG ${EXTRA_REPOS} --install ${INC_RPM_LIST} ${TIS_RPM_LIST} "$@"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
printf "=====\n"
|
printf "=====\n"
|
||||||
cat $GUEST_DIR/mock/result/root.log | sed -n '/Error:/,$p' | sed '/Child return code was:/q'
|
cat $GUEST_DIR/mock/result/root.log | sed -n '/Error:/,$p' | sed '/Child return code was:/q'
|
||||||
@ -180,18 +179,33 @@ function create_rootfs {
|
|||||||
|
|
||||||
# Make sure all requested packages are installed
|
# Make sure all requested packages are installed
|
||||||
MISSING=$(
|
MISSING=$(
|
||||||
$MOCK -r $GUEST_CFG --chroot -- rpm -q --whatprovides ${INC_RPM_LIST} ${TIS_RPM_LIST} \
|
extra_rpm_names="$(
|
||||||
| tee /tmp/dpanech.log \
|
for p in "$@" ; do
|
||||||
|
# skip URLs
|
||||||
|
if [[ "$p" =~ :// ]] ; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# if it contains a slash or ends with .rpm, assume its a local file
|
||||||
|
# and read its embedded package name
|
||||||
|
if [[ "$p" =~ / || "$p" =~ [.]rpm$ ]] ; then
|
||||||
|
rpm -q --qf '%{name}\n' -p "$p"
|
||||||
|
# otherwise assume its a package name already
|
||||||
|
else
|
||||||
|
echo "$p"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)"
|
||||||
|
$MOCK -r $GUEST_CFG --chroot -- rpm -q --whatprovides ${INC_RPM_LIST} ${TIS_RPM_LIST} $extra_rpm_names \
|
||||||
| sed -n 's/^no package provides //p' \
|
| sed -n 's/^no package provides //p' \
|
||||||
| sort -u
|
| sort -u
|
||||||
)
|
)
|
||||||
if [ -n "$MISSING" ]; then
|
if [ -n "$MISSING" ]; then
|
||||||
printf "=====\n"
|
printf "=====\n"
|
||||||
printf "WARNING: The following RPMs requested in .inc files are missing or could not be installed:\n"
|
printf "WARNING: The following RPMs are missing or could not be installed:\n"
|
||||||
for zz in $MISSING ; do
|
local p
|
||||||
echo " [$zz]"
|
for p in $MISSING ; do
|
||||||
|
echo " [$p]"
|
||||||
done
|
done
|
||||||
#echo $MISSING | tr ' ' '\n' | sed 's/^/\t/'
|
|
||||||
printf "=====\n"
|
printf "=====\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -306,7 +320,7 @@ function clean_guest {
|
|||||||
$MOCK -r $GUEST_CFG --scrub=cache
|
$MOCK -r $GUEST_CFG --scrub=cache
|
||||||
|
|
||||||
rm -rf $GUEST_DIR
|
rm -rf $GUEST_DIR
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
printf " Error -- Failed to remove guest $GUEST_DIR\n";
|
printf " Error -- Failed to remove guest $GUEST_DIR\n";
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -321,10 +335,11 @@ function clean_guest {
|
|||||||
usage () {
|
usage () {
|
||||||
echo ""
|
echo ""
|
||||||
echo "Usage: "
|
echo "Usage: "
|
||||||
echo " build-guest [--rt | --std] [--verbose]"
|
echo " build-guest [--rt | --std] [--verbose] [EXTRA_RPMS...]"
|
||||||
echo " build-guest [--help]"
|
echo " build-guest [--help]"
|
||||||
echo " build-guest [--clean]"
|
echo " build-guest [--clean]"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "EXTRA_RPMS are either package names or full RPM file paths"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Default argument values
|
# Default argument values
|
||||||
@ -355,6 +370,28 @@ if [ $HELP -eq 1 ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $CLEAN -eq 1 && "$#" -gt 0 ]] ; then
|
||||||
|
echo "Too many arguments!" >&2 ; exit 1
|
||||||
|
else
|
||||||
|
# make sure extra RPM files exist
|
||||||
|
for p in "$@" ; do
|
||||||
|
# skip URLs
|
||||||
|
if [[ "$p" =~ :// ]] ; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# if it contains a slash or ends with .rpm assume its a local file name
|
||||||
|
if [[ "$p" =~ / || "$p" =~ [.]rpm$ ]] ; then
|
||||||
|
# make sure it exists and is an RPM file
|
||||||
|
true <"$p" || exit 1
|
||||||
|
if ! file --brief --mime-type "$p" | grep -q "^application/x-rpm$" ; then
|
||||||
|
echo "$p: not an RPM file" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset p
|
||||||
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
printf "\n*****************************\n"
|
printf "\n*****************************\n"
|
||||||
printf "Create Titanium Cloud/CentOS Guest Image\n"
|
printf "Create Titanium Cloud/CentOS Guest Image\n"
|
||||||
@ -368,7 +405,7 @@ if [ $CLEAN -eq 1 ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
create_rootfs
|
create_rootfs "$@"
|
||||||
update_rootfs
|
update_rootfs
|
||||||
build_image
|
build_image
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user