-
Couldn't load subscription status.
- Fork 5
engineering: Installer ISO definition #270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
82f4e2e
1cdcda8
364034f
c7b4dab
680aada
e357d74
9f5cd02
b6cecef
67138cd
552bf60
13a1a38
7e2a65c
2c8fce7
e300cba
ac09b23
d85e8cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -440,33 +440,74 @@ bin/virtdeploy: tools/cmd/virtdeploy/* tools/go.sum tools/pkg/* tools/pkg/virtde | |
| INSTALLER_OUT_DIR := bin | ||
| INSTALLER_DIR := tools/installer | ||
|
|
||
| # If necessary create End-User License Agreement example file in execution directory | ||
| bin/EULA.txt: | ||
| @mkdir -p bin | ||
| @echo "SAMPLE EULA" > $@ | ||
|
|
||
| # EULA.txt required at runtime; added to ensure binary will be able to run | ||
| bin/liveinstaller: \ | ||
| $(shell find $(INSTALLER_DIR)/ -type f) \ | ||
| $(INSTALLER_DIR)/go.sum \ | ||
| bin/EULA.txt | ||
| $(INSTALLER_DIR)/go.sum | ||
| @mkdir -p bin | ||
| cd $(INSTALLER_DIR)/liveinstaller && \ | ||
| CGO_ENABLED=0 go build -o $(CURDIR)/$(INSTALLER_OUT_DIR)/liveinstaller | ||
|
|
||
| # EULA.txt required at runtime; added to ensure binary will be able to run | ||
| bin/attendedinstaller-simulator: \ | ||
| $(shell find $(INSTALLER_DIR)/imagegen/ -type f) \ | ||
| $(INSTALLER_DIR)/go.sum \ | ||
| bin/EULA.txt | ||
| $(INSTALLER_DIR)/go.sum | ||
| @mkdir -p bin | ||
| cd $(INSTALLER_DIR)/imagegen/attendedinstaller/attendedinstaller_tests && \ | ||
| CGO_ENABLED=0 go build -o $(CURDIR)/$(INSTALLER_OUT_DIR)/attendedinstaller-simulator attendedinstaller_simulator.go | ||
|
|
||
| .PHONY: run-attendedinstaller-simulator | ||
| run-attendedinstaller-simulator: bin/attendedinstaller-simulator bin/EULA.txt | ||
| run-attendedinstaller-simulator: bin/attendedinstaller-simulator | ||
| @cd bin && ./attendedinstaller-simulator && cd - | ||
|
|
||
| # AZL INSTALLER IMAGES | ||
|
|
||
| artifacts/test-image/azl-installer-mos.vhdx: \ | ||
| artifacts/baremetal.vhdx \ | ||
| bin/trident-rpms-azl3.tar.gz \ | ||
| tests/images/azl-installer/mos/mos.yaml \ | ||
| artifacts/imagecustomizer \ | ||
| $(shell find tests/images/azl-installer/mos/ -type f 2>/dev/null) | ||
| @mkdir -p artifacts/test-image/ | ||
| sudo rm -rf bin/trident_rpms | ||
| mkdir -p bin/trident_rpms | ||
| $(eval TEMP_DIR := $(shell mktemp -d)) | ||
| tar -xf bin/trident-rpms-azl3.tar.gz -C $(TEMP_DIR) | ||
| cp $(TEMP_DIR)/RPMS/*/*.rpm bin/trident_rpms/ | ||
| rm -rf $(TEMP_DIR) | ||
|
Comment on lines
+469
to
+475
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to manually unpack |
||
|
|
||
| sudo ./artifacts/imagecustomizer \ | ||
| --log-level debug \ | ||
| --rpm-source ./bin/trident_rpms/ \ | ||
| --build-dir ./artifacts/test-image \ | ||
| --image-file $< \ | ||
| --output-image-file $@ \ | ||
| --output-image-format vhdx \ | ||
| --config-file tests/images/azl-installer/mos/mos.yaml | ||
|
|
||
| AZL_INSTALLER_IMAGES_PATH = tests/images/azl-installer/iso/images | ||
| AZL_INSTALLER_BIN_PATH = tests/images/azl-installer/iso/bin | ||
| artifacts/test-image/azl-installer.iso: \ | ||
| artifacts/test-image/azl-installer-mos.vhdx \ | ||
| artifacts/imagecustomizer \ | ||
| bin/liveinstaller \ | ||
| artifacts/test-image/regular.cosi \ | ||
| $(shell find tests/images/azl-installer/iso/ -type f 2>/dev/null) | ||
| # Copy runtime images to prepare for inclusion in the ISO | ||
| rm -rf $(AZL_INSTALLER_IMAGES_PATH) | ||
| mkdir -p $(AZL_INSTALLER_IMAGES_PATH) | ||
| cp artifacts/test-image/regular.cosi $(AZL_INSTALLER_IMAGES_PATH)/trident-testimage.cosi | ||
| rm -rf $(AZL_INSTALLER_BIN_PATH) | ||
| mkdir -p $(AZL_INSTALLER_BIN_PATH) | ||
| cp bin/liveinstaller $(AZL_INSTALLER_BIN_PATH)/ | ||
|
|
||
| mkdir -p artifacts/test-image/ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: |
||
| sudo ./artifacts/imagecustomizer \ | ||
| --log-level debug \ | ||
| --build-dir ./artifacts/test-image/ \ | ||
| --image-file $< \ | ||
| --output-image-file $@ \ | ||
| --config-file tests/images/azl-installer/iso/mos-iso.yaml \ | ||
| --output-image-format iso | ||
|
|
||
| .PHONY: validate | ||
| validate: $(TRIDENT_CONFIG) bin/trident | ||
| @bin/trident validate $(TRIDENT_CONFIG) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| /images/ | ||
| /bin/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| os: | ||
| additionalFiles: | ||
| - source: scripts/installation.sh | ||
| destination: /root/installer/installation.sh | ||
|
|
||
| iso: | ||
| initramfsType: full-os | ||
| additionalFiles: | ||
| - source: images/trident-testimage.cosi | ||
| destination: /images/azure-linux-core.cosi | ||
| - source: bin/liveinstaller | ||
| destination: /installer/liveinstaller | ||
|
|
||
| kernelCommandLine: | ||
| extraCommandLine: | ||
| - console=tty0 | ||
| - console=tty1 | ||
| - console=ttyS0 | ||
| - loglevel=6 | ||
|
|
||
| scripts: | ||
| postCustomization: | ||
| - path: scripts/startup-command.sh |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #!/bin/bash | ||
| set -ex | ||
| trap '/bin/bash' ERR | ||
|
|
||
| # Mount CD-ROM using symlink | ||
| mkdir -p /mnt/cdrom | ||
| mount /dev/cdrom /mnt/cdrom | ||
|
|
||
| LIVEINSTALLER_PATH="/mnt/cdrom/installer/liveinstaller" | ||
| IMAGES_DIR="/mnt/cdrom/images/" | ||
| TRIDENT_CONFIG="/etc/trident/config.yaml" | ||
| WORKING_DIR="/root/installer" | ||
|
|
||
| # Copy to execute liveinstaller | ||
| cp "$LIVEINSTALLER_PATH" "$WORKING_DIR" | ||
|
|
||
| cd "$WORKING_DIR" | ||
| "$WORKING_DIR/liveinstaller" \ | ||
| --images-dir=$IMAGES_DIR \ | ||
| --host-config-output=$TRIDENT_CONFIG \ | ||
| --log-level=trace \ | ||
| --log-file=$WORKING_DIR/liveinstaller.log 2>&1 | tee "$WORKING_DIR/output_liveinstaller.log" | ||
|
|
||
| /bin/bash |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/bin/bash | ||
| INSTALLATION="/root/installer/installation.sh" | ||
| chmod +x "$INSTALLATION" | ||
|
|
||
| chsh -s "$INSTALLATION" root |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # SPDX-License-Identifier: LGPL-2.1+ | ||
| # | ||
| # This file is part of systemd. | ||
| # | ||
| # systemd is free software; you can redistribute it and/or modify it | ||
| # under the terms of the GNU Lesser General Public License as published by | ||
| # the Free Software Foundation; either version 2.1 of the License, or | ||
| # (at your option) any later version. | ||
|
|
||
| [Unit] | ||
| Description=Getty on %I | ||
| Documentation=man:agetty(8) man:systemd-getty-generator(8) | ||
| Documentation=http://0pointer.de/blog/projects/serial-console.html | ||
| After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target | ||
| After=rc-local.service | ||
|
|
||
| # If additional gettys are spawned during boot then we should make | ||
| # sure that this is synchronized before getty.target, even though | ||
| # getty.target didn't actually pull it in. | ||
| Before=getty.target | ||
| IgnoreOnIsolate=yes | ||
|
|
||
| # IgnoreOnIsolate causes issues with sulogin, if someone isolates | ||
| # rescue.target or starts rescue.service from multi-user.target or | ||
| # graphical.target. | ||
| Conflicts=rescue.service | ||
| Before=rescue.service | ||
|
|
||
| # On systems without virtual consoles, don't start any getty. Note | ||
| # that serial gettys are covered by [email protected], not this | ||
| # unit. | ||
| ConditionPathExists=/dev/tty0 | ||
|
|
||
| [Service] | ||
| # the VT is cleared by TTYVTDisallocate | ||
| # The '-o' option value tells agetty to replace 'login' arguments with an | ||
| # option to preserve environment (-p), followed by '--' for safety, and then | ||
| # the entered username. | ||
| ExecStart=-/sbin/agetty --autologin root --noclear %I linux | ||
| Type=idle | ||
| Restart=always | ||
| RestartSec=0 | ||
| UtmpIdentifier=%I | ||
| TTYPath=/dev/%I | ||
| TTYReset=yes | ||
| TTYVHangup=yes | ||
| TTYVTDisallocate=yes | ||
| KillMode=process | ||
| IgnoreSIGPIPE=no | ||
| SendSIGHUP=yes | ||
|
|
||
| # Unset locale for the console getty since the console has problems | ||
| # displaying some internationalized messages. | ||
| UnsetEnvironment=LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION | ||
|
|
||
| [Install] | ||
| WantedBy=getty.target | ||
| DefaultInstance=tty1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # SPDX-License-Identifier: LGPL-2.1+ | ||
| # | ||
| # This file is part of systemd. | ||
| # | ||
| # systemd is free software; you can redistribute it and/or modify it | ||
| # under the terms of the GNU Lesser General Public License as published by | ||
| # the Free Software Foundation; either version 2.1 of the License, or | ||
| # (at your option) any later version. | ||
|
|
||
| [Unit] | ||
| Description=Serial Getty on %I | ||
| Documentation=man:agetty(8) man:systemd-getty-generator(8) | ||
| Documentation=http://0pointer.de/blog/projects/serial-console.html | ||
| BindsTo=dev-%i.device | ||
| After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target | ||
| After=rc-local.service | ||
|
|
||
| # If additional gettys are spawned during boot then we should make | ||
| # sure that this is synchronized before getty.target, even though | ||
| # getty.target didn't actually pull it in. | ||
| Before=getty.target | ||
| IgnoreOnIsolate=yes | ||
|
|
||
| # IgnoreOnIsolate causes issues with sulogin, if someone isolates | ||
| # rescue.target or starts rescue.service from multi-user.target or | ||
| # graphical.target. | ||
| Conflicts=rescue.service | ||
| Before=rescue.service | ||
|
|
||
| [Service] | ||
| # The '-o' option value tells agetty to replace 'login' arguments with an | ||
| # option to preserve environment (-p), followed by '--' for safety, and then | ||
| # the entered username. | ||
| ExecStart=-/sbin/agetty --autologin root --keep-baud 115200,38400,9600 %I screen | ||
| Type=idle | ||
| Restart=always | ||
| UtmpIdentifier=%I | ||
| TTYPath=/dev/%I | ||
| TTYReset=yes | ||
| TTYVHangup=yes | ||
| KillMode=process | ||
| IgnoreSIGPIPE=no | ||
| SendSIGHUP=yes | ||
|
|
||
| [Install] | ||
| WantedBy=getty.target |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| storage: | ||
bfjelds marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| bootType: efi | ||
|
|
||
| disks: | ||
| - partitionTableType: gpt | ||
| maxSize: 4G | ||
| partitions: | ||
| - id: esp | ||
| type: esp | ||
| size: 8M | ||
|
|
||
| - id: rootfs | ||
| size: grow | ||
|
|
||
| filesystems: | ||
| - deviceId: esp | ||
| type: fat32 | ||
| mountPoint: | ||
| path: /boot/efi | ||
| options: umask=0077 | ||
|
|
||
| - deviceId: rootfs | ||
| type: ext4 | ||
| mountPoint: | ||
| path: / | ||
|
|
||
| os: | ||
| hostname: azl-installer-mos | ||
| bootloader: | ||
| resetType: hard-reset | ||
|
|
||
| selinux: | ||
| mode: disabled | ||
|
|
||
| kernelCommandLine: | ||
| # Replicates BM base image settings, that would otherwise be lost | ||
| extraCommandLine: | ||
| - console=tty0 | ||
| - console=ttyS0 | ||
| - rd.info | ||
| - log_buf_len=1M | ||
|
|
||
| packages: | ||
| install: | ||
| - calamares | ||
| - curl | ||
| - device-mapper | ||
| - dnf | ||
| - dosfstools | ||
| - efibootmgr | ||
| - iproute | ||
| - iptables | ||
| - jq | ||
| - lsof | ||
| - mdadm | ||
| - nano | ||
| - netplan | ||
| - openssh-server | ||
| - squashfs-tools | ||
| - tar | ||
| - tpm2-tools | ||
| - trident-provisioning | ||
| - vim | ||
| - veritysetup | ||
| # Accessibility packages | ||
| - pcaudiolib | ||
| # Debug accessibility packages. | ||
| # Successfully installed, but failed to create ISO. | ||
| # - alsa-lib | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these packages intentionally commented out? |
||
| # - alsa-utils | ||
| # - espeak-ng | ||
| # - espeakup | ||
| # - kernel-drivers-accessibility | ||
| # - kernel-drivers-sound | ||
|
|
||
| additionalFiles: | ||
| # Getty service files for root autologin | ||
| - source: files/[email protected] | ||
| destination: /usr/lib/systemd/system/[email protected] | ||
| - source: files/[email protected] | ||
| destination: /usr/lib/systemd/system/[email protected] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The temporary directory cleanup should happen even if the previous commands fail. Consider using a trap or ensure this cleanup occurs in all code paths to prevent temporary directory accumulation.