start pull_iso_images function

This commit is contained in:
Louis Abel 2023-04-12 17:56:17 -07:00
parent a039f6e482
commit 01e04b8083
Signed by untrusted user: label
GPG Key ID: B37E62D143879B36
4 changed files with 66 additions and 25 deletions

View File

@ -36,5 +36,4 @@ a = IsoBuild(
) )
def run(): def run():
#a.run_pull_iso_images() a.run_pull_iso_images()
print('currently not supported')

View File

@ -1,20 +1,44 @@
#!/bin/bash #!/bin/bash
set -ex set -ex
# funtions
function podman_setup_dirs() {
{{ lorax_pkg_cmd }}
mkdir -p {{ compose_work_iso_dir }}/{{ arch }}
cd {{ compose_work_iso_dir }}/{{ arch }}
test -f {{ isoname }} && { echo "ERROR: ISO ALREDY EXISTS!"; exit 1; }
}
function podman_create_links() {
# symlink to unversioned image name
ln -sf {{ isoname }} {{ generic_isoname }}
ln -sf {{ isoname }} {{ latest_isoname }}
ln -sf {{ isoname }}.manifest {{ generic_isoname }}.manifest
ln -sf {{ isoname }}.manifest {{ latest_isoname }}.manifest
}
function local_setup_env() {
cd /builddir
if ! TEMPLATE="$($(head -n1 $(which lorax) | cut -c3-) -c 'import pylorax; print(pylorax.find_templates())')"; then
TEMPLATE="/usr/share/lorax"
fi
}
function check_for_sorry() {
if xorriso -indev {{ isoname }} -report_el_torito as_mkisofs 2>&1 | grep -q SORRY; then
echo "IMAGE WAS NOT BUILT CORRECTLY"
exit 23
else
return 0
fi
}
{% if extra_iso_mode == "podman" %} {% if extra_iso_mode == "podman" %}
{{ lorax_pkg_cmd }} podman_setup_dirs
mkdir -p {{ compose_work_iso_dir }}/{{ arch }}
cd {{ compose_work_iso_dir }}/{{ arch }}
test -f {{ isoname }} && { echo "ERROR: ISO ALREDY EXISTS!"; exit 1; }
{% else %} {% else %}
cd /builddir local_setup_env
if ! TEMPLATE="$($(head -n1 $(which lorax) | cut -c3-) -c 'import pylorax; print(pylorax.find_templates())')"; then
TEMPLATE="/usr/share/lorax"
fi
{% endif %} {% endif %}
{{ make_image }} {{ make_image }}
{{ isohybrid }} {{ isohybrid }}
@ -23,11 +47,11 @@ fi
{{ make_manifest }} {{ make_manifest }}
{% if extra_iso_mode == "podman" %} ## Check that the ISO came out fine
# symlink to unversioned image name set +e
ln -sf {{ isoname }} {{ generic_isoname }} check_for_sorry
ln -sf {{ isoname }} {{ latest_isoname }} set -e
ln -sf {{ isoname }}.manifest {{ generic_isoname }}.manifest
ln -sf {{ isoname }}.manifest {{ latest_isoname }}.manifest
{% if extra_iso_mode == "podman" %}
podman_create_links
{% endif %} {% endif %}

View File

@ -1,6 +1,17 @@
#!/bin/bash #!/bin/bash
set -ex set -ex
# functions
function check_for_container() {
[[ -f /run/.containerenv ]]; container_ec=$?
grep -q "0::/$" /proc/1/cgroup; pid_ec=$?
grep -q "0::/$" /proc/self/cgroup; self_ec=$?
if [[ "$pid_ec" == "0" ]] || [[ "$self_ec" == 0 ]]; then
exit 23
fi
}
{% if live_iso_mode == "podman" %} {% if live_iso_mode == "podman" %}
{{ live_pkg_cmd }} {{ live_pkg_cmd }}
mkdir -p {{ compose_live_work_dir }}/{{ arch }} mkdir -p {{ compose_live_work_dir }}/{{ arch }}
@ -26,13 +37,7 @@ done
# Even so, we don't support it. These checks are to prevent (you) from # Even so, we don't support it. These checks are to prevent (you) from
# getting needless headaches. # getting needless headaches.
set +e set +e
[[ -f /run/.containerenv ]]; container_ec=$? check_for_container
grep -q "0::/$" /proc/1/cgroup; pid_ec=$?
grep -q "0::/$" /proc/self/cgroup; self_ec=$?
if [[ "$pid_ec" == "0" ]] || [[ "$self_ec" == 0 ]]; then
exit 23
fi
set -e set -e
cd /builddir cd /builddir

View File

@ -1307,6 +1307,19 @@ class IsoBuild:
fh.write("%s=%s\n" % (zl, u[zl])) fh.write("%s=%s\n" % (zl, u[zl]))
fh.close() fh.close()
def run_pull_iso_images(self):
"""
Pulls ISO's made in v2
"""
arches_to_unpack = self.arches
latest_artifacts = {}
if self.arch:
unpack_single_arch = True
arches_to_unpack = [self.arch]
print("not supported")
sys.exit(1)
def run_pull_generic_images(self): def run_pull_generic_images(self):
""" """
Pulls generic images built in peridot and places them where they need Pulls generic images built in peridot and places them where they need