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

change script

This commit is contained in:
Jason N. 2024-04-01 08:49:01 -04:00
parent 76edeb887c
commit f8f448e94f
5 changed files with 149 additions and 29 deletions

View file

@ -38,26 +38,26 @@ See [Customizing](#customizing) for information about customizing the ISO that g
The following variables can be used to customize the created ISO.
### Inputs
| Variable | Description | Default Value | Action | Container | Makefile |
| ----------------------- | ---------------------------------------------------------------------------- | -------------------------------------------- | ------------------ | ------------------ | ------------------ |
| additional_templates | Space delimited list of additional Lorax templates to include | \[empty\] | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| arch | Architecture for image to build | x86_64 | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| enrollment_password | Used for supporting secure boot (requires SECURE_BOOT_KEY_URL to be defined) | container-installer | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| extra_boot_params | Extra params used by grub to boot the anaconda installer | \[empty\] | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| flatpak_remote_name | Name of the Flatpak repo on the destination OS | flathub | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| flatpak_remote_refs | Space separated list of flatpak refs to install | \[empty\] | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| flatpak_remote_refs_dir | Directory that contains files that list the flatpak refs to install | \[empty\] | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| flatpak_remote_url | URL of the flatpakrepo file | https://flathub.org/repo/flathub.flatpakrepo | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| image_name | Name of the source container image | base | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| image_repo | Repository containing the source container image | quay.io/fedora-ostree-desktops | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| image_tag | Tag of the source container image | *VERSION* | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| iso_name | Name of the ISO you wish to output when completed | build/deploy.iso | :white_check_mark: | :x: | :x: |
| repos | List of repo files for Lorax to use | /etc/yum.repos.d/*.repo | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| rootfs_size | The size (in GiB) for the squashfs runtime volume | 2 | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| secure_boot_key_url | Secure boot key that is installed from URL location\*\* | \[empty\] | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| variant | Source container variant\* | Server | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| version | Fedora version of installer to build | 39 | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| web_ui | Enable Anaconda WebUI (experimental) | false | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Variable | Description | Default Value | Action | Container/Makefile |
| ----------------------- | ---------------------------------------------------------------------------- | -------------------------------------------- | ------------------ | ------------------ |
| additional_templates | Space delimited list of additional Lorax templates to include | \[empty\] | :white_check_mark: | :white_check_mark: |
| arch | Architecture for image to build | x86_64 | :white_check_mark: | :white_check_mark: |
| enrollment_password | Used for supporting secure boot (requires SECURE_BOOT_KEY_URL to be defined) | container-installer | :white_check_mark: | :white_check_mark: |
| extra_boot_params | Extra params used by grub to boot the anaconda installer | \[empty\] | :white_check_mark: | :white_check_mark: |
| flatpak_remote_name | Name of the Flatpak repo on the destination OS | flathub | :white_check_mark: | :white_check_mark: |
| flatpak_remote_refs | Space separated list of flatpak refs to install | \[empty\] | :white_check_mark: | :white_check_mark: |
| flatpak_remote_refs_dir | Directory that contains files that list the flatpak refs to install | \[empty\] | :white_check_mark: | :white_check_mark: |
| flatpak_remote_url | URL of the flatpakrepo file | https://flathub.org/repo/flathub.flatpakrepo | :white_check_mark: | :white_check_mark: |
| image_name | Name of the source container image | base | :white_check_mark: | :white_check_mark: |
| image_repo | Repository containing the source container image | quay.io/fedora-ostree-desktops | :white_check_mark: | :white_check_mark: |
| image_tag | Tag of the source container image | *VERSION* | :white_check_mark: | :white_check_mark: |
| iso_name | Name of the ISO you wish to output when completed | build/deploy.iso | :white_check_mark: | :white_check_mark: |
| repos | List of repo files for Lorax to use | /etc/yum.repos.d/*.repo | :white_check_mark: | :white_check_mark: |
| rootfs_size | The size (in GiB) for the squashfs runtime volume | 2 | :white_check_mark: | :white_check_mark: |
| secure_boot_key_url | Secure boot key that is installed from URL location\*\* | \[empty\] | :white_check_mark: | :white_check_mark: |
| variant | Source container variant\* | Server | :white_check_mark: | :white_check_mark: |
| version | Fedora version of installer to build | 39 | :white_check_mark: | :white_check_mark: |
| web_ui | Enable Anaconda WebUI (experimental) | false | :white_check_mark: | :white_check_mark: |
\*Available options for VARIANT can be found by running `dnf provides system-release`.
Variant will be the third item in the package name. Example: `fedora-release-kinoite-39-34.noarch` will be kinoite

View file

@ -1,6 +1,6 @@
#!/bin/bash
set -ex
#set -ex
checkisomd5 ../../${ISO_NAME}
cd $(dirname ../../${ISO_NAME}) && sha256sum -c $(basename ${ISO_NAME})-CHECKSUM

View file

@ -1,9 +1,9 @@
REPO_TESTS=$(filter-out README.md Makefile,$(shell ls))
REPO_TESTS=$(filter-out README.md Makefile,$(wildcard *))
all: $(REPO_TESTS)
$(REPO_TESTS):
chmod +x $*
./$*
chmod +x $@
./$@
.PHONY: $(REPO_TESTS)

108
test/repo/vars.py Executable file
View file

@ -0,0 +1,108 @@
#!/usr/bin/env python
makefile = open('../../Makefile.inputs', 'r')
makefile_lines = makefile.readlines()
vars = {}
outputs = {}
errors = 0
for line in makefile_lines:
if line.startswith('#'):
makefile_lines.remove(line)
continue
parts = line.split('=', 1)
if parts[0].startswith('export'):
var_name = parts[0].strip().split(' ')[1].lower()
else:
var_name = parts[0].strip().lower()
vars[var_name] = {'default_value': parts[1].strip(), 'makefile': True}
action = open('../../action.yml', 'r')
action_lines = action.readlines()
at_inputs = False
at_outputs = False
for line in action_lines:
if not at_inputs:
if line.strip() == 'inputs:':
at_inputs = True
continue
else:
if line.startswith(' '):
parts = line.strip().split(':', 1)
if parts[0] == 'description':
vars[var_name]['description'] = parts[1].strip()
if parts[0] == 'deprecationMessage':
vars[var_name]['deprecated'] = True
if parts[0] == 'default':
if 'default' in vars[var_name]:
if vars[var_name]['default_value'] != parts[1].strip().strip('"'):
print("ERROR: Default value for " + var_name + " in action.yml does not match Makefile")
errors += 1
else:
vars[var_name]['default_value'] = parts[1].strip().strip('"')
elif line.startswith(' '):
var_name = line.strip().strip(':').lower()
if var_name in vars:
vars[var_name][action] = True
else:
print("WARNING: " + var_name + " found in action.yml but not Makefile")
vars[var_name] = {}
vars[var_name]['action'] = True
else:
at_inputs = False
if not at_outputs:
if line.strip() == 'outputs:':
at_outputs = True
continue
else:
if line.startswith(' '):
parts = line.strip().split(':', 1)
if parts[0] == 'description':
outputs[var_name]['description'] = parts[1].strip()
if parts[0] == 'deprecationMessage':
outputs[var_name]['deprecated'] = True
if parts[0] == 'default':
outputs[var_name]['default_value'] = parts[1].strip().strip('"')
elif line.startswith(' '):
var_name = line.strip().strip(':').lower()
outputs[var_name] = {}
else:
at_outputs = False
readme = open('../../README.md', 'r')
readme_lines = readme.readlines()
at_inputs = False
skip_header = True
at_outputs = False
for line in readme_lines:
if not at_inputs:
if line.strip() == '### Inputs':
at_inputs = True
continue
else:
if skip_header:
if line.startswith('| -----'):
skip_header = False
continue
else:
if not line.startswith('|'):
at_inputs = False
continue
parts = line.split('|')
var_name = parts[1].strip().lower()
if not var_name in vars:
print("ERROR: " + var_name + " is not listed in action.yml or Makefile")
vars[var_name] = {}
vars[var_name]
var_description = parts[2].strip()
var_default_value = parts[3].strip()
var_action = parts[4].strip()
var_makefile = parts[5].strip()

22
test/repo/vars.sh → test/repo/vars_copy.sh Normal file → Executable file
View file

@ -1,6 +1,22 @@
#!/bin/bash
exit 0
makefile = open('../../Makefile.inputs', 'r')
makefile_lines = makefile.readlines()
vars = []
for line in makefile_lines:
if line.startswith('#'):
makefile_lines.remove(line)
parts = line.split('=', 1)
vars += { parts[0]: parts[1] }
print(vars)
vars=()
default_values=()
while read -r line
do
@ -8,11 +24,7 @@ do
then
vars+=$(echo $line | cut -d= -f1 | tr [:upper:] [:lower:])
fi
if [[ $line =~ ^########## ]]
then
break
fi
done < ../../Makefile
done < ../../Makefile.inputs
result=0