mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-13 15:14:08 +00:00
obs: : Minor bash fixes (refactor)
Remove unused variables and set default value to variables. Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
parent
6c5c293f81
commit
f7074e178a
@ -27,6 +27,8 @@ runtime
|
|||||||
|
|
||||||
OSCRC="${HOME}/.oscrc"
|
OSCRC="${HOME}/.oscrc"
|
||||||
PUSH=${PUSH:-""}
|
PUSH=${PUSH:-""}
|
||||||
|
LOCAL=${LOCAL:-""}
|
||||||
|
PUSH_TO_OBS=""
|
||||||
|
|
||||||
export BUILD_DISTROS=${BUILD_DISTROS:-xUbuntu_16.04}
|
export BUILD_DISTROS=${BUILD_DISTROS:-xUbuntu_16.04}
|
||||||
# Packaging use this variable instead of use git user value
|
# Packaging use this variable instead of use git user value
|
||||||
@ -38,7 +40,7 @@ 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
|
if [ -n "${OBS_USER:-}" ] && [ -n "${OBS_PASS:-}" ] && [ ! -e "${OSCRC:-}" ]; then
|
||||||
echo "Creating ${OSCRC} with user $OBS_USER"
|
echo "Creating ${OSCRC} with user $OBS_USER"
|
||||||
cat << eom > "${OSCRC}"
|
cat << eom > "${OSCRC}"
|
||||||
[general]
|
[general]
|
||||||
|
@ -19,27 +19,25 @@ packaging_repo_dir=$(cd "${script_dir}/.." && pwd )
|
|||||||
host_datadir="${PWD}/pkgs"
|
host_datadir="${PWD}/pkgs"
|
||||||
obs_image="obs-kata"
|
obs_image="obs-kata"
|
||||||
export USE_DOCKER=1
|
export USE_DOCKER=1
|
||||||
|
http_proxy=${http_proxy:-}
|
||||||
|
https_proxy=${https_proxy:-}
|
||||||
|
no_proxy=${no_proxy:-}
|
||||||
|
PUSH=${PUSH:-}
|
||||||
|
|
||||||
if command -v go; then
|
|
||||||
export GO_ARCH=$(go env GOARCH)
|
|
||||||
else
|
|
||||||
export GO_ARCH=amd64
|
|
||||||
echo "Go not installed using $GO_ARCH to install go in dockerfile"
|
|
||||||
fi
|
|
||||||
|
|
||||||
export GO_ARCH=$(go env GOARCH)
|
GO_ARCH=$(go env GOARCH)
|
||||||
|
export GO_ARCH
|
||||||
sudo docker build \
|
sudo docker build \
|
||||||
--build-arg http_proxy="${http_proxy}" \
|
--build-arg http_proxy="${http_proxy}" \
|
||||||
--build-arg https_proxy="${https_proxy}" \
|
--build-arg https_proxy="${https_proxy}" \
|
||||||
-t $obs_image ${script_dir}
|
-t $obs_image "${script_dir}"
|
||||||
|
|
||||||
pushd "${script_dir}/kata-containers-image/" >> /dev/null
|
pushd "${script_dir}/kata-containers-image/" >> /dev/null
|
||||||
|
echo "Building image"
|
||||||
./build_image.sh
|
./build_image.sh
|
||||||
popd >> /dev/null
|
popd >> /dev/null
|
||||||
|
|
||||||
function faketty { script -qfc "$(printf "%q " "$@")"; }
|
sudo docker run \
|
||||||
|
|
||||||
faketty sudo docker run \
|
|
||||||
--rm \
|
--rm \
|
||||||
-v "${HOME}/.ssh":/root/.ssh \
|
-v "${HOME}/.ssh":/root/.ssh \
|
||||||
-v "${HOME}/.gitconfig":/root/.gitconfig \
|
-v "${HOME}/.gitconfig":/root/.gitconfig \
|
||||||
|
@ -36,7 +36,6 @@ cli "$@"
|
|||||||
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/kata-containers-image}
|
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/kata-containers-image}
|
||||||
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
||||||
((RELEASE++))
|
((RELEASE++))
|
||||||
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
|
|
||||||
|
|
||||||
function check_image() {
|
function check_image() {
|
||||||
[ ! -f "${SCRIPT_DIR}/kata-containers.tar.gz" ] && die "No kata-containers.tar.gz found!\nUse the build_image.sh script" || echo "Image: OK"
|
[ ! -f "${SCRIPT_DIR}/kata-containers.tar.gz" ] && die "No kata-containers.tar.gz found!\nUse the build_image.sh script" || echo "Image: OK"
|
||||||
|
@ -36,7 +36,6 @@ cli "$@"
|
|||||||
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/ksm-throttler}
|
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/ksm-throttler}
|
||||||
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
||||||
((RELEASE++))
|
((RELEASE++))
|
||||||
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
|
|
||||||
|
|
||||||
set_versions "$kata_ksm_throttler_hash"
|
set_versions "$kata_ksm_throttler_hash"
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ cli "$@"
|
|||||||
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/proxy}
|
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/proxy}
|
||||||
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
||||||
((RELEASE++))
|
((RELEASE++))
|
||||||
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
|
|
||||||
|
|
||||||
set_versions $kata_proxy_hash
|
set_versions $kata_proxy_hash
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ cli "$@"
|
|||||||
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/qemu-lite}
|
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/qemu-lite}
|
||||||
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
||||||
((RELEASE++))
|
((RELEASE++))
|
||||||
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
|
|
||||||
|
|
||||||
|
|
||||||
replace_list=(
|
replace_list=(
|
||||||
|
@ -33,7 +33,6 @@ cli "$@"
|
|||||||
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/qemu-vanilla}
|
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/qemu-vanilla}
|
||||||
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
||||||
((RELEASE++))
|
((RELEASE++))
|
||||||
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
|
|
||||||
|
|
||||||
replace_list=(
|
replace_list=(
|
||||||
"VERSION=$VERSION"
|
"VERSION=$VERSION"
|
||||||
|
@ -78,8 +78,6 @@ PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/runtime}
|
|||||||
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
||||||
((RELEASE++))
|
((RELEASE++))
|
||||||
|
|
||||||
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
|
|
||||||
|
|
||||||
set_versions "$kata_runtime_hash"
|
set_versions "$kata_runtime_hash"
|
||||||
|
|
||||||
replace_list=(
|
replace_list=(
|
||||||
|
@ -313,7 +313,7 @@ function get_obs_pkg_release() {
|
|||||||
pkg=$(basename "${obs_pkg_name}")
|
pkg=$(basename "${obs_pkg_name}")
|
||||||
repo_dir=$(mktemp -d -u -t "${pkg}.XXXXXXXXXXX")
|
repo_dir=$(mktemp -d -u -t "${pkg}.XXXXXXXXXXX")
|
||||||
|
|
||||||
out=$(osc ${APIURL} -q co "${obs_pkg_name}" -o "${repo_dir}") || die "failed to checkout:$out"
|
out=$(osc ${APIURL:-} -q co "${obs_pkg_name}" -o "${repo_dir}") || die "failed to checkout:$out"
|
||||||
|
|
||||||
spec_file=$(find "${repo_dir}" -maxdepth 1 -type f -name '*.spec' | head -1)
|
spec_file=$(find "${repo_dir}" -maxdepth 1 -type f -name '*.spec' | head -1)
|
||||||
# Find in specfile in Release: XX field.
|
# Find in specfile in Release: XX field.
|
||||||
|
@ -33,7 +33,6 @@ cli "$@"
|
|||||||
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/shim}
|
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/shim}
|
||||||
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
||||||
((RELEASE++))
|
((RELEASE++))
|
||||||
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
|
|
||||||
|
|
||||||
set_versions $kata_shim_hash
|
set_versions $kata_shim_hash
|
||||||
replace_list=(
|
replace_list=(
|
||||||
|
Loading…
Reference in New Issue
Block a user