diff --git a/SPECS/photon-os-installer/0001-create-abupdate.conf.patch b/SPECS/photon-os-installer/0001-create-abupdate.conf.patch new file mode 100644 index 0000000000..db6c013fda --- /dev/null +++ b/SPECS/photon-os-installer/0001-create-abupdate.conf.patch @@ -0,0 +1,234 @@ +From 589e184f55ff712e92239f5cbaf200c125709f1e Mon Sep 17 00:00:00 2001 +From: Oliver Kurth +Date: Thu, 16 Feb 2023 18:52:27 -0800 +Subject: [PATCH 01/13] create abupdate.conf + +Example: + +root@photon-machine [ ~ ]# cat /etc/abupdate.conf +BOOT_TYPE=BOTH +_ROOT=(f6b51480-10ec-4b87-b74c-29866643bec3 ebaa3d90-4724-48c0-8a2c-8791b1d60256 /) +EFI=(802fb52e-0d4e-4be1-ad8d-4997b8348f6a 8172187f-c4d2-4470-9b9a-2adffa11a888 /boot/efi) +SETS=(_ROOT EFI) + +Change-Id: I34b352c77d655c5936368efce9f3e7c5e0000337 +--- + photon_installer/installer.py | 117 +++++++++++++++++++++++++++------- + 1 file changed, 93 insertions(+), 24 deletions(-) + +diff --git a/photon_installer/installer.py b/photon_installer/installer.py +index 644d3ba..aab3339 100755 +--- a/photon_installer/installer.py ++++ b/photon_installer/installer.py +@@ -154,8 +154,13 @@ class Installer(object): + + self.install_config = install_config + ++ self.ab_present = self._is_ab_present() ++ ++ self._insert_boot_partitions() ++ + self._add_shadow_partitions() + ++ + def execute(self): + if 'setup_grub_script' in self.install_config: + self.setup_grub_command = self.install_config['setup_grub_script'] +@@ -333,6 +338,8 @@ class Installer(object): + mountpoints.append(mntpoint) + if mntpoint == '/boot' and 'lvm' in partition: + return "/boot on LVM is not supported" ++ elif mntpoint == '/boot/efi' and partition['filesystem'] != 'vfat': ++ return "/boot/efi filesystem must be vfat" + elif mntpoint == '/': + has_root = True + if not has_root: +@@ -360,23 +367,31 @@ class Installer(object): + return None + + ++ def _is_ab_present(self): ++ partitions = self.install_config['partitions'] ++ for partition in partitions: ++ if 'lvm' not in partition and partition.get('ab', False): ++ return True ++ ++ + def _add_shadow_partitions(self): + """ + Add shadow partitions (copy those with 'ab' = true) to list of partitions + Both will have 'ab' = True + Shadow will have 'shadow'==True, the active one will have 'shadow'==False + """ +- shadow_parts = [] +- partitions = self.install_config['partitions'] +- for partition in partitions: +- if 'lvm' not in partition and partition.get('ab', False): +- shadow_part = copy.deepcopy(partition) +- shadow_part['shadow'] = True +- partition['shadow'] = False +- shadow_parts.append(shadow_part) +- self.ab_present = True ++ if self.ab_present: ++ shadow_parts = [] ++ partitions = self.install_config['partitions'] ++ for partition in partitions: ++ if 'lvm' not in partition and partition.get('ab', False): ++ shadow_part = copy.deepcopy(partition) ++ shadow_part['shadow'] = True ++ partition['shadow'] = False ++ shadow_parts.append(shadow_part) ++ self.ab_present = True + +- partitions.extend(shadow_parts) ++ partitions.extend(shadow_parts) + + + def _install(self, stdscreen=None): +@@ -451,6 +466,7 @@ class Installer(object): + self._cleanup_install_repo() + self._setup_grub() + self._create_fstab() ++ self._update_abupdate() + self._execute_modules(modules.commons.POST_INSTALL) + self._deactivate_network_in_chroot() + self._unmount_all() +@@ -587,8 +603,8 @@ class Installer(object): + ptype = self._get_partition_type(partition) + if ptype == PartitionType.BIOS: + continue +-# if partition.get('shadow', False): +-# continue ++ if partition.get('shadow', False): ++ continue + + options = 'defaults' + dump = 1 +@@ -623,9 +639,6 @@ class Installer(object): + if not mnt_src: + raise RuntimeError("Cannot get PARTUUID/UUID of: {}".format(path)) + +- if partition.get('shadow', False): +- mnt_src = "# " + mnt_src +- + fstab_file.write("{}\t{}\t{}\t{}\t{}\t{}\n".format( + mnt_src, + mountpoint, +@@ -641,6 +654,55 @@ class Installer(object): + # Add the cdrom entry + fstab_file.write("/dev/cdrom\t/mnt/cdrom\tiso9660\tro,noauto\t0\t0\n") + ++ ++ def _update_abupdate(self): ++ if not self.ab_present: ++ return ++ ++ abupdate_conf = os.path.join(self.photon_root, "etc/abupdate.conf") ++ ++ boot_map = {'efi':'EFI', 'bios':'BIOS', 'dualboot':'BOTH'} ++ bootmode = self.install_config['bootmode'] ++ if not bootmode in boot_map: ++ raise Exception(f"invalid boot mode '{bootmode}'") ++ ++ ab_map = {} ++ for partition in self.install_config['partitions']: ++ ptype = self._get_partition_type(partition) ++ if ptype == PartitionType.BIOS: ++ continue ++ if partition.get('ab', False): ++ mntpoint = partition['mountpoint'] ++ partuuid = self._get_partuuid(partition['path']) ++ ++ if mntpoint == '/boot/efi': ++ name = 'EFI' ++ elif mntpoint == '/': ++ name = '_ROOT' ++ else: ++ name = mntpoint[1:].upper().replace('/', '_') ++ ++ # we go through this twice - active and shadow ++ # only add entry once ++ if not name in ab_map: ++ ab_map[name] = {'mntpoint' : mntpoint} ++ ++ if partition.get('shadow', False): ++ ab_map[name]['shadow'] = partuuid ++ else: ++ ab_map[name]['active'] = partuuid ++ ++ # assuming a virgin file with no settings, or no file ++ with open(abupdate_conf, 'a') as f: ++ f.write(f"BOOT_TYPE={boot_map[bootmode]}\n") ++ ++ for name, ab in ab_map.items(): ++ f.write(f"{name}=({ab['active']} {ab['shadow']} {ab['mntpoint']})\n") ++ ++ sets = " ".join(ab_map.keys()) ++ f.write(f"SETS=({sets})\n") ++ ++ + def _generate_partitions_param(self, reverse=False): + """ + Generate partition param for mount command +@@ -1265,34 +1327,42 @@ class Installer(object): + + return ptv + ++ + def _insert_boot_partitions(self): + bios_found = False + esp_found = False +- for partition in self.install_config['partitions']: ++ partitions = self.install_config['partitions'] ++ ++ for partition in partitions: + ptype = self._get_partition_type(partition) + if ptype == PartitionType.BIOS: + bios_found = True + if ptype == PartitionType.ESP: + esp_found = True ++ efi_partition = partition + + # Adding boot partition required for ostree if already not present in partitions table + if 'ostree' in self.install_config: +- mount_points = [partition['mountpoint'] for partition in self.install_config['partitions'] if 'mountpoint' in partition] ++ mount_points = [partition['mountpoint'] for partition in partitions if 'mountpoint' in partition] + if '/boot' not in mount_points: + boot_partition = {'size': 300, 'filesystem': 'ext4', 'mountpoint': '/boot'} +- self.install_config['partitions'].insert(0, boot_partition) ++ partitions.insert(0, boot_partition) + + bootmode = self.install_config.get('bootmode', 'bios') + +- # Insert efi special partition +- if not esp_found and (bootmode == 'dualboot' or bootmode == 'efi'): +- efi_partition = {'size': ESPSIZE, 'filesystem': 'vfat', 'mountpoint': '/boot/efi'} +- self.install_config['partitions'].insert(0, efi_partition) ++ if bootmode == 'dualboot' or bootmode == 'efi': ++ # Insert efi special partition ++ if not esp_found: ++ efi_partition = {'size': ESPSIZE, 'filesystem': 'vfat', 'mountpoint': '/boot/efi'} ++ partitions.insert(0, efi_partition) ++ ++ if self.ab_present: ++ efi_partition['ab'] = True + + # Insert bios partition last to be very first + if not bios_found and (bootmode == 'dualboot' or bootmode == 'bios'): + bios_partition = {'size': BIOSSIZE, 'filesystem': 'bios'} +- self.install_config['partitions'].insert(0, bios_partition) ++ partitions.insert(0, bios_partition) + + + def __set_ab_partition_size(self, l2entries, used_size, total_disk_size): +@@ -1333,7 +1403,6 @@ class Installer(object): + if self.install_config['ui']: + self.progress_bar.update_message('Partitioning...') + +- self._insert_boot_partitions() + ptv = self._get_partition_tree_view() + + self.__ptv_update_partition_sizes(ptv) +-- +2.23.1 + diff --git a/SPECS/photon-os-installer/0003-installer.py-Set-default-value-of-live-to-True.patch b/SPECS/photon-os-installer/0002-installer.py-Set-default-value-of-live-to-True.patch similarity index 87% rename from SPECS/photon-os-installer/0003-installer.py-Set-default-value-of-live-to-True.patch rename to SPECS/photon-os-installer/0002-installer.py-Set-default-value-of-live-to-True.patch index ceba93198f..95b335683a 100644 --- a/SPECS/photon-os-installer/0003-installer.py-Set-default-value-of-live-to-True.patch +++ b/SPECS/photon-os-installer/0002-installer.py-Set-default-value-of-live-to-True.patch @@ -1,7 +1,7 @@ From db093194a30c7328c3792c19407b3568061cc398 Mon Sep 17 00:00:00 2001 From: Piyush Gupta Date: Mon, 27 Feb 2023 13:30:32 +0000 -Subject: [PATCH] installer.py: Set default value of "live" to True. +Subject: [PATCH 02/13] installer.py: Set default value of "live" to True. Change-Id: Ia47223758899a112d1900d82b54f7798fbd99434 --- @@ -9,7 +9,7 @@ Change-Id: Ia47223758899a112d1900d82b54f7798fbd99434 1 file changed, 1 insertion(+) diff --git a/photon_installer/installer.py b/photon_installer/installer.py -index aab33397..f5672896 100755 +index aab3339..f567289 100755 --- a/photon_installer/installer.py +++ b/photon_installer/installer.py @@ -241,6 +241,7 @@ class Installer(object): @@ -21,5 +21,5 @@ index aab33397..f5672896 100755 install_config['live'] = False -- -2.23.3 +2.23.1 diff --git a/SPECS/photon-os-installer/0002-isoInstaller.py-Raise-exception-in-case-installer-fa.patch b/SPECS/photon-os-installer/0003-isoInstaller.py-Raise-exception-in-case-installer-fa.patch similarity index 88% rename from SPECS/photon-os-installer/0002-isoInstaller.py-Raise-exception-in-case-installer-fa.patch rename to SPECS/photon-os-installer/0003-isoInstaller.py-Raise-exception-in-case-installer-fa.patch index fe54c9816f..b5beeebbd4 100644 --- a/SPECS/photon-os-installer/0002-isoInstaller.py-Raise-exception-in-case-installer-fa.patch +++ b/SPECS/photon-os-installer/0003-isoInstaller.py-Raise-exception-in-case-installer-fa.patch @@ -1,7 +1,8 @@ From b42ba1c5dac0b0202a7dae93c02370afb611e615 Mon Sep 17 00:00:00 2001 From: Piyush Gupta Date: Mon, 27 Feb 2023 12:42:42 +0000 -Subject: [PATCH 2/2] isoInstaller.py: Raise exception in case installer fails. +Subject: [PATCH 03/13] isoInstaller.py: Raise exception in case installer + fails. Fixes https://github.com/vmware/photon-os-installer/commit/ede221e30e17feb733f8327b1ba03386bc5884b5 @@ -11,7 +12,7 @@ Change-Id: I58abe505aa230dd498c2461ab926068b563e59c6 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/photon_installer/isoInstaller.py b/photon_installer/isoInstaller.py -index 12bf307d..39dd4152 100755 +index 12bf307..39dd415 100755 --- a/photon_installer/isoInstaller.py +++ b/photon_installer/isoInstaller.py @@ -87,8 +87,8 @@ class IsoInstaller(object): @@ -26,5 +27,5 @@ index 12bf307d..39dd4152 100755 def _load_ks_config(self, path): """kick start configuration""" -- -2.23.3 +2.23.1 diff --git a/SPECS/photon-os-installer/0005-generate_initrd.sh-Remove-rpmdb-files-from-the-insta.patch b/SPECS/photon-os-installer/0004-generate_initrd.sh-Remove-rpmdb-files-from-the-insta.patch similarity index 96% rename from SPECS/photon-os-installer/0005-generate_initrd.sh-Remove-rpmdb-files-from-the-insta.patch rename to SPECS/photon-os-installer/0004-generate_initrd.sh-Remove-rpmdb-files-from-the-insta.patch index ab20c9de23..b85cf9f067 100644 --- a/SPECS/photon-os-installer/0005-generate_initrd.sh-Remove-rpmdb-files-from-the-insta.patch +++ b/SPECS/photon-os-installer/0004-generate_initrd.sh-Remove-rpmdb-files-from-the-insta.patch @@ -1,8 +1,8 @@ From 0e8f8e0e3ddeb3392f1eb20278b6bccd607d2c42 Mon Sep 17 00:00:00 2001 From: Piyush Gupta Date: Fri, 17 Feb 2023 09:02:19 +0000 -Subject: [PATCH 5/7] generate_initrd.sh: Remove rpmdb files from the installer - image, not needed in installer. +Subject: [PATCH 04/13] generate_initrd.sh: Remove rpmdb files from the + installer image, not needed in installer. Change-Id: Idefbe30cda8372ec78f38842dce17a47ffc02b01 --- @@ -79,5 +79,5 @@ index de8d981..cdf2eda 100755 # Set password max days to 99999 (disable aging) chroot ${INITRD} /bin/bash -c "chage -M 99999 root" -- -2.25.1 +2.23.1 diff --git a/SPECS/photon-os-installer/0006-test.log-Remove-test.log.patch b/SPECS/photon-os-installer/0005-test.log-Remove-test.log.patch similarity index 88% rename from SPECS/photon-os-installer/0006-test.log-Remove-test.log.patch rename to SPECS/photon-os-installer/0005-test.log-Remove-test.log.patch index 5f15fd2a00..6bcc5cff23 100644 --- a/SPECS/photon-os-installer/0006-test.log-Remove-test.log.patch +++ b/SPECS/photon-os-installer/0005-test.log-Remove-test.log.patch @@ -1,7 +1,7 @@ From f53253025338f5eb07fb3df4de9a1b9108afa0db Mon Sep 17 00:00:00 2001 From: Piyush Gupta Date: Tue, 28 Feb 2023 10:25:42 +0000 -Subject: [PATCH 6/7] test.log: Remove test.log. +Subject: [PATCH 05/13] test.log: Remove test.log. Change-Id: I7d7b935ddcbec66113ef67c3a1e2517902af4121 --- @@ -18,5 +18,5 @@ index 3598c30..0000000 -tests \ No newline at end of file -- -2.25.1 +2.23.1 diff --git a/SPECS/photon-os-installer/0007-fix-a-few-network-issues.patch b/SPECS/photon-os-installer/0006-fix-a-few-network-issues.patch similarity index 99% rename from SPECS/photon-os-installer/0007-fix-a-few-network-issues.patch rename to SPECS/photon-os-installer/0006-fix-a-few-network-issues.patch index b60a9cd747..d88dd1d2f7 100644 --- a/SPECS/photon-os-installer/0007-fix-a-few-network-issues.patch +++ b/SPECS/photon-os-installer/0006-fix-a-few-network-issues.patch @@ -1,7 +1,7 @@ From e4e1247d30439a591bc9fb61f810f27ae039ee50 Mon Sep 17 00:00:00 2001 From: Oliver Kurth Date: Mon, 27 Feb 2023 11:28:07 -0800 -Subject: [PATCH 7/7] fix a few network issues +Subject: [PATCH 06/13] fix a few network issues Change-Id: Ia63fd488d18760321bbbb75b95fb758047e0126e --- @@ -245,5 +245,5 @@ index d417c10..089ffe7 100644 "destination": "/etc/config/config.file" } -- -2.25.1 +2.23.1 diff --git a/SPECS/photon-os-installer/0007-m_-postinstall-preinstall-.py-Fix-post-install-arbit.patch b/SPECS/photon-os-installer/0007-m_-postinstall-preinstall-.py-Fix-post-install-arbit.patch new file mode 100644 index 0000000000..d099334765 --- /dev/null +++ b/SPECS/photon-os-installer/0007-m_-postinstall-preinstall-.py-Fix-post-install-arbit.patch @@ -0,0 +1,88 @@ +From a4a1b9b0283169b92209cae8230d0ace74d6a99f Mon Sep 17 00:00:00 2001 +From: Piyush Gupta +Date: Fri, 8 Apr 2022 07:18:22 +0000 +Subject: [PATCH 07/13] m_{postinstall,preinstall}.py: Fix post install + arbitrary script execution + +Post and pre install scripts are listed using os.listdir() after copying +to temp dir which doesn't confirm the order of execution of scripts +as provided in kickstart. + +Current change maintains a seperate list of scripts with their order +of execution and checks if the script is executable before running it. + +If not executable script execution is skipped. + +Change-Id: Ia6312330ce919f389994e6ffc06bd87de8a9ffaa +--- + photon_installer/modules/m_postinstall.py | 8 +++++++- + photon_installer/modules/m_preinstall.py | 8 +++++++- + 2 files changed, 14 insertions(+), 2 deletions(-) + +diff --git a/photon_installer/modules/m_postinstall.py b/photon_installer/modules/m_postinstall.py +index 6e1dbd4..c45bba4 100644 +--- a/photon_installer/modules/m_postinstall.py ++++ b/photon_installer/modules/m_postinstall.py +@@ -17,6 +17,7 @@ def execute(installer): + + tempdir = "/tmp/tempscripts" + tempdir_full = installer.photon_root + tempdir ++ scripts = [] + if not os.path.exists(tempdir_full): + os.mkdir(tempdir_full) + +@@ -30,13 +31,18 @@ def execute(installer): + with open(script_file, 'wb') as outfile: + outfile.write("\n".join(script).encode()) + os.chmod(script_file, 0o700) ++ scripts.append('builtin_postinstall.sh') + + if 'postinstallscripts' in installer.install_config: + for scriptname in installer.install_config['postinstallscripts']: + script_file = installer.getfile(scriptname) + shutil.copy(script_file, tempdir_full) ++ scripts.append(os.path.basename(scriptname)) + +- for script in os.listdir(tempdir_full): ++ for script in scripts: ++ if not os.access(os.path.join(tempdir_full, script), os.X_OK): ++ installer.logger.warning("Post install script {} is not executable. Skipping execution of script.".format(script)) ++ continue + installer.logger.info("Running script {}".format(script)) + installer.cmd.run_in_chroot(installer.photon_root, "{}/{}".format(tempdir, script)) + +diff --git a/photon_installer/modules/m_preinstall.py b/photon_installer/modules/m_preinstall.py +index 3f08db5..ba1ccbb 100644 +--- a/photon_installer/modules/m_preinstall.py ++++ b/photon_installer/modules/m_preinstall.py +@@ -16,6 +16,7 @@ def execute(installer): + return + + tempdir = "/tmp/tempscripts" ++ scripts = [] + if not os.path.exists(tempdir): + os.mkdir(tempdir) + +@@ -28,13 +29,18 @@ def execute(installer): + with open(script_file, 'wb') as outfile: + outfile.write("\n".join(script).encode()) + os.chmod(script_file, 0o700) ++ scripts.append('builtin_preinstall.sh') + + if 'preinstallscripts' in installer.install_config: + for scriptname in installer.install_config['preinstallscripts']: + script_file = installer.getfile(scriptname) + shutil.copy(script_file, tempdir) ++ scripts.append(os.path.basename(scriptname)) + +- for script in os.listdir(tempdir): ++ for script in scripts: ++ if not os.access(os.path.join(tempdir, script), os.X_OK): ++ installer.logger.warning("Post install script {} is not executable. Skipping execution of script.".format(script)) ++ continue + installer.logger.info("Running script {}".format(script)) + cmd = ["/bin/bash"] + cmd.append("-c") +-- +2.23.1 + diff --git a/SPECS/photon-os-installer/0008-Update-isoInstaller.py.patch b/SPECS/photon-os-installer/0008-Update-isoInstaller.py.patch new file mode 100644 index 0000000000..457936eb73 --- /dev/null +++ b/SPECS/photon-os-installer/0008-Update-isoInstaller.py.patch @@ -0,0 +1,28 @@ +From edf2252a37f87b7ab6bcffe898592fae7ad21969 Mon Sep 17 00:00:00 2001 +From: spyroot +Date: Sat, 11 Feb 2023 01:03:48 +0400 +Subject: [PATCH 08/13] Update isoInstaller.py + +I think it makes more sense actually to tell. I have an issue with UUID match and can mount, but the installer never mount. + +Change-Id: I4aee8f5f210883ad6fe105d9aef775cbdf8a8c40 +--- + photon_installer/isoInstaller.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/photon_installer/isoInstaller.py b/photon_installer/isoInstaller.py +index 39dd415..8e05861 100755 +--- a/photon_installer/isoInstaller.py ++++ b/photon_installer/isoInstaller.py +@@ -169,7 +169,7 @@ class IsoInstaller(object): + time.sleep(5) + print("Failed to mount the device, exiting the installer") + print("check the logs for more details") +- raise Exception("Can not mount the device") ++ raise Exception(f"Cannot mount the device {str(photon_media)}") + + + if __name__ == '__main__': +-- +2.23.1 + diff --git a/SPECS/photon-os-installer/0001-setup.py-Bump-up-version-to-2.1.patch b/SPECS/photon-os-installer/0009-setup.py-Bump-up-version-to-2.1.patch similarity index 76% rename from SPECS/photon-os-installer/0001-setup.py-Bump-up-version-to-2.1.patch rename to SPECS/photon-os-installer/0009-setup.py-Bump-up-version-to-2.1.patch index b5417c281e..139d05889d 100644 --- a/SPECS/photon-os-installer/0001-setup.py-Bump-up-version-to-2.1.patch +++ b/SPECS/photon-os-installer/0009-setup.py-Bump-up-version-to-2.1.patch @@ -1,7 +1,7 @@ -From 7a0bcb4d017c459d984e931c06b5c5d36efd5c71 Mon Sep 17 00:00:00 2001 +From 5bae287303e9d38ab663e8fce8bb2433803b376f Mon Sep 17 00:00:00 2001 From: Piyush Gupta Date: Mon, 20 Feb 2023 09:46:38 +0000 -Subject: [PATCH] setup.py: Bump up version to 2.1. +Subject: [PATCH 09/13] setup.py: Bump up version to 2.1. Change-Id: Ia6d4bcc6a4f7c56996471a3cbd412d0c91abf732 --- @@ -9,7 +9,7 @@ Change-Id: Ia6d4bcc6a4f7c56996471a3cbd412d0c91abf732 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py -index 2e786c08..5ca03e6b 100644 +index 2e786c0..5ca03e6 100644 --- a/setup.py +++ b/setup.py @@ -25,6 +25,6 @@ setup( @@ -21,5 +21,5 @@ index 2e786c08..5ca03e6b 100644 author_email='gpiyush@vmware.com' ) -- -2.23.3 +2.23.1 diff --git a/SPECS/photon-os-installer/0010-photon-os-installer-Adding-docs-and-sample_ks-direct.patch b/SPECS/photon-os-installer/0010-photon-os-installer-Adding-docs-and-sample_ks-direct.patch new file mode 100644 index 0000000000..ae1a24f0a1 --- /dev/null +++ b/SPECS/photon-os-installer/0010-photon-os-installer-Adding-docs-and-sample_ks-direct.patch @@ -0,0 +1,1371 @@ +From 0d9d6f45339bebafd5135a434f13651caa72b093 Mon Sep 17 00:00:00 2001 +From: Ankit Jain +Date: Thu, 2 Mar 2023 12:32:05 +0000 +Subject: [PATCH 10/13] photon-os-installer: Adding docs and sample_ks + directory + +- Moved ks_config.txt to docs/ks_config.md +- Moved ui_config.txt to docs/ui_config.md +- Moved sample_ks.cfg sample_ks/sample_ks.cfg +- Moved sample_ui.cfg sample_ks/sample_ui.cfg +- Added various sample_ks files under sample_ks/ + for different features such as: + - ostree + - preinstall, postinstall + - default configs + +Change-Id: I00e5fe3bd56d4cea04e7378663b8365f8400ab1e +Signed-off-by: Ankit Jain +--- + docs/README.md | 20 + + docs/ks_config.md | 604 ++++++++++++++++++ + docs/ui_config.md | 19 + + photon_installer/generate_initrd.sh | 2 +- + photon_installer/isoBuilder.py | 2 +- + photon_installer/ks_config.txt | 414 +----------- + photon_installer/sample_ks.cfg | 25 +- + photon_installer/sample_ui.cfg | 10 +- + photon_installer/ui_config.txt | 18 +- + sample_ks/sample_ks.cfg | 24 + + .../sample_ks_ostree_client_from_default.cfg | 12 + + .../sample_ks_ostree_client_from_server.cfg | 15 + + .../sample_ks_preinstall_postinstall.cfg | 28 + + ...s_preinstallscripts_postinstallscripts.cfg | 25 + + sample_ks/sample_ui.cfg | 9 + + 15 files changed, 762 insertions(+), 465 deletions(-) + create mode 100644 docs/README.md + create mode 100644 docs/ks_config.md + create mode 100644 docs/ui_config.md + create mode 100644 sample_ks/sample_ks.cfg + create mode 100644 sample_ks/sample_ks_ostree_client_from_default.cfg + create mode 100644 sample_ks/sample_ks_ostree_client_from_server.cfg + create mode 100644 sample_ks/sample_ks_preinstall_postinstall.cfg + create mode 100644 sample_ks/sample_ks_preinstallscripts_postinstallscripts.cfg + create mode 100644 sample_ks/sample_ui.cfg + +diff --git a/docs/README.md b/docs/README.md +new file mode 100644 +index 0000000..5fc927f +--- /dev/null ++++ b/docs/README.md +@@ -0,0 +1,20 @@ ++# What is kickstart ++Kickstart is a json format file use to configure installer to deploy OS as per user requirements. ++ ++# Ways to provide Kickstart path: ++ ++### 1. Remote kickstart ++ ++ ks=http:// ++ ++### 2. Kickstart from cdrom attched with iso ++ ++ ks=cdrom:/isolinux/sample_ks.cfg ++ ++### 3. Secondary Device Kickstart ++ ++ ks=: ++ Example: ++ ks=/dev/sr1:/isolinux/sample_ks.cfg ++ ++Please refer [ks_config.md](https://github.com/vmware/photon-os-installer/docs/ks_config.md) to explore more about kickstart features. +diff --git a/docs/ks_config.md b/docs/ks_config.md +new file mode 100644 +index 0000000..e6dd010 +--- /dev/null ++++ b/docs/ks_config.md +@@ -0,0 +1,604 @@ ++# Kickstart Features ++ ++Kickstart config file is a json format with following possible parameters: ++ ++ ++### _"additional_files":_ (optional) ++ ++- Contains list of pairs { source file (or directory), destination file ++(or directory) } to copy to the target system. Source file ++(directory) will be looked up in "search_path" list. ++ ++ Example: ++ ```json ++ { ++ "additional_files": [ ++ {"resizefs.sh": "/usr/local/bin/resizefs.sh"}, ++ {"resizefs.service": "/lib/systemd/system/resizefs.service"} ++ ] ++ } ++ ``` ++### _"additional_packages":_ ++- Same as _"packages"_ ++ ++### _"additional_rpms_path":_ (optional) ++- Provide a path containing additional RPMS that are to be bundled into the image. ++ ++ ++### _"arch":_ (optional) ++- Target system architecture. Should be set if target architecture is ++different from host one, for instance x86_64 machine building RPi ++image. ++ ++ - ***Acceptable values:*** _"x86_64"_, _"aarch64"_ ++ ++ - ***Default value:*** autodetected host architecture ++ ++ Example: ++ ```json ++ { ++ "arch": "aarch64" ++ } ++ ``` ++ ++### _"bootmode":_ (optional) ++- Sets the boot type to suppot: EFI, BIOS or both. ++ ++ - ***Acceptable values:*** _"bios"_, _"efi"_, _"dualboot"_ ++ - ***Default value:*** _"dualboot"_ for x86_64 and _"efi"_ for aarch64 ++ ++- _"bios"_ will add special partition (very first) for first stage grub. ++- _"efi"_ will add ESP (Efi Special Partition), format is as FAT and copy ++there EFI binaries including grub.efi ++- _"dualboot"_ will add two extra partitions for "bios" and "efi" modes. ++ - This target will support both modes that can be switched in bios ++settings without extra actions in the OS. ++ ++ Example: ++ ```json ++ { ++ "bootmode": "bios" ++ } ++ ``` ++ ++### _"disk":_ (required) ++ ++- Target"s disk device file path to install into, such as "/dev/sda". ++Loop device is also supported. ++ ++ Example: ++ ```json ++ { ++ "disk": "/dev/sdb" ++ } ++ ``` ++- /dev/disk/by-path is also supported. ++ ++ Example: ++ ```json ++ { ++ "disk": "/dev/disk/by-path/pci-0000:03:00.0-scsi-0:0:1:0" ++ } ++ ``` ++### _"eject_cdrom":_ (optional) ++- Eject or not cdrom after installation completed. ++ - **Boolean:** _true_ or _false_ ++ - **Default value:** true ++ ++ Example: ++ ```json ++ { ++ "eject_cdrom": false ++ } ++ ``` ++ ++### _"hostname":_ (optional) ++- Set target host name. ++ - **Default value:** "photon-" ++ ++ Example: ++ ```json ++ { ++ "hostname": "photon-machine" ++ } ++ ``` ++### _"live":_ (optional) ++- Should be set to false if target system will not be run on ++ host machine. When it set to false, installer will not add EFI boot ++ entries, and will not generate unique machine-id. ++ - **Boolean:** _false_ if "disk" is /dev/loop and _true_ otherwise. ++ ++ Example: ++ ```json ++ { ++ "live": false ++ } ++ ``` ++### _"log_level":_ (optional) ++- Set installer logging level. ++ - **Acceptable values:** _"error"_, _"warning"_, _"info"_, _"debug"_ ++ - **Default value:** _"info"_ ++ ++ Example: ++ ```json ++ { ++ "log_level": "debug" ++ } ++ ``` ++### _"ostree":_ (optional) ++- Atomic flavour of Photon OS. ++- Define the type of repo data used for installing the OS ++- There are two type: ++ 1. Default Repo(comes with ISO) ++ 2. Custom Repo (Remote server) ++ - _"default_repo":_ (required) ++ - **Boolean:** _true_ or _false_ ++ - _true_ : Default Repo is selected ++ - _false_: Custom Repo is selected ++ - **Default value:** _true_ ++ Example: ++ ```json ++ { ++ "ostree": { ++ "default_repo": true ++ } ++ } ++ ``` ++ - _"repo_url":_ (Required, Only If Custom Repo is selected) ++ - **Supported Values:** Valid "repo" URL of remote server where repo data exists ++ - _"repo_ref":_ (Required, Only If Custom Repo is selected) ++ - **Supported Value:** Valid "ref" path which was mentioned for ++ creation of Base Tree on remote server ++ ++ Example: ++ ```json ++ { ++ "ostree": { ++ "default_repo": false, ++ "repo_url": "http://:/repo", ++ "repo_ref": "photon/4.0/x86_64/minimal" ++ } ++ } ++ ``` ++ ++### _"packagelist_file":_ (optional if _"packages"_ set) ++- Contains file name which has list of packages to install. ++ ++ Example: ++ ```json ++ { ++ "packagelist_file": "packages_minimal.json" ++ } ++ ``` ++ ++### _"packages":_ (optional if _"packagelist_file"_ set) ++- Contains list of packages to install. ++ ++ Example: ++ ```json ++ { ++ "packages": ["minimal", "linux", "initramfs"] ++ } ++ ``` ++ ++### _"partition_type":_ (optional) ++- Set partition table type. Supported values are: "gpt", "msdos". ++ - **Default value:** _"gpt"_ ++ ++ Example: ++ ```json ++ { ++ "partition_type": "msdos" ++ } ++ ``` ++ ++### _"partitions":_ (optional) ++- Contains list of partitions to create. ++- Each partition is a dictionary of the following items: ++ - _"filesystem":_ (required) ++ - Filesystem type. ++ - **Supported values:** _"swap"_, _"ext4"_, _"vfat"_, _"xfs"_, _"btrfs"_. ++ ++ - _"disk":_ (_optional_ if single disk device is available, ++ _required_ if multiple disk devices are available) ++ - Target disk device will have the defined partition ++ - **Supported values:** ++ - _"/dev/loop":_ loop devices ++ - _"/dev/sdX"_ : scsi drives based devices ++ - _"/dev/hdX"_ : IDE drives based devices ++ - _"mountpoint":_ (required for non "swap" partitions) ++ - Mount point for the partition. ++ - _"size":_ (required) ++ - Size of the partition in MB. If 0 then partition is considered ++ as expansible to fill rest of the disk. Only one expansible ++ partition is allowed. ++ - _"mkfs_options":_ (optional) ++ - Additional parameters for the mkfs command as a string ++ - _"fs_options":_ (optional) ++ -fs options to be passed to mount command as a string ++ ++ Example: ++ ```json ++ "fs_options": "nodev,noexec,nosuid" ++ ``` ++ - _"btrfs":_ (optional) ++ - Creates btrfs volumes and subvolumes. ++ - Value is a dictionary with 1 required and 1 optional key. ++ - _"label"_ (optional) ++ - Name of the parent volume label. ++ - _"subvols"_ (optional) ++ - Subvolumes inside parent volume. ++ ++ Example: ++ ```json ++ { ++ "disk": "/dev/sda", ++ "partitions": [ ++ { ++ "mountpoint": "/", ++ "size": 0, ++ "filesystem": "btrfs" ++ } ++ ] ++ } ++ ``` ++ Example to create subvols: ++ ```json ++ { ++ "partitions" : [ ++ { ++ "mountpoint": "/", ++ "size": 2048, ++ "filesystem": "btrfs", ++ "btrfs" : { ++ "label" : "main", ++ "subvols" : [ ++ { ++ "name": "rootfs", ++ "mountpoint": "/root" ++ }, ++ { ++ "name": "home", ++ "mountpoint": "/home", ++ "subvols": [ ++ { ++ "name": "dir1", ++ "mountpoint": "/dir1" ++ } ++ ] ++ } ++ ] ++ } ++ } ++ ] ++ } ++ ``` ++ - _"lvm":_ (optional) ++ - Will logical volume (LVM) for this partition. ++ - Value is a dictionary with 2 required keys: ++ - _"vg_name"_ (required) ++ - Name of a virtual group to put current partition into. ++ - Several partitions may have same "vg_name" ++ - _"lv_name"_ (required) ++ - Unique logical volume name of the partition. ++ ++ Example: ++ ```json ++ { ++ "partitions" : [ ++ { ++ "mountpoint": "/", ++ "size": 0, ++ "filesystem": "ext4", ++ "lvm": { ++ "vg_name": "VirtualGroup1", ++ "lv_name": "root" ++ } ++ }, ++ { ++ "mountpoint": "/boot/efi", ++ "size": 12, ++ "filesystem": "vfat", ++ "fs_options": "-n EFI" ++ }, ++ { ++ "size": 128, ++ "filesystem": "swap" ++ } ++ ] ++ } ++ ``` ++ Example: Multiple Disk device partition table ++ ```json ++ { ++ "partitions": [ ++ { ++ "disk": "/dev/sda", ++ "mountpoint": "/", ++ "size": 0, ++ "filesystem": "ext4" ++ }, ++ { ++ "disk": "/dev/sdb", ++ "mountpoint": "/sdb", ++ "size": 0, ++ "filesystem": "ext4" ++ }, ++ { ++ "disk": "/dev/sdc", ++ "mountpoint": "/sdc", ++ "size": 0, ++ "filesystem": "ext4" ++ }, ++ ] ++ } ++ ``` ++ - _"ab":_ (optional) ++ - This feature enables the system to create a shadow partition ++ (snapshot of user-defined partition) of a user defined partition. ++ - This is required to support the system upgrade/rollback functionality via ++ AB System Upgrade mechanism. ++ - **Acceptable values:** _true_, _false_ ++ - **Default value:** _false_ ++ ++ Example: In given the partition table below, the "/" partition will have ++ a shadow partition but the "/sda" partition will not have a shadow partition: ++ ```json ++ { ++ "partitions": [ ++ { ++ "disk": "/dev/sda", ++ "mountpoint": "/", ++ "size": 0, ++ "filesystem": "ext4", ++ "ab": true ++ }, ++ { ++ "disk": "/dev/sda", ++ "mountpoint": "/sda", ++ "size": 100, ++ "filesystem": "ext4" ++ } ++ ] ++ } ++ ``` ++ ++### _"network":_ (optional) ++- Used to configure network in live/installed system. ++ ++- Set _"version":_ _"2"_ or the legacy config will be used, see below. ++ ++- The syntax roughly follows the cloud-init or netplan configuration, ++ but not all options are supported. ++ ++ - _"hostname":_ set the host name. ++ ++ - _"ethernets":_ Settings for ethernet interfaces. Each interface has an 'id', ++ which can be any name which may be refrenced for examplev for VLANs. Can ++ be the interface name. ++ ++ - Within any _'id'_: ++ ++ - _"match"_ : set a way to match this interface. Can be 'name' or 'macaddress'. ++ ++ - _"dhcp4"_ : boolean, set to true or false ++ ++ - _"dhcp6"_ : boolean, set to true or false ++ ++ - _"accept-ra"_ : boolean, set to true or false. Whether to accept ++ Router Advertisement for IPv6. ++ ++ - _"addresses"_ : a list of ip addresses (IPv4 or IPv6) with cidr netmask. ++ ++ - _"gateway"_ : the default gateway. ++ ++ - _"nameservers"_ : a dictionary with "addresses" containing a list of name servers, ++ and "search" with a list of search domains. ++ ++ - _"vlans":_ Settings for VLAN interfaces. Similar to _"ethernets"_ above, ++ but with these additional required settings: ++ ++ - _"id"_ : the VLAN id (integer in the range 1..4094) ++ ++ - _"link"_ : the id of the ethernet interface to use, from the "ethernets" ++ configured. ++ ++ Example: ++ ```json ++ { ++ "network":{ ++ "version": "2", ++ "hostname" : "photon-machine", ++ "ethernets": { ++ "id0": { ++ "match": { ++ "name" : "eth0" ++ }, ++ "dhcp4" : false, ++ "addresses": ["192.168.2.58/24"], ++ "gateway": "192.168.2.254", ++ "nameservers": { ++ "addresses" : ["8.8.8.8", "8.8.4.4"], ++ "search" : ["vmware.com", "eng.vmware.com"] ++ } ++ } ++ }, ++ "vlans": { ++ "vlan0": { ++ "id": 100, ++ "link": "id0", ++ "addresses":["192.168.100.58/24"] ++ } ++ } ++ } ++ } ++ ``` ++ ++ - Legacy network configuration: ++ - _"type"_ (required) ++ - String: must be one of _dhcp_/_static_/_vlan_. Indicates how the network ++ is being configured. ++ - _"hostname"_ (optional; when _type_ == _dhcp_) ++ - String: DHCP client hostname ++ - _"ip_addr"_ (required; when _type_ == _static_) ++ - IP String: IP address to be configured ++ - _"netmask"_ (required; when _type_ == _static_) ++ - IP String: Netmask to be configured ++ - _"gateway"_ (required; when _type_ == _static_) ++ - IP String: Gateway IP address to be configured ++ - _"nameserver"_ (required; when _type_ == _static_) ++ - IP String: Name server IP address to be configured ++ - _"vlan_id"_ (required; when _type_ == _vlan_) ++ - ID String: (1-4094); VLAN ID number expressed as string ++ ++### _"password":_ (optional) ++- Set root password. It is dictionary of the following items: ++ - _"text"_ (required) password plain text (_"crypted"_ : _false_) ++ or encrypted (_"crypted"_: _true_) ++ - _"crypted"_ (required) Hint on how to interpret "text" content. ++ - _"age"_ (optional) Set password expiration date. If not set, then ++ used Photon OS default password aging value. ++ - **Value:** integer. Meanings: ++ - Any positive number - password will be expired in ++ so many days from today. ++ - Zero (0) - marks password as already expired. root ++ will be asked to change current password during the ++ first login. ++ - Minus one (-1) - removes root password expiration date. ++ - **Default value:** ++ ```json ++ { ++ "crypted": true, ++ "text": "*" ++ } ++ ``` ++ which means root is not allowed to login. ++ ++ Example: ++ ```json ++ { ++ "password": { ++ "crypted": false, ++ "text": "changeme", ++ "age": 0 ++ } ++ } ++ ``` ++ ++### _"postinstall":_ (optional) ++- Contains list of lines to be executed as a single script on ++ the target after installation. ++ ++ Example: ++ ```json ++ { ++ "postinstall": [ ++ "#!/bin/sh", ++ "echo \"Hello World\" > /etc/postinstall" ++ ] ++ } ++ ``` ++ ### _"postinstallscripts":_ (optional) ++- Contains list of scripts to execute on the target after installation. ++- Scripts will be looked up in _"search_path"_ list. ++ ++ Example: ++ ```json ++ { ++ "postinstallscripts": ["rpi3-custom-patch.sh"] ++ } ++ ``` ++ ++### _"preinstall":_ (optional) ++- Contains list of lines to be executed as a single script on ++ the target before installation starts. ++- if ks file defines any value($VALUE) that need to be populated dynamically ++ during runtime then it should be determined and exported in preinstall script. ++ ++ Example: ++ ```json ++ { ++ "disk": "$DISK" ++ "preinstall": [ ++ "#!/bin/sh", ++ "ondisk=$(ls -lh /dev/disk/by-path/ | grep 'scsi-0:0:1:0' | cut -d' ' -f 9)", ++ "export DISK=\"/dev/disk/by-path/$ondisk\"" ++ ] ++ } ++ ``` ++### _"preinstallscripts":_ (optional) ++- Contains list of scripts to execute on the target before installation starts. ++- Scripts will be looked up in _"search_path"_ list. ++ ++ Example: ++ ```json ++ { ++ "preinstallscripts": ["find_disk.sh"] ++ } ++ ``` ++ ++### _"public_key":_ (optional) ++- To inject entry to authorized_keys as a string. Setting this variable ++ enables root login in sshd config. ++ ++### _"search_path":_ (optional) ++- List of directories to search for additional files and scripts. ++ ++ Example: ++ ```json ++ { ++ "search_path": ["/home/user", "/tmp"] ++ } ++ ``` ++ ++### _"shadow_password":_ (optional) ++- Contains encrypted root password . ++- Short form of: ++ ```json ++ { ++ "password": { ++ "crypted": true, ++ "text": "" ++ } ++ } ++ ``` ++ ++### _"ui":_ (optional) ++- Installer will show UI for progress status if it set to true. ++ Or logging output will be printed to console - default behavior. ++ - **Boolean:** _true_ or _false_ ++ - **Default value:** _false_ ++ ++ Example: ++ ```json ++ { ++ "ui": true ++ } ++ ``` ++ ++### _"linux_flavor":_ (optional) ++- Contains the flavor of linux to install, if multiple linux flavors ++ are present in _"packages"_ or _"packagelist_file"_ ++ - **Acceptable values:** _"linux"_, _"linux-esx"_, _"linux-rt"_, _"linux-aws"_, and _"linux-secure"_ ++ ++ Example: ++ ```json ++ { ++ "linux_flavor": "linux-esx" ++ } ++ ``` ++ ++### _"photon_docker_image":_ (optional) ++- Contains the docker image ++ are present in _"packages"_ or _"packagelist_file"_ ++ - **Acceptable values:** _"photon:1.0"_, _"photon:2.0"_, _"photon:3.0"_, _"photon:4.0"_, _"photon:latest"_ etc. ++ - **Default value:** _"photon:latest"_ ++ ++ Example: ++ ```json ++ { ++ "photon_docker_image": "photon:4.0" ++ } ++ ``` ++ ++For reference, look at [sample_ks.cfg](../sample_ks/sample_ks.cfg) file +diff --git a/docs/ui_config.md b/docs/ui_config.md +new file mode 100644 +index 0000000..dc8e363 +--- /dev/null ++++ b/docs/ui_config.md +@@ -0,0 +1,19 @@ ++# What is UI config ++ ++UI config is a json format file with the following possible parameters: ++ ++**Note:** All top level keys must be optional. ++ ++### "download_screen" (depends on _"network_screen"_) ++- Used to show a window where user can input a custom URL from ++ which a file can be downloaded and placed in a custom location ++ in the installed system. ++ ++ - _"title"_ (required) ++ - A short title to identify this screen ++ - _"intro"_ (required) ++ - An brief 2 line intro of what URL you are requesting the ++ user to input ++ - _"destination"_ (required) ++ - String: Path to where in the installed system you would ++ like to see this file +diff --git a/photon_installer/generate_initrd.sh b/photon_installer/generate_initrd.sh +index cdf2eda..e18a488 100755 +--- a/photon_installer/generate_initrd.sh ++++ b/photon_installer/generate_initrd.sh +@@ -66,7 +66,7 @@ rm -rf ${INITRD}/var/cache/tdnf + mv ${INITRD}/boot ${WORKINGDIR}/ + + mkdir -p $INITRD/installer +-cp $SCRIPT_PATH/sample_ui.cfg ${INITRD}/installer ++cp $SCRIPT_PATH/../sample_ks/sample_ui.cfg ${INITRD}/installer + mv ${WORKINGDIR}/EULA.txt ${INITRD}/installer + + # TODO: change minimal to custom.json +diff --git a/photon_installer/isoBuilder.py b/photon_installer/isoBuilder.py +index 4bec77c..90ed1cd 100755 +--- a/photon_installer/isoBuilder.py ++++ b/photon_installer/isoBuilder.py +@@ -272,7 +272,7 @@ def main(): + parser.add_argument("-c", "--custom-initrd-pkgs", dest="custom_initrd_pkgs", default=None, help="optional parameter to provide cutom initrd pkg list file.") + parser.add_argument("-r", "--additional_repos", action="append", default=None, help=" Pass repo file as input to download rpms from external repo") + parser.add_argument("-p", "--custom-packages-json", dest="custom_packages_json", default="") +- parser.add_argument("-k", "--kickstart-path", dest="kickstart_path", default=f"{os.path.dirname(__file__)}/sample_ks.cfg") ++ parser.add_argument("-k", "--kickstart-path", dest="kickstart_path", default=f"{os.path.dirname(__file__)}/../sample_ks/sample_ks.cfg") + parser.add_argument("-b", "--boot-cmdline-param", dest="boot_cmdline_param", default="") + + options = parser.parse_args() +diff --git a/photon_installer/ks_config.txt b/photon_installer/ks_config.txt +index 9f8010c..55850e5 100644 +--- a/photon_installer/ks_config.txt ++++ b/photon_installer/ks_config.txt +@@ -1,413 +1 @@ +-/* +- * Copyright © 2020 VMware, Inc. +- * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-only +- */ +-Ways to provide Kickstart path: +- +-1. Remote kickstart:- +- +- ks=http:// +- +-2. Kickstart from cdrom attched with iso: +- +- ks=cdrom:/isolinux/sample_ks.cfg +- +-3. Secondary Device Kickstart +- +- ks=: +- Ex- ks=/dev/sr1:/isolinux/sample_ks.cfg +- +-Kickstart config file is a json format with following possible parameters: +- +-"additional_files": (optional) +- Contains list of pairs { source file (or directory), destination file +- (or directory) } to copy to the target system. Source file +- (directory) will be looked up in "search_path" list. +- Example: { "additional_files": [ +- {"resizefs.sh": "/usr/local/bin/resizefs.sh"}, +- {"resizefs.service": "/lib/systemd/system/resizefs.service"}]} +- +-"additional_packages" same as "packages" +- +-"additional_rpms_path" (optional) +- Provide a path containing additional RPMS that are to be bundled into +- the image. +- +-"arch" (optional) +- Target system architecture. Should be set if target architecture is +- different from host one, for instance x86_64 machine building RPi +- image. +- Acceptable values are: "x86_64", "aarch64" +- Default value: autodetected host architecture +- Example: { "arch": "aarch64" } +- +-"bootmode" (optional) +- Sets the boot type to suppot: EFI, BIOS or both. +- Acceptable values are: "bios", "efi", "dualboot" +- "bios" will add special partition (very first) for first stage grub. +- "efi" will add ESP (Efi Special Partition), format is as FAT and copy +- there EFI binaries including grub.efi +- "dualboot" will add two extra partitions for "bios" and "efi" modes. +- This target will support both modes that can be switched in bios +- settings without extra actions in the OS. +- Default value: "dualboot" for x86_64 and "efi" for aarch64 +- Example: { "bootmode": "bios" } +- +-"disk" (required) +- Target"s disk device file path to install into, such as "/dev/sda". +- Loop device is also supported. +- Example: { "disk": "/dev/sdb" } +- /dev/disk/by-path is also supported. +- Example: { "disk": "/dev/disk/by-path/pci-0000:03:00.0-scsi-0:0:1:0" } +- +-"eject_cdrom" (optional) +- Eject or not cdrom after installation completed. +- Boolean: true or false +- Default value: true +- Example: { "eject_cdrom": false } +- +-"hostname" (optional) +- Set target host name. +- Default value: "photon-" +- Example: { "hostname": "photon-machine" } +- +-"live" (optional) +- Should be set to flase if target system will not be run on +- host machine. When it set to false, installer will not add EFI boot +- entries, and will not generate unique machine-id. +- Default value: false if "disk" is /dev/loop and true otherwise. +- Example: { "live": false } +- +-"log_level" (optional) +- Set installer logging level. +- Acceptable values are: "error", "warning", "info", "debug" +- Default value: "info" +- Example: { "log_level": "debug" } +- +-"ostree" (optional) +- Atomic flavour of Photon OS. +- "default_repo" (required) +- Define the type of repo data used for installing the OS +- There are two type: 1. Default Repo(comes with ISO) 2. Custom Repo (Remote server) +- Boolean: true or false +- where true : Default Repo is selected +- false: Custom Repo is selected +- Default value: true +- Example: { "ostree": {"default_repo": true}} +- "repo_url" (Required, Only If Custom Repo is selected) +- Supported Value: Valid "repo" URL of remote server where repo data exists +- "repo_ref" (Required, Only If Custom Repo is selected) +- Supported Value: Valid "ref" path which was mentioned for +- creation of Base Tree on remote server +- Example: { "ostree": { +- "default_repo": false, +- "repo_url": "http://:/repo", +- "repo_ref": "photon/3.0/x86_64/minimal" +- } +- } +- +-"packagelist_file" (optional if "packages" set) +- Contains file name which has list of packages to install. +- Example: { "packagelist_file": "packages_minimal.json" } +- +-"packages" (optional if "packagelist_file" set) +- Contains list of packages to install. +- Example: { "packages": ["minimal", "linux", "initramfs"] } +- +-"partition_type" (optional) +- Set partition table type. Supported values are: "gpt", "msdos". +- Default value: "gpt" +- Example: { "partition_type": "msdos" } +- +-"partitions" (optional) +- Contains list of partitions to create. +- Each partition is a dictionary of the following items: +- "filesystem" (required) +- Filesystem type. Supported values are: "swap", "ext4", "vfat", "xfs", "btrfs". +- "disk" (optional if single disk device is available, +- required if multiple disk devices are available) +- Target disk device will have the defined partition +- Supported values are: +- "/dev/loop": loop devices +- "/dev/sdX" : scsi drives based devices +- "/dev/hdX" : IDE drives based devices +- "mountpoint" (required for non "swap" partitions) +- Mount point for the partition. +- "size" (required) +- Size of the partition in MB. If 0 then partition is considered +- as expansible to fill rest of the disk. Only one expansible +- partition is allowed. +- "mkfs_options" (optional) +- Additional parameters for the mkfs command as a string +- "fs_options" (optional) +- fs options to be passed to mount command as a string +- ex - "fs_options": "nodev,noexec,nosuid" +- "btrfs" (optional) +- Creates btrfs volumes and subvolumes. +- Value is a dictionary with 1 required and 1 optional key. +- "label" (optional) +- Name of the parent volume label. +- "subvols" (optional) +- Subvolumes inside parent volume. +- Ex - +- "disk": "/dev/sda", +- "partitions": [ +- {"mountpoint": "/", "size": 0, "filesystem": "btrfs"}] +- Ex to create subvols - +- { "partitions" : +- [{ "mountpoint": "/", "size": 2048, "filesystem": "btrfs", +- "btrfs" : +- { +- "label" : "main", +- "subvols" : [ +- {"name": "rootfs", "mountpoint": "/root"}, +- {"name": "home", "mountpoint": "/home", "subvols": [{"name": "dir1", "mountpoint": "/dir1"}]} +- ] +- } +- }] +- } +- "lvm" (optional) +- Will logical volume (LVM) for this partition. +- Value is a dictionary with 2 required keys: +- "vg_name" (required) +- Name of a virtual group to put current partition into. +- Several partitions may have same "vg_name" +- "lv_name" (required) +- Unique logical volume name of the partition. +- Default value: [{"mountpoint": "/", "size": 0, "filesystem": "ext4"}] +- Example: { "partitions" : [ +- { "mountpoint": "/", "size": 0, "filesystem": "ext4", +- "lvm": { +- "vg_name": "VirtualGroup1", +- "lv_name": "root" +- } +- }, +- { +- "mountpoint": "/boot/efi", +- "size": 12, +- "filesystem": "vfat", +- "fs_options": "-n EFI" +- }, +- {"size": 128, "filesystem": "swap"} ] } +- Example: Multiple Disk device partition table +- { "partitions": [ +- { +- "disk": "/dev/sda", +- "mountpoint": "/", +- "size": 0, +- "filesystem": "ext4" +- }, +- { +- "disk": "/dev/sdb", +- "mountpoint": "/sdb", +- "size": 0, +- "filesystem": "ext4" +- }, +- { +- "disk": "/dev/sdc", +- "mountpoint": "/sdc", +- "size": 0, +- "filesystem": "ext4" +- }, +- ] +- } +- "ab": (optional) +- This feature enables the system to create a shadow partition +- (snapshot of user-defined partition) of a user defined partition. +- This is required to support the system upgrade/rollback functionality via +- AB System Upgrade mechanism. +- Acceptable values are: true, false +- Default value: false +- Example: In given the partition table below, the "/" partition will have +- a shadow partition but the "/sda" partition will not have a shadow partition: +- { "partitions": [ +- { +- "disk": "/dev/sda", +- "mountpoint": "/", +- "size": 0, +- "filesystem": "ext4", +- "ab": true +- }, +- { +- "disk": "/dev/sda", +- "mountpoint": "/sda", +- "size": 100, +- "filesystem": "ext4" +- } +- ] +- } +- +-"network" (optional) +- Used to configure network in live/installed system. +- +- Set "version": "2" or the legacy config will be used, see below. +- +- The syntax roughly follows the cloud-init or netplan configuration, +- but not all options are supported. +- +- "hostname": set the host name. +- +- "ethernets": Settings for ethernet interfaces. Each interface has an 'id', +- which can be any name which may be refrenced for examplev for VLANs. Can +- be the interface name. +- +- Within any 'id': +- +- "match" : set a way to match this interface. Can be 'name' or 'macaddress'. +- +- "dhcp4" : boolean, set to true or false +- +- "dhcp6" : boolean, set to true or false +- +- "accept-ra" : boolean, set to true or false. Whether to accept +- Router Advertisement for IPv6. +- +- "addresses" : a list of ip addresses (IPv4 or IPv6) with cidr netmask. +- +- "gateway" : the default gateway. +- +- "nameservers" : a dictionary with "addresses" containing a list of name servers, +- and "search" with a list of search domains. +- +- "vlans": Settings for VLAN interfaces. Similar to "ethernets" above, +- but with these additional required settings: +- +- "id" : the VLAN id (integer in the range 1..4094) +- +- "link" : the id of the ethernet interface to use, from the "ethernets" +- configured. +- +- Example: +- +- "network":{ +- "version": "2", +- "hostname" : "photon-machine", +- "ethernets": { +- "id0":{ +- "match":{ +- "name" : "eth0" +- }, +- "dhcp4" : false, +- "addresses":[ +- "192.168.2.58/24" +- ], +- "gateway": "192.168.2.254", +- "nameservers":{ +- "addresses" : ["8.8.8.8", "8.8.4.4"], +- "search" : ["vmware.com", "eng.vmware.com"] +- } +- } +- }, +- "vlans": { +- "vlan0": { +- "id": 100, +- "link": "id0", +- "addresses":[ +- "192.168.100.58/24" +- ] +- } +- } +- } +- +- Legacy network configuration: +- +- "type" (required) +- String; must be one of dhcp/static/vlan. Indicates how the network +- is being configured. +- "hostname" (optional; when type == dhcp) +- String; DHCP client hostname +- "ip_addr" (required; when type == static) +- IP String; IP address to be configured +- "netmask" (required; when type == static) +- IP String; Netmask to be configured +- "gateway" (required; when type == static) +- IP String; Gateway IP address to be configured +- "nameserver" (required; when type == static) +- IP String; Name server IP address to be configured +- "vlan_id" (required; when type == vlan) +- ID String. (1-4094); VLAN ID number expressed as string +- +-"password" (optional) +- Set root password. It is dictionary of the following items: +- "text" (required) password plain text ("crypted" : false) +- of encrypted ("crypted": true) +- "crypted" (required) Hint on how to interpret "text" content. +- "age" (optional) Set password expiration date. If not set, then +- used Photon OS default password aging value. +- Value: integer. Meanings: +- - Any positive number - password will be expired in +- so many days from today. +- - Zero (0) - marks password as already expired. root +- will be asked to change current password during the +- first login. +- - Minus one (-1) - removes root password expiration date. +- Default value: { "crypted": true, "text": "*"} } +- which means root is not allowed to login. +- Example: { "password": { +- "crypted": false, +- "text": "changeme", +- "age": 0 } } +- +-"postinstall" (optional) +- Contains list of lines to be executed as a single script on +- the target after installation. +- Example: { "postinstall": [ +- "#!/bin/sh", +- "echo \"Hello World\" > /etc/postinstall" ] } +-"postinstallscripts" (optional) +- Contains list of scripts to execute on the target after installation. +- Scripts will be looked up in "search_path" list. +- Example: { "postinstallscripts": ["rpi3-custom-patch.sh"] } +- +-"preinstall" (optional) +- Contains list of lines to be executed as a single script on +- the target before installation starts. +- if ks file defines any value($VALUE) that need to be populated dynamically +- during runtime then it should be determined and exported in preinstall script. +- Example: { +- "disk": "$DISK" +- "preinstall": [ +- "#!/bin/sh", +- "ondisk=$(ls -lh /dev/disk/by-path/ | grep 'scsi-0:0:1:0' | cut -d' ' -f 9)", +- "export DISK=\"/dev/disk/by-path/$ondisk\"" +- ] } +-"preinstallscripts" (optional) +- Contains list of scripts to execute on the target before installation starts. +- Scripts will be looked up in "search_path" list. +- Example: { "preinstallscripts": ["find_disk.sh"] } +- +-"public_key" (optional) +- To inject entry to authorized_keys as a string. Setting this variable +- enables root login in sshd config. +- +-"search_path" (optional) +- List of directories to search for additional files and scripts. +- Example: { "search_path": ["/home/user", "/tmp"] } +- +-"shadow_password" (optional) +- Contains encrypted root password . +- Short form of: { "password": { +- "crypted": true, +- "text": ""} } +- +-"ui" (optional) +- Installer will show UI for progress status if it set to true. +- Or logging output will be printed to console - default behavior. +- Boolean: true or false +- Default value: false +- Example: { "ui": true } +- +-"linux_flavor" (optional) +- Contains the flavor of linux to install, if multiple linux flavors +- are present in "packages" or "packagelist_file" +- Acceptable values are: "linux", "linux-esx", "linux-rt", "linux-aws", and "linux-secure" +- Example: { "linux_flavor": "linux-esx" } +- +-"photon_docker_image" (optional) +- Contains the docker image +- are present in "packages" or "packagelist_file" +- Acceptable values are: "photon:1.0", "photon:2.0", "photon:3.0", "photon" etc. +- Default value: "photon:latest" +- Example: { "photon_docker_image": "photon:3.0" } +- +-For reference, look at "sample_ks.cfg" file ++Documentation has been moved to https://github.com/vmware/photon-os-installer/docs/ks_config.md +diff --git a/photon_installer/sample_ks.cfg b/photon_installer/sample_ks.cfg +index 2334718..ec66c01 100644 +--- a/photon_installer/sample_ks.cfg ++++ b/photon_installer/sample_ks.cfg +@@ -1,24 +1 @@ +-{ +- "hostname": "photon-machine", +- "password": +- { +- "crypted": false, +- "text": "changeme" +- }, +- "disk": "/dev/sda", +- "partitions": [ +- {"mountpoint": "/", "size": 0, "filesystem": "ext4"}, +- {"mountpoint": "/boot", "size": 128, "filesystem": "ext4"}, +- {"mountpoint": "/root", "size": 128, "filesystem": "ext4"}, +- {"size": 128, "filesystem": "swap"} +- ], +- "packagelist_file": "packages_minimal.json", +- "additional_packages": ["vim"], +- "postinstall": [ +- "#!/bin/sh", +- "echo \"Hello World\" > /etc/postinstall" +- ], +- "public_key": "", +- "linux_flavor": "linux", +- "photon_docker_image": "photon:3.0" +-} ++This file has been moved to https://github.com/vmware/photon-os-installer/sample_ks/sample_ks.cfg +diff --git a/photon_installer/sample_ui.cfg b/photon_installer/sample_ui.cfg +index 089ffe7..816db8a 100644 +--- a/photon_installer/sample_ui.cfg ++++ b/photon_installer/sample_ui.cfg +@@ -1,9 +1 @@ +-{ +- "license_display_title": "Licence Display Title", +- "eula_file_path": null, +- "download_screen": { +- "title": "[!] Download File from URL Page", +- "intro": "This is a short description on what this window is doing", +- "destination": "/etc/config/config.file" +- } +-} ++This file has been moved to https://github.com/vmware/photon-os-installer/sample_ks/sample_ui.cfg +diff --git a/photon_installer/ui_config.txt b/photon_installer/ui_config.txt +index 939814c..ae39b68 100644 +--- a/photon_installer/ui_config.txt ++++ b/photon_installer/ui_config.txt +@@ -1,17 +1 @@ +-UI config file is a json format with following possible parameters: +- +-Note: All top level keys must be optional. +- +-"download_screen" (depends on "network_screen") +- Used to show a window where user can input a custom URL from +- which a file can be downloaded and placed in a custom location +- in the installed system. +- +- "title" (required) +- A short title to identify this screen +- "intro" (required) +- An brief 2 line intro of what URL you are requesting the +- user to input +- "destination" (required) +- String; Path to where in the installed system you would +- like to see this file ++Documentation has been moved to https://github.com/vmware/photon-os-installer/docs/ui_config.md +diff --git a/sample_ks/sample_ks.cfg b/sample_ks/sample_ks.cfg +new file mode 100644 +index 0000000..b7c4ade +--- /dev/null ++++ b/sample_ks/sample_ks.cfg +@@ -0,0 +1,24 @@ ++{ ++ "hostname": "photon-machine", ++ "password": ++ { ++ "crypted": false, ++ "text": "changeme" ++ }, ++ "disk": "/dev/sda", ++ "partitions": [ ++ {"mountpoint": "/", "size": 0, "filesystem": "ext4"}, ++ {"mountpoint": "/boot", "size": 128, "filesystem": "ext4"}, ++ {"mountpoint": "/root", "size": 128, "filesystem": "ext4"}, ++ {"size": 128, "filesystem": "swap"} ++ ], ++ "packagelist_file": "packages_minimal.json", ++ "additional_packages": ["vim"], ++ "postinstall": [ ++ "#!/bin/sh", ++ "echo \"Hello World\" > /etc/postinstall" ++ ], ++ "public_key": "", ++ "linux_flavor": "linux", ++ "photon_docker_image": "photon:4.0" ++} +diff --git a/sample_ks/sample_ks_ostree_client_from_default.cfg b/sample_ks/sample_ks_ostree_client_from_default.cfg +new file mode 100644 +index 0000000..fa09c6b +--- /dev/null ++++ b/sample_ks/sample_ks_ostree_client_from_default.cfg +@@ -0,0 +1,12 @@ ++{ ++ "hostname": "photon-machine", ++ "password": { ++ "crypted": false, ++ "text": "changeme" ++ }, ++ "disk": "/dev/sda", ++ "ostree": { ++ "default_repo": true ++ }, ++ "photon_docker_image": "photon:4.0" ++} +diff --git a/sample_ks/sample_ks_ostree_client_from_server.cfg b/sample_ks/sample_ks_ostree_client_from_server.cfg +new file mode 100644 +index 0000000..8b61f77 +--- /dev/null ++++ b/sample_ks/sample_ks_ostree_client_from_server.cfg +@@ -0,0 +1,15 @@ ++{ ++ "hostname": "photon-machine", ++ "password": ++ { ++ "crypted": false, ++ "text": "changeme" ++ }, ++ "disk": "/dev/sda", ++ "ostree": { ++ "default_repo": false, ++ "repo_url": "http://127.0.0.0:8000/repo", ++ "repo_ref": "photon/3.0/x86_64/minimal" ++ }, ++ "photon_docker_image": "photon:4.0" ++} +diff --git a/sample_ks/sample_ks_preinstall_postinstall.cfg b/sample_ks/sample_ks_preinstall_postinstall.cfg +new file mode 100644 +index 0000000..faac946 +--- /dev/null ++++ b/sample_ks/sample_ks_preinstall_postinstall.cfg +@@ -0,0 +1,28 @@ ++{ ++ "hostname": "photon-machine", ++ "password": { ++ "crypted": false, ++ "text": "$PASSWD" ++ }, ++ "disk": "$DISK", ++ "packagelist_file": "packages_minimal.json", ++ "additional_packages": [ ++ "vim" ++ ], ++ "preinstall": [ ++ "#!/bin/sh", ++ "ondisk=$(ls -lh /dev/disk/by-path/ | grep 'scsi-0:0:1:0' | cut -d' ' -f 9)", ++ "export DISK=\"/dev/disk/by-path/$ondisk\"", ++ "export KERNEL=\"linux-esx\"", ++ "export PASSWD=\"Ph0t0n0s!\"" ++ ], ++ "postinstall": [ ++ "#!/bin/sh", ++ "echo \"Hello World\" > /etc/postinstall" ++ ], ++ "public_key": "", ++ "linux_flavor": "$KERNEL", ++ "photon_docker_image": "photon:4.0", ++ "photon_release_version": "4.0", ++ "ui": true ++} +diff --git a/sample_ks/sample_ks_preinstallscripts_postinstallscripts.cfg b/sample_ks/sample_ks_preinstallscripts_postinstallscripts.cfg +new file mode 100644 +index 0000000..c21563a +--- /dev/null ++++ b/sample_ks/sample_ks_preinstallscripts_postinstallscripts.cfg +@@ -0,0 +1,25 @@ ++{ ++ "hostname": "photon-machine", ++ "password": { ++ "crypted": false, ++ "text": "changeme" ++ }, ++ "disk": "$DISK", ++ "packagelist_file": "packages_minimal.json", ++ "additional_packages": [ ++ "vim" ++ ], ++ "search_path": [ ++ "/mnt/media" ++ ], ++ "preinstallscripts": [ ++ "pre_test.sh" ++ ], ++ "postinstallscripts": [ ++ "post_test.sh" ++ ], ++ "public_key": "", ++ "linux_flavor": "$KERNEL", ++ "photon_docker_image": "photon:4.0", ++ "ui": true ++} +diff --git a/sample_ks/sample_ui.cfg b/sample_ks/sample_ui.cfg +new file mode 100644 +index 0000000..089ffe7 +--- /dev/null ++++ b/sample_ks/sample_ui.cfg +@@ -0,0 +1,9 @@ ++{ ++ "license_display_title": "Licence Display Title", ++ "eula_file_path": null, ++ "download_screen": { ++ "title": "[!] Download File from URL Page", ++ "intro": "This is a short description on what this window is doing", ++ "destination": "/etc/config/config.file" ++ } ++} +-- +2.23.1 + diff --git a/SPECS/photon-os-installer/0011-ostreeinstaller.py-Use-photon_release_version-from-i.patch b/SPECS/photon-os-installer/0011-ostreeinstaller.py-Use-photon_release_version-from-i.patch new file mode 100644 index 0000000000..8cfabb5d87 --- /dev/null +++ b/SPECS/photon-os-installer/0011-ostreeinstaller.py-Use-photon_release_version-from-i.patch @@ -0,0 +1,35 @@ +From e1acdbabda7575ef151af22fc5981b22301e54d3 Mon Sep 17 00:00:00 2001 +From: Piyush Gupta +Date: Wed, 8 Mar 2023 14:31:32 +0000 +Subject: [PATCH 11/13] ostreeinstaller.py: Use photon_release_version from + installer object as key doesn't exist in 'known_keys'. + +Change-Id: I772a5b774a7a172b529df7bf6e28b303c92166c6 +--- + photon_installer/ostreeinstaller.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/photon_installer/ostreeinstaller.py b/photon_installer/ostreeinstaller.py +index e785b4b..de78d01 100644 +--- a/photon_installer/ostreeinstaller.py ++++ b/photon_installer/ostreeinstaller.py +@@ -20,6 +20,7 @@ class OstreeInstaller(object): + def __init__(self, installer): + self.repo_config = {} + self.installer_path = installer.installer_path ++ self.photon_release_version = installer.photon_release_version + # simulate inheritance + self.install_config = installer.install_config + self.repo_read_conf() +@@ -44,7 +45,7 @@ class OstreeInstaller(object): + with open(conf_path) as repo_conf: + for line in repo_conf: + name, value = line.partition("=")[::2] +- self.repo_config[name] = str(value.strip(' \n\t\r')).format(self.install_config['photon_release_version'], self.install_config['arch']) ++ self.repo_config[name] = str(value.strip(' \n\t\r')).format(self.photon_release_version, self.install_config['arch']) + + def pull_repo(self, repo_url, repo_ref): + self.run([['ostree', 'remote', 'add', '--repo={}/ostree/repo'.format(self.photon_root), '--set=gpg-verify=false', 'photon', '{}' +-- +2.23.1 + diff --git a/SPECS/photon-os-installer/0012-add-network-examples.patch b/SPECS/photon-os-installer/0012-add-network-examples.patch new file mode 100644 index 0000000000..9bc16ddbbc --- /dev/null +++ b/SPECS/photon-os-installer/0012-add-network-examples.patch @@ -0,0 +1,161 @@ +From b4a3de793347aaf8f587db752347eeea019088a7 Mon Sep 17 00:00:00 2001 +From: Oliver Kurth +Date: Wed, 8 Mar 2023 17:12:02 -0800 +Subject: [PATCH 12/13] add network examples + +Change-Id: I91fdfb8d75e5fc82bec80e01585020b020781232 +--- + docs/ks_config.md | 127 ++++++++++++++++++++++++++++++++-------------- + 1 file changed, 90 insertions(+), 37 deletions(-) + +diff --git a/docs/ks_config.md b/docs/ks_config.md +index e6dd010..2096fa0 100644 +--- a/docs/ks_config.md ++++ b/docs/ks_config.md +@@ -364,12 +364,11 @@ Loop device is also supported. + ``` + + ### _"network":_ (optional) +-- Used to configure network in live/installed system. ++Used to configure the network. + +-- Set _"version":_ _"2"_ or the legacy config will be used, see below. ++- The syntax roughly follows the cloud-init or netplan configuration, but not all options are supported. + +-- The syntax roughly follows the cloud-init or netplan configuration, +- but not all options are supported. ++ - _"version":_ Set to "2". If set to "1" the legacy config will be used, see below. + + - _"hostname":_ set the host name. + +@@ -401,40 +400,94 @@ Loop device is also supported. + - _"id"_ : the VLAN id (integer in the range 1..4094) + + - _"link"_ : the id of the ethernet interface to use, from the "ethernets" +- configured. +- +- Example: +- ```json +- { +- "network":{ +- "version": "2", +- "hostname" : "photon-machine", +- "ethernets": { +- "id0": { +- "match": { +- "name" : "eth0" +- }, +- "dhcp4" : false, +- "addresses": ["192.168.2.58/24"], +- "gateway": "192.168.2.254", +- "nameservers": { +- "addresses" : ["8.8.8.8", "8.8.4.4"], +- "search" : ["vmware.com", "eng.vmware.com"] +- } +- } +- }, +- "vlans": { +- "vlan0": { +- "id": 100, +- "link": "id0", +- "addresses":["192.168.100.58/24"] +- } +- } +- } +- } +- ``` ++ configured. Note that the interface needs a "name" (wuthout wildcards) in it's "match". ++ For example `"match":"eth0"` is allowed, but `"match":"e*"` is not, or just a macaddress is not allowed. ++ ++ Example with a static IP address 192.168.2.58 on interface eth0: ++```json ++"network":{ ++ "version": "2", ++ "hostname" : "photon-machine", ++ "ethernets": { ++ "id0": { ++ "match": { ++ "name" : "eth0" ++ }, ++ "dhcp4" : false, ++ "addresses": ["192.168.2.58/24"], ++ "gateway": "192.168.2.254", ++ "nameservers": { ++ "addresses" : ["8.8.8.8", "8.8.4.4"], ++ "search" : ["vmware.com", "eng.vmware.com"] ++ } ++ } ++ } ++} ++``` ++ Example using DHCP on any physical interface with a name starting with "e" (for example "eth0" or "ens33"): ++ ++```json ++"network":{ ++ "version": "2", ++ "hostname" : "photon-machine", ++ "ethernets": { ++ "id0": { ++ "match": { ++ "name" : "e*" ++ }, ++ "dhcp4" : true, ++ }, ++ }, ++} ++``` ++ ++ Example with the first physical interfaces identified by their MAC address, ++ the second by its name ++ and a VLAN interface using the second physical interface: ++ ++```json ++"network":{ ++ "version": "2", ++ "hostname" : "photon-machine", ++ "ethernets": { ++ "id0": { ++ "match": { ++ "macaddress" : "11:22:33:44:55:66" ++ }, ++ "addresses" : ["192.168.2.58/24"], ++ "gateway": "192.168.2.254", ++ "nameservers": { ++ "addresses" : ["8.8.8.8", "8.8.4.4"], ++ "search" : ["vmware.com", "eng.vmware.com"] ++ } ++ }, ++ "id1": { ++ "match": { ++ "name" : "eth1" ++ }, ++ "addresses" : ["192.168.4.58/24"], ++ "nameservers": { ++ "addresses" : ["8.8.8.8", "8.8.4.4"], ++ "search" : ["vmware.com", "eng.vmware.com"] ++ } ++ } ++ }, ++ "vlans": { ++ "vlan0": { ++ "id": 100, ++ "link": "id1", ++ "addresses" : ["192.168.100.58/24"], ++ "gateway": "192.168.100.254", ++ "nameservers": { ++ "addresses" : ["8.8.8.8", "8.8.4.4"], ++ "search" : ["vmware.com", "eng.vmware.com"] ++ } ++ } ++ } ++} ++``` + +- - Legacy network configuration: ++ - Legacy network configuration. The configuration will be interpreted as legacy if either "type" is set or "version" is set to "1". + - _"type"_ (required) + - String: must be one of _dhcp_/_static_/_vlan_. Indicates how the network + is being configured. +-- +2.23.1 + diff --git a/SPECS/photon-os-installer/0013-photon-os-installer-progressbar-Fix-installer-UI.patch b/SPECS/photon-os-installer/0013-photon-os-installer-progressbar-Fix-installer-UI.patch new file mode 100644 index 0000000000..9e5d7ed07a --- /dev/null +++ b/SPECS/photon-os-installer/0013-photon-os-installer-progressbar-Fix-installer-UI.patch @@ -0,0 +1,44 @@ +From 76713b3536a106c7b92338946a51f974919a1c3e Mon Sep 17 00:00:00 2001 +From: Ankit Jain +Date: Tue, 7 Mar 2023 16:24:41 +0000 +Subject: [PATCH 13/13] photon-os-installer: progressbar: Fix installer UI + +commit https://github.com/vmware/photon/commit/b4d48c6729bf15076220871bb63b156661a8fe32 +enabled dracut logs which produces dracut logs longer than +window.width causes issue in progress bar. +- Fixed it by showing truncated messages + because user anyways can't make much sense + from the logs getting displayed on UI + and user can always refer to /var/log/installer.log + for complete logs. + +Change-Id: I8b0f07793ef40625eec108852771a4edbadcf303 +Signed-off-by: Ankit Jain +--- + photon_installer/progressbar.py | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/photon_installer/progressbar.py b/photon_installer/progressbar.py +index 9451f83..1c23ce4 100755 +--- a/photon_installer/progressbar.py ++++ b/photon_installer/progressbar.py +@@ -82,7 +82,15 @@ class ProgressBar(object): + self.render_time() + + def render_message(self): +- text = self.message + (' ' * (self.width - len(self.message))) ++ self.message = self.message.strip() ++ space_required = self.width - len(self.message) ++ if space_required < 0: ++ # truncate the message and display ++ # complete message will be present ++ # inside /var/log/installer.log ++ text = self.message[:self.width] ++ else: ++ text = self.message + (' ' * space_required) + self.window.addstr(2, 0, text) + self.window.refresh() + +-- +2.23.1 + diff --git a/SPECS/photon-os-installer/photon-os-installer.spec b/SPECS/photon-os-installer/photon-os-installer.spec index 1c710abfa0..cbd5ce535d 100644 --- a/SPECS/photon-os-installer/photon-os-installer.spec +++ b/SPECS/photon-os-installer/photon-os-installer.spec @@ -3,7 +3,7 @@ Summary: Photon OS Installer Name: photon-os-installer Version: 2.1 -Release: 2%{?dist} +Release: 3%{?dist} License: Apache 2.0 and GPL 2.0 Group: System Environment/Base Vendor: VMware, Inc. @@ -11,12 +11,19 @@ Distribution: Photon URL: https://github.com/vmware/photon-os-installer Source0: %{name}-%{version}.tar.gz %define sha512 %{name}=16429b9b801b8bc57f6ded0a9bc0f45af49fd5e5449b9f3ab1fc25277c273899e8c45c6bd7774c65db399e9e6665419a77d266dc488d5b89177413a28f66e6f7 -Patch0: 0001-setup.py-Bump-up-version-to-2.1.patch -Patch1: 0002-isoInstaller.py-Raise-exception-in-case-installer-fa.patch -Patch2: 0003-installer.py-Set-default-value-of-live-to-True.patch -Patch3: 0005-generate_initrd.sh-Remove-rpmdb-files-from-the-insta.patch -Patch4: 0006-test.log-Remove-test.log.patch -Patch5: 0007-fix-a-few-network-issues.patch +Patch0: 0001-create-abupdate.conf.patch +Patch1: 0002-installer.py-Set-default-value-of-live-to-True.patch +Patch2: 0003-isoInstaller.py-Raise-exception-in-case-installer-fa.patch +Patch3: 0004-generate_initrd.sh-Remove-rpmdb-files-from-the-insta.patch +Patch4: 0005-test.log-Remove-test.log.patch +Patch5: 0006-fix-a-few-network-issues.patch +Patch6: 0007-m_-postinstall-preinstall-.py-Fix-post-install-arbit.patch +Patch7: 0008-Update-isoInstaller.py.patch +Patch8: 0009-setup.py-Bump-up-version-to-2.1.patch +Patch9: 0010-photon-os-installer-Adding-docs-and-sample_ks-direct.patch +Patch10: 0011-ostreeinstaller.py-Use-photon_release_version-from-i.patch +Patch11: 0012-add-network-examples.patch +Patch12: 0013-photon-os-installer-progressbar-Fix-installer-UI.patch BuildRequires: python3-devel BuildRequires: python3-pyinstaller @@ -60,6 +67,8 @@ rm -rf %{buildroot} %{_bindir}/photon-iso-builder %changelog +* Fri Mar 10 2023 Ankit Jain 2.1-3 +- Sync with upstream * Wed Mar 1 2023 Oliver Kurth 2.1-2 - bug fixes * Mon Feb 20 2023 Piyush Gupta 2.1-1