[master 3/5] Extract the file used by liveimg as a prereq

dashea installerbot-noreply at redhat.com
Thu Oct 8 21:37:44 UTC 2015


From: David Shea <dshea at redhat.com>

Use isoinfo, from the genisoimage package, to extract install.img to use
as a liveimg source and serve it from a local httpd. This removes the
need to have KSTEST_LIVEIMG_URL and KSTEST_LIVEIMG_CHECKSUM in the
environment.
---
 tests/kickstart_tests/liveimg.sh               | 33 ++++++++++++++++++++++++++
 tests/kickstart_tests/scripts/Makefile.prereqs |  4 ++++
 2 files changed, 37 insertions(+)

diff --git a/tests/kickstart_tests/liveimg.sh b/tests/kickstart_tests/liveimg.sh
index 9155809..d1b135e 100755
--- a/tests/kickstart_tests/liveimg.sh
+++ b/tests/kickstart_tests/liveimg.sh
@@ -20,3 +20,36 @@
 TESTTYPE="method"
 
 . ${KSTESTDIR}/functions.sh
+
+prereqs() {
+    echo install.img
+}
+
+prepare() {
+    ks=$1
+    tmpdir=$2
+
+    scriptdir=$PWD/kickstart_tests/scripts
+
+    # Copy the install.img to the tmpdir
+    mkdir ${tmpdir}/liveimg
+    cp ${scriptdir}/install.img ${tmpdir}/liveimg
+
+    # Start a http server to serve the install.img
+    start_httpd ${tmpdir}/liveimg ${tmpdir}
+
+    # Add the image and checksum to the kickstart
+    sed -e "s|@KSTEST_LIVEIMG_URL@|${httpd_url}/install.img|" \
+        -e "s|@KSTEST_LIVEIMG_CHECKSUM@|$(sha256sum ${tmpdir}/liveimg/install.img | awk '{print $1;}')|" \
+        ${ks} > ${tmpdir}/kickstart-liveimg.ks
+
+    echo ${tmpdir}/kickstart-liveimg.ks
+}
+
+cleanup() {
+    tmpdir=$1
+
+    if [ -f ${tmpdir}/httpd-pid ]; then
+        kill $(cat ${tmpdir}/httpd-pid)
+    fi
+}
diff --git a/tests/kickstart_tests/scripts/Makefile.prereqs b/tests/kickstart_tests/scripts/Makefile.prereqs
index 698b9f8..11293a4 100644
--- a/tests/kickstart_tests/scripts/Makefile.prereqs
+++ b/tests/kickstart_tests/scripts/Makefile.prereqs
@@ -22,3 +22,7 @@ proxy-common.ks: proxy.py
 	echo 'EOF' >> $@
 	echo 'python3 /tmp/proxy-test.py > /dev/null 2>&1 &' >> $@
 	echo '%end' >> $@
+
+install.img: ${IMAGE}
+	@# Extract the install.img from a boot.iso
+	isoinfo -i $${IMAGE} -R -x /images/install.img > $@


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/a6d6d7fa0fcbb7d7b6823f59d35d0a0117020390


More information about the anaconda-patches mailing list