summaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2024-10-25 10:21:16 (GMT)
committerRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2024-10-25 10:21:16 (GMT)
commitd996f6560065950393c186cb6c39d94ea9025ac1 (patch)
tree0d77ee889cee2904b1b0256c9bec86c608813a6a /.github
parent903773eb9c3cc2079187dc99c7b48662148ff679 (diff)
downloadmonitoring-plugins-d996f6560065950393c186cb6c39d94ea9025ac1.tar.gz
github/mock.sh: Improve readability and generel shellcheck stuff
Diffstat (limited to '.github')
-rwxr-xr-x.github/mock.sh24
1 files changed, 18 insertions, 6 deletions
diff --git a/.github/mock.sh b/.github/mock.sh
index 8da147e..0b91364 100755
--- a/.github/mock.sh
+++ b/.github/mock.sh
@@ -20,7 +20,11 @@ SPEC_FILE="${SPEC_DIR}monitoring-plugins.spec"
20cd ${BASE_PATH} 20cd ${BASE_PATH}
21 21
22dnf -y --setopt="tsflags=nodocs" update && \ 22dnf -y --setopt="tsflags=nodocs" update && \
23 if [ ${distro_id} != "fedora" ]; then dnf -y --setopt="tsflags=nodocs" install epel-release; else platform_id="$(echo ${platform_id} | sed s/^f/fc/)"; fi && \ 23 if [ "${distro_id}" != "fedora" ]; then
24 dnf -y --setopt="tsflags=nodocs" install epel-release;
25 else
26 platform_id="$(echo "${platform_id}" | sed s/^f/fc/)";
27 fi && \
24 case ${distro_id} in 28 case ${distro_id} in
25 ol) 29 ol)
26 case ${platform_id} in 30 case ${platform_id} in
@@ -34,19 +38,27 @@ dnf -y --setopt="tsflags=nodocs" update && \
34 ;; 38 ;;
35 esac 39 esac
36 dnf -y --setopt="tsflags=nodocs" install mock rpm-build git-core && \ 40 dnf -y --setopt="tsflags=nodocs" install mock rpm-build git-core && \
37 usermod -a -G mock $(whoami) 41 usermod -a -G mock "$(whoami)"
42
38SRC_RPM="monitoring-plugins-*-1.${platform_id}.src.rpm" 43SRC_RPM="monitoring-plugins-*-1.${platform_id}.src.rpm"
44
39if command -v git > /dev/null 2>&1; then 45if command -v git > /dev/null 2>&1; then
40 git config --global --add safe.directory ${BASE_PATH} 46 git config --global --add safe.directory ${BASE_PATH}
41 SHA="$(git rev-parse HEAD)" 47 SHA="$(git rev-parse HEAD)"
42 sed "s/^%global commit.*/%global commit ${SHA}/" ${SPEC_FILE} > ${SPEC_DIR}monitoring-plugins-git.spec 48 sed "s/^%global commit.*/%global commit ${SHA}/" ${SPEC_FILE} > ${SPEC_DIR}monitoring-plugins-git.spec
43 sed -i "s/^%global fromgit.*/%global fromgit 1/" ${SPEC_DIR}monitoring-plugins-git.spec 49 sed -i "s/^%global fromgit.*/%global fromgit 1/" ${SPEC_DIR}monitoring-plugins-git.spec
44 SPEC_FILE="${SPEC_DIR}monitoring-plugins-git.spec" 50 SPEC_FILE="${SPEC_DIR}monitoring-plugins-git.spec"
45 SRC_RPM="monitoring-plugins-*git.$(echo ${SHA:0:7})*.${platform_id}.src.rpm" 51 SRC_RPM="monitoring-plugins-*git.${SHA:0:7}*.${platform_id}.src.rpm"
46fi 52fi
53
47mkdir -p "${SRCRPM_DIR}" "${RPM_DIR}" 54mkdir -p "${SRCRPM_DIR}" "${RPM_DIR}"
48#rpmbuild --undefine=_disable_source_fetch --define "_sourcedir ${SOURCE_DIR}" -ba ${SPEC_FILE} 55#rpmbuild --undefine=_disable_source_fetch --define "_sourcedir ${SOURCE_DIR}" -ba ${SPEC_FILE}
49dnf -y --setopt="tsflags=nodocs" install rpmdevtools && spectool -g -C ${SOURCE_DIR} ${SPEC_FILE} && \ 56dnf -y --setopt="tsflags=nodocs" install rpmdevtools && \
50mock --dnf --clean --spec ${SPEC_FILE} --sources=${SOURCE_DIR} --result=${SRCRPM_DIR} --build || { cat ${SRCRPM_DIR}/{root,build}.log; exit 1; } 57 spectool -g -C ${SOURCE_DIR} ${SPEC_FILE} && \
51mock --dnf --clean --sources=${SOURCE_DIR} --result=${RPM_DIR} --rebuild ${SRCRPM_DIR}/${SRC_RPM} || { cat ${RPM_DIR}/{root,build}.log; exit 1; } 58 { mock --dnf --clean --spec ${SPEC_FILE} --sources=${SOURCE_DIR} --result=${SRCRPM_DIR} --build || \
59 { cat ${SRCRPM_DIR}/{root,build}.log; exit 1; } }
60
61mock --dnf --clean --sources=${SOURCE_DIR} --result=${RPM_DIR} --rebuild "${SRCRPM_DIR}/${SRC_RPM}" || \
62 { cat ${RPM_DIR}/{root,build}.log; exit 1; }
63
52ls -la ${SOURCE_DIR} ${SRCRPM_DIR} ${RPM_DIR} 64ls -la ${SOURCE_DIR} ${SRCRPM_DIR} ${RPM_DIR}