toolkit/iso/empanadas/empanadas/templates/buildExtraImage.tmpl.sh

60 lines
1.2 KiB
Bash
Raw Normal View History

2022-06-22 00:21:37 +00:00
#!/bin/bash
set -ex
2023-04-13 00:56:17 +00:00
# funtions
function podman_setup_dirs() {
{{ lorax_pkg_cmd }}
mkdir -p {{ compose_work_iso_dir }}/{{ arch }}
cd {{ compose_work_iso_dir }}/{{ arch }}
2023-05-12 17:06:41 +00:00
set +e
test -f {{ isoname }} && { echo "ERROR: ISO ALREDY EXISTS!"; exit 32; }
set -e
2023-04-13 00:56:17 +00:00
}
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" %}
2023-04-13 00:56:17 +00:00
podman_setup_dirs
2022-06-27 07:26:42 +00:00
{% else %}
2023-04-13 00:56:17 +00:00
local_setup_env
2022-06-27 07:29:45 +00:00
{% endif %}
2022-06-27 07:40:28 +00:00
{{ make_image }}
2022-06-22 00:21:37 +00:00
2022-06-27 07:40:28 +00:00
{{ isohybrid }}
2022-06-22 00:21:37 +00:00
2022-06-27 07:40:28 +00:00
{{ implantmd5 }}
2022-06-22 00:21:37 +00:00
2022-06-27 07:40:28 +00:00
{{ make_manifest }}
2023-04-13 00:56:17 +00:00
## Check that the ISO came out fine
set +e
check_for_sorry
set -e
2023-04-13 00:56:17 +00:00
{% if extra_iso_mode == "podman" %}
podman_create_links
{% endif %}