1
0
Fork 0
mirror of https://github.com/JasonN3/build-container-installer.git synced 2025-12-25 02:47:56 +01:00

Split Makfile and move workflow to Makefile (#88)

Co-authored-by: codacy-production[bot] <61871480+codacy-production[bot]@users.noreply.github.com>
This commit is contained in:
Jason N 2024-04-04 16:32:52 -04:00 committed by GitHub
parent 662f1a94e4
commit b669420287
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 800 additions and 665 deletions

25
test/iso/Makefile Normal file
View file

@ -0,0 +1,25 @@
ISO_NAME=deploy.iso
ISO_TESTS=$(wildcard install_*) $(if $(FLATPAK_REMOTE_REFS),$(wildcard flatpak_*))$(if $(FLATPAK_DIR),$(wildcard flatpak_*))
all: $(ISO_TESTS) clean
$(ISO_TESTS): mnt/iso
$(eval _VARS = ISO_NAME VERSION FLATPAK_REMOTE_NAME _FLATPAK_REPO_URL)
chmod +x $@
$(foreach var,$(_VARS),$(var)=$($(var))) ./$@
mnt/iso:
sudo modprobe loop
sudo mkdir -p mnt/iso mnt/install
sudo mount -o loop ../../$(ISO_NAME) mnt/iso
sudo mount -t squashfs -o loop mnt/iso/images/install.img mnt/install
clean:
sudo umount mnt/install || true
sudo umount mnt/iso || true
sudo rmdir mnt/install mnt/iso
install-deps:
$(install_pkg) isomd5sum coreutils squashfs-tools curl
.PHONY: all $(ISO_TESTS) clean

1
test/iso/README.md Normal file
View file

@ -0,0 +1 @@
Place scripts that will test the ISO. The ISO file will be passed as the first argument

View file

@ -0,0 +1,40 @@
#!/bin/bash
add_line=$(grep flatpak_manager.add_remote mnt/install/usr/lib64/python*/site-packages/pyanaconda/modules/payloads/payload/rpm_ostree/flatpak_installation.py)
add_line_repo=$(echo "${add_line}" | grep "${FLATPAK_REMOTE_NAME}")
add_line_url=$(echo "${add_line}" | grep "${_FLATPAK_REPO_URL}")
result=0
if [ -z "${add_line_repo}" ]
then
echo "Repo name not updated on add_remote line"
echo "${add_line}"
result=1
else
echo "Repo name found on add_remote line"
fi
if [ -z "${add_line_url}" ]
then
echo "Repo url not updated on add_remote line"
echo "${add_line}"
result=1
else
echo "Repo url found on add_remote line"
fi
replace_line=$(grep flatpak_manager.replace_installed_refs_remote mnt/install/usr/lib64/python*/site-packages/pyanaconda/modules/payloads/payload/rpm_ostree/flatpak_installation.py)
replace_line_repo=$(echo "${replace_line}" | grep "${FLATPAK_REMOTE_NAME}")
if [ -z "${replace_line_repo}" ]
then
echo "Repo name not updated on replace_installed_refs line"
echo "${replace_line}"
result=1
else
echo "Repo name found on replace_installed_refs line"
fi
exit ${result}

14
test/iso/install_hash.sh Normal file
View file

@ -0,0 +1,14 @@
#!/bin/bash
#set -ex
checkisomd5 "../../${ISO_NAME}"
if [[ $? != 0 ]]
then
echo "Found:"
checkisomd5 --md5sumonly "../../${ISO_NAME}"
echo "Expected:"
implantisomd5 --force "../../${ISO_NAME}"
fi
cd "$(dirname "../../${ISO_NAME}")" && sha256sum -c "$(basename "${ISO_NAME}")-CHECKSUM"

View file

@ -0,0 +1,14 @@
#!/bin/bash
FOUND_VERSION=$(grep VERSION_ID mnt/install/etc/os-release | cut -d= -f2)
if [[ ${FOUND_VERSION} != ${VERSION} ]]
then
echo "Version mismatch"
echo "Expected: ${VERSION}"
echo "Found: ${FOUND_VERSION}"
exit 1
else
echo "Correct version found"
exit 0
fi