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: label
GPG Key ID: B37E62D143879B36
4 changed files with 66 additions and 25 deletions

View File

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

View File

@ -1,20 +1,44 @@
#!/bin/bash
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" %}
{{ 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; }
podman_setup_dirs
{% else %}
cd /builddir
if ! TEMPLATE="$($(head -n1 $(which lorax) | cut -c3-) -c 'import pylorax; print(pylorax.find_templates())')"; then
TEMPLATE="/usr/share/lorax"
fi
local_setup_env
{% endif %}
{{ make_image }}
{{ isohybrid }}
@ -23,11 +47,11 @@ fi
{{ make_manifest }}
{% if extra_iso_mode == "podman" %}
# 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
## Check that the ISO came out fine
set +e
check_for_sorry
set -e
{% if extra_iso_mode == "podman" %}
podman_create_links
{% endif %}

View File

@ -1,6 +1,17 @@
#!/bin/bash
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" %}
{{ live_pkg_cmd }}
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
# getting needless headaches.
set +e
[[ -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
check_for_container
set -e
cd /builddir

View File

@ -1307,6 +1307,19 @@ class IsoBuild:
fh.write("%s=%s\n" % (zl, u[zl]))
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):
"""
Pulls generic images built in peridot and places them where they need