summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2018-06-28 15:03:56 -0400
committerScott Moser <smoser@brickies.net>2018-06-28 15:03:56 -0400
commitc42a926ae730994f66fe87c264b65f6e4dca69a1 (patch)
tree43b7d9dbc6157101ec5570393c38e1afd11c1b21 /tools
parent0db174513af41e14bc451631fd7f97710c898aa2 (diff)
downloadvyos-cloud-init-c42a926ae730994f66fe87c264b65f6e4dca69a1.tar.gz
vyos-cloud-init-c42a926ae730994f66fe87c264b65f6e4dca69a1.zip
tools: Fix run-container when neither source or binary package requested.
If run-container was called without --package or --binary-package, then it would still try to copy out artifacts and would fail doing so as there were no artifacts to collect. Also fix a bug when only --source-package without --package.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/run-container18
1 files changed, 10 insertions, 8 deletions
diff --git a/tools/run-container b/tools/run-container
index 499e85b0..6dedb757 100755
--- a/tools/run-container
+++ b/tools/run-container
@@ -418,7 +418,7 @@ main() {
{ bad_Usage; return; }
local cur="" next=""
- local package="" source_package="" unittest="" name=""
+ local package=false srcpackage=false unittest="" name=""
local dirty=false pyexe="auto" artifact_d="."
while [ $# -ne 0 ]; do
@@ -430,8 +430,8 @@ main() {
-k|--keep) KEEP=true;;
-n|--name) name="$next"; shift;;
--pyexe) pyexe=$next; shift;;
- -p|--package) package=1;;
- -s|--source-package) source_package=1;;
+ -p|--package) package=true;;
+ -s|--source-package) srcpackage=true;;
-u|--unittest) unittest=1;;
-v|--verbose) VERBOSITY=$((VERBOSITY+1));;
--) shift; break;;
@@ -529,8 +529,8 @@ main() {
build_srcpkg="./packages/brpm $distflag --srpm"
pkg_ext=".rpm";;
esac
- if [ -n "$source_package" ]; then
- [ -n "$build_pkg" ] || {
+ if [ "$srcpackage" = "true" ]; then
+ [ -n "$build_srcpkg" ] || {
error "Unknown package command for $OS_NAME"
return 1
}
@@ -542,19 +542,21 @@ main() {
}
fi
- if [ -n "$package" ]; then
- [ -n "$build_srcpkg" ] || {
+ if [ "$package" = "true" ]; then
+ [ -n "$build_pkg" ] || {
error "Unknown build source command for $OS_NAME"
return 1
}
debug 1 "building binary package with $build_pkg."
+ # shellcheck disable=SC2086
inside_as_cd "$name" "$user" "$cdir" $pyexe $build_pkg || {
errorrc "failed: $build_pkg";
errors[${#errors[@]}]="binary package"
}
fi
- if [ -n "$artifact_d" ]; then
+ if [ -n "$artifact_d" ] &&
+ [ "$package" = "true" -o "$srcpackage" = "true" ]; then
local art=""
artifact_d="${artifact_d%/}/"
[ -d "${artifact_d}" ] || mkdir -p "$artifact_d" || {