mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-05 18:14:55 +00:00
obs: build_all.sh: Add usage function (refactor)
Add usage function. Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
parent
0d789968a4
commit
764ce02779
@ -10,19 +10,18 @@ set -o errexit
|
|||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
|
||||||
script_dir=$(dirname "$0")
|
script_dir=$(dirname "$0")
|
||||||
#Note:Lets update qemu and the kernel first, they take longer to build.
|
#Note:Lets update qemu and the kernel first, they take longer to build.
|
||||||
#Note: runtime is build at the end to get the version from all its dependencies.
|
#Note: runtime is build at the end to get the version from all its dependencies.
|
||||||
projects=(
|
projects=(
|
||||||
qemu-lite
|
qemu-lite
|
||||||
qemu-vanilla
|
qemu-vanilla
|
||||||
kernel
|
kernel
|
||||||
kata-containers-image
|
kata-containers-image
|
||||||
proxy
|
proxy
|
||||||
shim
|
shim
|
||||||
ksm-throttler
|
ksm-throttler
|
||||||
runtime
|
runtime
|
||||||
)
|
)
|
||||||
|
|
||||||
OSCRC="${HOME}/.oscrc"
|
OSCRC="${HOME}/.oscrc"
|
||||||
@ -36,32 +35,48 @@ export BUILD_DISTROS=${BUILD_DISTROS:-xUbuntu_16.04}
|
|||||||
export AUTHOR="${AUTHOR:-user}"
|
export AUTHOR="${AUTHOR:-user}"
|
||||||
export AUTHOR_EMAIL="${AUTHOR_EMAIL:-user@example.com}"
|
export AUTHOR_EMAIL="${AUTHOR_EMAIL:-user@example.com}"
|
||||||
|
|
||||||
cd "$script_dir"
|
|
||||||
|
|
||||||
OBS_API="https://api.opensuse.org"
|
OBS_API="https://api.opensuse.org"
|
||||||
|
|
||||||
if [ -n "${OBS_USER:-}" ] && [ -n "${OBS_PASS:-}" ] && [ ! -e "${OSCRC:-}" ]; then
|
usage() {
|
||||||
echo "Creating ${OSCRC} with user $OBS_USER"
|
msg="${1:-}"
|
||||||
cat << eom > "${OSCRC}"
|
exit_code=$"${2:-0}"
|
||||||
|
cat <<EOT
|
||||||
|
${msg}
|
||||||
|
Usage:
|
||||||
|
${script_name} <kata-branch>
|
||||||
|
EOT
|
||||||
|
exit "${exit_code}"
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
local branch="${1:-}"
|
||||||
|
[ -n "${branch}" ] || usage "missing branch" "1"
|
||||||
|
if [ -n "${OBS_USER:-}" ] && [ -n "${OBS_PASS:-}" ] && [ ! -e "${OSCRC:-}" ]; then
|
||||||
|
echo "Creating ${OSCRC} with user $OBS_USER"
|
||||||
|
cat <<eom >"${OSCRC}"
|
||||||
[general]
|
[general]
|
||||||
apiurl = ${OBS_API}
|
apiurl = ${OBS_API}
|
||||||
[${OBS_API}]
|
[${OBS_API}]
|
||||||
user = ${OBS_USER}
|
user = ${OBS_USER}
|
||||||
pass = ${OBS_PASS}
|
pass = ${OBS_PASS}
|
||||||
eom
|
eom
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${PUSH}" ]; then
|
for p in "${projects[@]}"; do
|
||||||
# push to obs
|
pushd "$p" >>/dev/null
|
||||||
PUSH_TO_OBS="-p"
|
update_cmd="./update.sh"
|
||||||
elif [ -n "${LOCAL}" ]; then
|
if [ -n "${PUSH}" ]; then
|
||||||
# local build
|
# push to obs
|
||||||
PUSH_TO_OBS="-l"
|
update_cmd+=" -p"
|
||||||
fi
|
elif [ -n "${LOCAL}" ]; then
|
||||||
|
# local build
|
||||||
|
update_cmd+=" -l"
|
||||||
|
fi
|
||||||
|
|
||||||
for p in "${projects[@]}"; do
|
echo "update ${p}"
|
||||||
pushd "$p" >> /dev/null
|
bash -c "${update_cmd} ${branch}"
|
||||||
echo "update ${p}"
|
popd >>/dev/null
|
||||||
bash ./update.sh "${PUSH_TO_OBS}" -v
|
done
|
||||||
popd >> /dev/null
|
}
|
||||||
done
|
|
||||||
|
main $@
|
||||||
|
Loading…
Reference in New Issue
Block a user