Skip to content

Commit

Permalink
Cleaning entry.sh so that it passes shellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
pswica committed Jul 2, 2019
1 parent 31e1e5d commit ea00a38
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions rpm/entry.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash
# Entrypoint for the build container to create the rpms and yum repodata:
# Usage: ./entry.sh GOARCH/RPMARCH,GOARCH/RPMARCH,....

Expand All @@ -7,7 +7,7 @@ set -e
declare -a ARCHS

if [ $# -gt 0 ]; then
IFS=','; ARCHS=($1); unset IFS;
IFS=','; mapfile -t ARCHS < <($1); unset IFS;
else
#GOARCH/RPMARCH
ARCHS=(
Expand All @@ -19,16 +19,16 @@ else
)
fi

for ARCH in ${ARCHS[@]}; do
IFS=/ read GOARCH RPMARCH<<< ${ARCH}; unset IFS;
for ARCH in "${ARCHS[@]}"; do
IFS=/ read -r GOARCH RPMARCH<<< "${ARCH}"; unset IFS;
SRC_PATH="/root/rpmbuild/SOURCES/${RPMARCH}"
mkdir -p ${SRC_PATH}
cp -r /root/rpmbuild/SPECS/* ${SRC_PATH}
mkdir -p "${SRC_PATH}"
cp -r /root/rpmbuild/SPECS/* "${SRC_PATH}"
echo "Building RPM's for ${GOARCH}....."
sed -i "s/\%global ARCH.*/\%global ARCH ${GOARCH}/" ${SRC_PATH}/kubelet.spec
sed -i "s/\%global ARCH.*/\%global ARCH ${GOARCH}/" "${SRC_PATH}/kubelet.spec"
# Download sources if not already available
cd ${SRC_PATH} && spectool -gf kubelet.spec
/usr/bin/rpmbuild --target ${RPMARCH} --define "_sourcedir ${SRC_PATH}" -bb ${SRC_PATH}/kubelet.spec
mkdir -p /root/rpmbuild/RPMS/${RPMARCH}
createrepo -o /root/rpmbuild/RPMS/${RPMARCH}/ /root/rpmbuild/RPMS/${RPMARCH}
cd "${SRC_PATH}" && spectool -gf kubelet.spec
/usr/bin/rpmbuild --target "${RPMARCH}" --define "_sourcedir ${SRC_PATH}" -bb "${SRC_PATH}/kubelet.spec"
mkdir -p "/root/rpmbuild/RPMS/${RPMARCH}"
createrepo -o "/root/rpmbuild/RPMS/${RPMARCH}/" "/root/rpmbuild/RPMS/${RPMARCH}"
done

0 comments on commit ea00a38

Please sign in to comment.