2022-06-13 14:37:50 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# This is a template that is used to build ISO's for Rocky Linux. Only under
|
|
|
|
# extreme circumstances should you be filling this out and running manually.
|
|
|
|
|
2022-06-17 05:55:07 +00:00
|
|
|
# Vars
|
|
|
|
MOCK_CFG="/var/tmp/lorax-{{ major }}.cfg"
|
|
|
|
MOCK_ROOT="/var/lib/mock/{{ shortname|lower }}-{{ major }}-{{ arch }}"
|
|
|
|
MOCK_RESL="${MOCK_ROOT}/result"
|
|
|
|
MOCK_CHRO="${MOCK_ROOT}/root"
|
|
|
|
MOCK_LOG="${MOCK_RESL}/mock-output.log"
|
|
|
|
LORAX_SCR="/var/tmp/buildImage.sh"
|
|
|
|
LORAX_TAR="lorax-{{ major }}-{{ arch }}.tar.gz"
|
|
|
|
ISOLATION="{{ isolation }}"
|
|
|
|
BUILDDIR="{{ builddir }}"
|
|
|
|
|
2022-06-13 14:37:50 +00:00
|
|
|
# Init the container
|
|
|
|
mock \
|
2022-06-17 05:55:07 +00:00
|
|
|
-r "${MOCK_CFG}" \
|
|
|
|
--isolation="${ISOLATION}" \
|
2022-06-15 20:53:12 +00:00
|
|
|
--enable-network \
|
2022-06-13 14:37:50 +00:00
|
|
|
--init
|
|
|
|
|
2022-06-17 05:55:07 +00:00
|
|
|
init_ret_val=$?
|
|
|
|
if [ $init_ret_val -ne 0 ]; then
|
|
|
|
echo "!! MOCK INIT FAILED !!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "${MOCK_RESL}"
|
|
|
|
cp "${LORAX_SCR}" "${MOCK_CHRO}${LORAX_SCR}"
|
2022-06-15 20:53:12 +00:00
|
|
|
|
2022-06-13 14:37:50 +00:00
|
|
|
mock \
|
2022-06-17 05:55:07 +00:00
|
|
|
-r "${MOCK_CFG}" \
|
2022-06-13 14:37:50 +00:00
|
|
|
--shell \
|
2022-06-17 05:55:07 +00:00
|
|
|
--isolation="${ISOLATION}" \
|
|
|
|
--enable-network -- /bin/bash /var/tmp/buildImage.sh | tee -a "${MOCK_LOG}"
|
2022-06-15 20:53:12 +00:00
|
|
|
|
2022-06-17 05:55:07 +00:00
|
|
|
mock_ret_val=$?
|
|
|
|
if [ $mock_ret_val -eq 0 ]; then
|
2022-06-15 20:53:12 +00:00
|
|
|
# Copy resulting data to /var/lib/mock/{{ shortname|lower }}-{{ major }}-{{ arch }}/result
|
2022-06-17 05:55:07 +00:00
|
|
|
mkdir -p "${MOCK_RESL}"
|
|
|
|
cp "${MOCK_CHRO}${BUILDDIR}/${LORAX_TAR}" "${MOCK_RESL}"
|
2022-06-15 20:53:12 +00:00
|
|
|
else
|
|
|
|
echo "!! LORAX RUN FAILED !!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-06-13 14:37:50 +00:00
|
|
|
|
|
|
|
# Clean up?
|