- Added grub2-themes-ostree and grub2-efi-images pkgs
- Little formatting of ostreeinstaller.py
- For ostree ova image, ostree tar file is required
so added in Makefile
- with this change by just adding "ostree" entry
under installer section in config_ova.json,
ostree ova image can be generated
Change-Id: I16a822fed2d14f8d2136c02768ca595d3332074d
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/9985
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>
| ... | ... |
@@ -388,7 +388,7 @@ src-iso: check-tools photon-stage $(PHOTON_PACKAGES) |
| 388 | 388 |
--pkg-to-rpm-map-file $(PHOTON_PKGINFO_FILE) > \ |
| 389 | 389 |
$(PHOTON_LOGS_DIR)/sourceiso-installer.log 2>&1 |
| 390 | 390 |
|
| 391 |
-image: check-kpartx photon-stage $(VIXDISKUTIL) $(PHOTON_PACKAGES) |
|
| 391 |
+image: check-kpartx photon-stage $(VIXDISKUTIL) $(PHOTON_PACKAGES) ostree-repo |
|
| 392 | 392 |
@echo "Building image using $(CONFIG)..." |
| 393 | 393 |
@cd $(PHOTON_IMAGE_BUILDER_DIR) |
| 394 | 394 |
$(PHOTON_IMAGE_BUILDER) \ |
| ... | ... |
@@ -399,7 +399,7 @@ image: check-kpartx photon-stage $(VIXDISKUTIL) $(PHOTON_PACKAGES) |
| 399 | 399 |
--stage-path=$(PHOTON_STAGE) \ |
| 400 | 400 |
--rpm-path $(PHOTON_STAGE)/RPMS |
| 401 | 401 |
|
| 402 |
-all-images: check-kpartx photon-stage $(VIXDISKUTIL) $(PHOTON_PACKAGES) |
|
| 402 |
+all-images: check-kpartx photon-stage $(VIXDISKUTIL) $(PHOTON_PACKAGES) ostree-repo |
|
| 403 | 403 |
@echo "Building all images - gce, ami, azure, ova..." |
| 404 | 404 |
@cd $(PHOTON_IMAGE_BUILDER_DIR) |
| 405 | 405 |
$(PHOTON_IMAGE_BUILDER) \ |
| ... | ... |
@@ -1,19 +1,26 @@ |
| 1 | 1 |
Summary: Photon theme for grub2 |
| 2 | 2 |
Name: grub2-theme |
| 3 | 3 |
Version: 3.2 |
| 4 |
-Release: 2%{?dist}
|
|
| 4 |
+Release: 3%{?dist}
|
|
| 5 | 5 |
License: Apache License |
| 6 | 6 |
Group: System Environment/Base |
| 7 | 7 |
URL: https://vmware.github.io/photon/ |
| 8 | 8 |
Vendor: VMware, Inc. |
| 9 | 9 |
Distribution: Photon |
| 10 |
-Source0: %{name}-%{version}.tar.xz
|
|
| 11 |
-%define sha1 grub2-theme=92a05137036705c5fe872489da407cf94b125cc7 |
|
| 10 |
+Source0: %{name}-%{version}p1.tar.xz
|
|
| 11 |
+%define sha1 grub2-theme=3fee3f9d516958e00fcb2b9ceb957327ede15605 |
|
| 12 | 12 |
BuildArch: noarch |
| 13 | 13 |
|
| 14 | 14 |
%description |
| 15 | 15 |
grub2-theme provides content of /boot/grub2/themes/photon plus ascii font. |
| 16 | 16 |
|
| 17 |
+%package ostree |
|
| 18 |
+Summary: GRUB fonts for Ostree |
|
| 19 |
+Group: System Environment/Base |
|
| 20 |
+Requires: %{name} = %{version}-%{release}
|
|
| 21 |
+%description ostree |
|
| 22 |
+GRUB fonts required by Ostree |
|
| 23 |
+ |
|
| 17 | 24 |
%prep |
| 18 | 25 |
%setup -q |
| 19 | 26 |
|
| ... | ... |
@@ -26,6 +33,9 @@ ln -s grub2 %{buildroot}/boot/grub
|
| 26 | 26 |
# loadfont ascii |
| 27 | 27 |
install -d %{buildroot}/boot/grub2/fonts
|
| 28 | 28 |
cp ascii.pf2 %{buildroot}/boot/grub2/fonts/
|
| 29 |
+# Required for ostree in efi boot |
|
| 30 |
+cp unicode.pf2 %{buildroot}/boot/grub2/fonts/
|
|
| 31 |
+cp unifont.pf2 %{buildroot}/boot/grub2/fonts/
|
|
| 29 | 32 |
|
| 30 | 33 |
%files |
| 31 | 34 |
%defattr(-,root,root,-) |
| ... | ... |
@@ -45,7 +55,14 @@ cp ascii.pf2 %{buildroot}/boot/grub2/fonts/
|
| 45 | 45 |
/boot/grub2/themes/photon/terminal_w.tga |
| 46 | 46 |
/boot/grub2/themes/photon/theme.txt |
| 47 | 47 |
|
| 48 |
+%files ostree |
|
| 49 |
+%defattr(-,root,root,-) |
|
| 50 |
+/boot/grub2/fonts/unicode.pf2 |
|
| 51 |
+/boot/grub2/fonts/unifont.pf2 |
|
| 52 |
+ |
|
| 48 | 53 |
%changelog |
| 54 |
+* Tue May 12 2020 Ankit Jain <ankitja@vmware.com> 3.2-3 |
|
| 55 |
+- Added unicode.pf2 and unifont.pf2 to grub2/fonts folder. |
|
| 49 | 56 |
* Wed Mar 11 2020 Alexey Makhalov <amakhalov@vmware.com> 3.2-2 |
| 50 | 57 |
- Move ascii.pf2 to grub2/fonts folder. |
| 51 | 58 |
* Mon Mar 09 2020 Alexey Makhalov <amakhalov@vmware.com> 3.2-1 |
| ... | ... |
@@ -16,6 +16,7 @@ class OstreeInstaller(object): |
| 16 | 16 |
|
| 17 | 17 |
def __init__(self, installer): |
| 18 | 18 |
self.repo_config = {}
|
| 19 |
+ self.installer_path = installer.installer_path |
|
| 19 | 20 |
self.repo_read_conf() |
| 20 | 21 |
|
| 21 | 22 |
# simulate inheritance |
| ... | ... |
@@ -24,7 +25,6 @@ class OstreeInstaller(object): |
| 24 | 24 |
if self.install_config['ui']: |
| 25 | 25 |
self.progress_bar = installer.progress_bar |
| 26 | 26 |
self.photon_root = installer.photon_root |
| 27 |
- self.installer_path = installer.installer_path |
|
| 28 | 27 |
self._create_fstab = installer._create_fstab |
| 29 | 28 |
self.exit_gracefully = installer.exit_gracefully |
| 30 | 29 |
self._get_uuid = installer._get_uuid |
| ... | ... |
@@ -38,13 +38,15 @@ class OstreeInstaller(object): |
| 38 | 38 |
self.ostree_ref = self.install_config['ostree']['repo_ref'] |
| 39 | 39 |
|
| 40 | 40 |
def repo_read_conf(self): |
| 41 |
- with open("ostree-release-repo.conf") as repo_conf:
|
|
| 41 |
+ conf_path = os.path.abspath(self.installer_path + "/ostree-release-repo.conf") |
|
| 42 |
+ with open(conf_path) as repo_conf: |
|
| 42 | 43 |
for line in repo_conf: |
| 43 | 44 |
name, value = line.partition("=")[::2]
|
| 44 | 45 |
self.repo_config[name] = value.strip(' \n\t\r')
|
| 45 | 46 |
|
| 46 | 47 |
def pull_repo(self, repo_url, repo_ref): |
| 47 |
- self.run([['ostree', 'remote', 'add', '--repo={}/ostree/repo'.format(self.photon_root), '--set=gpg-verify=false', 'photon', '{}'.format(repo_url)]], "Adding OSTree remote")
|
|
| 48 |
+ self.run([['ostree', 'remote', 'add', '--repo={}/ostree/repo'.format(self.photon_root), '--set=gpg-verify=false', 'photon', '{}'
|
|
| 49 |
+ .format(repo_url)]], "Adding OSTree remote") |
|
| 48 | 50 |
if self.default_repo: |
| 49 | 51 |
self.run([['ostree', 'pull-local', '--repo={}/ostree/repo'.format(self.photon_root), '{}'.format(self.local_repo_path)]], "Pulling OSTree repo")
|
| 50 | 52 |
cmd = [] |
| ... | ... |
@@ -72,7 +74,8 @@ class OstreeInstaller(object): |
| 72 | 72 |
"/var/spool/mail"] |
| 73 | 73 |
|
| 74 | 74 |
for prefix in prefixes: |
| 75 |
- command = ['systemd-tmpfiles', '--create', '--boot', '--root={}/ostree/deploy/photon/deploy/{}.0'.format(self.photon_root, commit_number), '--prefix={}'.format(prefix)]
|
|
| 75 |
+ command = ['systemd-tmpfiles', '--create', '--boot', '--root={}/ostree/deploy/photon/deploy/{}.0'
|
|
| 76 |
+ .format(self.photon_root, commit_number), '--prefix={}'.format(prefix)]
|
|
| 76 | 77 |
self.run([command], "systemd-tmpfiles command done") |
| 77 | 78 |
|
| 78 | 79 |
def create_symlink_directory(self, deployment): |
| ... | ... |
@@ -103,20 +106,18 @@ class OstreeInstaller(object): |
| 103 | 103 |
""" |
| 104 | 104 |
Ostree Installer Main |
| 105 | 105 |
""" |
| 106 |
- sysroot_boot = self.photon_root |
|
| 107 |
- sysroot_bootefi = self.photon_root |
|
| 106 |
+ partition_data = {}
|
|
| 108 | 107 |
for partition in self.install_config['partitions']: |
| 109 |
- if partition.get('mountpoint', '') == '/':
|
|
| 110 |
- root_partition = partition |
|
| 111 | 108 |
if partition.get('mountpoint', '') == '/boot':
|
| 112 |
- boot_partition = partition |
|
| 113 |
- sysroot_boot = sysroot_boot + partition['mountpoint'] |
|
| 109 |
+ partition_data['boot'] = self.photon_root + partition['mountpoint'] |
|
| 110 |
+ partition_data['bootdirectory'] = partition['mountpoint'] |
|
| 114 | 111 |
if partition.get('mountpoint', '') == '/boot/efi' and partition['filesystem'] == 'vfat':
|
| 115 |
- sysroot_bootefi = sysroot_bootefi + partition['mountpoint'] |
|
| 112 |
+ partition_data['bootefi'] = self.photon_root + partition['mountpoint'] |
|
| 113 |
+ partition_data['bootefidirectory'] = partition['mountpoint'] |
|
| 116 | 114 |
|
| 117 | 115 |
sysroot_ostree = os.path.join(self.photon_root, "ostree") |
| 118 |
- loader0 = os.path.join(sysroot_boot, "loader.0") |
|
| 119 |
- loader1 = os.path.join(sysroot_boot, "loader.1") |
|
| 116 |
+ loader0 = os.path.join(partition_data['boot'], "loader.0") |
|
| 117 |
+ loader1 = os.path.join(partition_data['boot'], "loader.1") |
|
| 120 | 118 |
|
| 121 | 119 |
boot0 = os.path.join(sysroot_ostree, "boot.0") |
| 122 | 120 |
boot1 = os.path.join(sysroot_ostree, "boot.1") |
| ... | ... |
@@ -127,18 +128,14 @@ class OstreeInstaller(object): |
| 127 | 127 |
self.get_ostree_repo_url() |
| 128 | 128 |
|
| 129 | 129 |
bootmode = self.install_config['bootmode'] |
| 130 |
- if bootmode == 'dualboot' or bootmode == 'efi': |
|
| 131 |
- mount_efi = [] |
|
| 132 |
- mount_efi.append(['mkdir', '-p', '{}/EFI/Boot'.format(sysroot_bootefi)])
|
|
| 133 |
- mount_efi.append(['mkdir', '-p', '{}/boot/grub2/fonts'.format(sysroot_bootefi)])
|
|
| 134 |
- mount_efi.append(['cp', '-r', '{}/boot/.'.format(self.installer_path), '{}/boot/grub2/fonts/'.format(sysroot_bootefi)])
|
|
| 135 |
- self.run(mount_efi, "Mount and setup efi partition") |
|
| 136 |
- |
|
| 137 | 130 |
if self.default_repo: |
| 138 | 131 |
self.run([['mkdir', '-p', '{}/repo'.format(self.photon_root)]])
|
| 139 | 132 |
if self.install_config['ui']: |
| 140 | 133 |
self.progress_bar.show_loading("Unpacking local OSTree repo")
|
| 141 |
- self.run([['tar', '--warning=none', '-xf', '/mnt/media/ostree-repo.tar.gz', '-C' '{}/repo'.format(self.photon_root)]])
|
|
| 134 |
+ ostree_repo_tree = "/mnt/media/ostree-repo.tar.gz" |
|
| 135 |
+ if not os.path.isfile(ostree_repo_tree): |
|
| 136 |
+ ostree_repo_tree = os.path.abspath(os.getcwd() + "/../ostree-repo.tar.gz") |
|
| 137 |
+ self.run([['tar', '--warning=none', '-xf', '{}'.format(ostree_repo_tree), '-C' '{}/repo'.format(self.photon_root)]])
|
|
| 142 | 138 |
self.local_repo_path = "{}/repo".format(self.photon_root)
|
| 143 | 139 |
self.ostree_repo_url = self.repo_config['OSTREEREPOURL'] |
| 144 | 140 |
self.ostree_ref = self.repo_config['OSTREEREFS'] |
| ... | ... |
@@ -154,8 +151,10 @@ class OstreeInstaller(object): |
| 154 | 154 |
deployment = os.path.join(self.photon_root, "ostree/deploy/photon/deploy/" + commit_number + ".0/") |
| 155 | 155 |
self.create_symlink_directory(deployment) |
| 156 | 156 |
|
| 157 |
- deployment_boot = os.path.join(deployment, "boot") |
|
| 158 | 157 |
deployment_sysroot = os.path.join(deployment, "sysroot") |
| 158 |
+ deployment_boot = os.path.join(deployment, "boot") |
|
| 159 |
+ if bootmode == 'dualboot' or bootmode == 'efi': |
|
| 160 |
+ deployment_bootefi = os.path.join(deployment, "boot/efi") |
|
| 159 | 161 |
|
| 160 | 162 |
if os.path.exists(loader1): |
| 161 | 163 |
cmd = [] |
| ... | ... |
@@ -163,20 +162,41 @@ class OstreeInstaller(object): |
| 163 | 163 |
cmd.append(['mv', '{}'.format(boot1), '{}'.format(boot0)])
|
| 164 | 164 |
cmd.append(['mv', '{}'.format(boot11), '{}'.format(boot01)])
|
| 165 | 165 |
self.run(cmd) |
| 166 |
+ |
|
| 166 | 167 |
mount_bind = [] |
| 167 |
- mount_bind.append(['mount', '--bind', '{}'.format(sysroot_boot), '{}'.format(deployment_boot)])
|
|
| 168 | 168 |
mount_bind.append(['mount', '--bind', '{}'.format(self.photon_root), '{}'.format(deployment_sysroot)])
|
| 169 |
+ mount_bind.append(['mount', '--bind', '{}'.format(partition_data['boot']), '{}'.format(deployment_boot)])
|
|
| 170 |
+ if bootmode == 'dualboot' or bootmode == 'efi': |
|
| 171 |
+ mount_bind.append(['mount', '--bind', '{}'.format(partition_data['bootefi']), '{}'.format(deployment_bootefi)])
|
|
| 169 | 172 |
self.run(mount_bind) |
| 173 |
+ |
|
| 170 | 174 |
if bootmode == 'dualboot' or bootmode == 'bios': |
| 171 |
- self.run([['chroot', '{}'.format(deployment), 'bash', '-c', 'grub2-install --target=i386-pc --force --boot-directory=/boot {};'.format(self.install_config['disk'])]], "Generating Grub binaries for BIOS mode")
|
|
| 175 |
+ self.run([['chroot', '{}'.format(deployment), 'bash', '-c', 'grub2-install --target=i386-pc --force --boot-directory={} {};'
|
|
| 176 |
+ .format(partition_data['bootdirectory'], self.install_config['disk'])]], "Generating Grub binaries for BIOS mode") |
|
| 172 | 177 |
if bootmode == 'dualboot' or bootmode == 'efi': |
| 173 |
- self.run([['cp', '-r', '{}/EFI_x86_64/BOOT/.'.format(self.installer_path), '{}/EFI/Boot/'.format(sysroot_bootefi)]], "Generating grub.cfg for efi boot")
|
|
| 174 |
- with open(os.path.join(sysroot_bootefi, 'boot/grub2/grub.cfg'), "w") as grub_cfg: |
|
| 175 |
- grub_cfg.write("search -n -u {} -s\n".format(self._get_uuid(boot_partition['path'])))
|
|
| 176 |
- grub_cfg.write("configfile /grub2/grub.cfg\n")
|
|
| 178 |
+ self.run([['mkdir', '-p', partition_data['bootefi'] + '/boot/grub2']], "Generating grub.cfg for efi boot") |
|
| 179 |
+ with open(os.path.join(partition_data['bootefi'], 'boot/grub2/grub.cfg'), "w") as grub_cfg: |
|
| 180 |
+ grub_cfg.write("search -n -u {} -s\n".format(self._get_uuid(self.install_config['partitions_data']['boot'])))
|
|
| 181 |
+ grub_cfg.write("configfile {}grub2/grub.cfg\n".format(self.install_config['partitions_data']['bootdirectory']))
|
|
| 177 | 182 |
self.run([['chroot', '{}'.format(deployment), 'bash', '-c', 'mkdir -p /boot/grub2;']])
|
| 183 |
+ self.run([['chroot', '{}'.format(deployment), 'bash', '-c', 'grub2-mkconfig -o {}/grub2/grub.cfg;'
|
|
| 184 |
+ .format(partition_data['bootdirectory'])]]) |
|
| 185 |
+ |
|
| 186 |
+ if bootmode == 'dualboot' or bootmode == 'efi': |
|
| 187 |
+ setup_efi = [] |
|
| 188 |
+ setup_efi.append(['chroot', '{}'.format(deployment), 'bash', '-c', 'cp -rpf /usr/lib/ostree-boot/grub2/* {}/boot/grub2/;'
|
|
| 189 |
+ .format(partition_data['bootefidirectory'])]) |
|
| 190 |
+ setup_efi.append(['chroot', '{}'.format(deployment), 'bash', '-c', 'cp -rpf /usr/lib/ostree-boot/efi/* {};'
|
|
| 191 |
+ .format(partition_data['bootefidirectory'])]) |
|
| 192 |
+ self.run(setup_efi, "Setup efi partition") |
|
| 193 |
+ |
|
| 194 |
+ setup_boot = [] |
|
| 195 |
+ setup_boot.append(['chroot', '{}'.format(deployment), 'bash', '-c', 'rm -rf {}/grub2/fonts;'
|
|
| 196 |
+ .format(partition_data['bootdirectory'])]) |
|
| 197 |
+ setup_boot.append(['chroot', '{}'.format(deployment), 'bash', '-c', 'ln -sf /usr/lib/ostree-boot/grub2/* {}/grub2/;'
|
|
| 198 |
+ .format(partition_data['bootdirectory'])]) |
|
| 199 |
+ self.run(setup_boot, "Setup boot partition") |
|
| 178 | 200 |
|
| 179 |
- self.run([['chroot', '{}'.format(deployment), 'bash', '-c', 'grub2-mkconfig -o /boot/grub2/grub.cfg;']])
|
|
| 180 | 201 |
if os.path.exists(loader0): |
| 181 | 202 |
cmd = [] |
| 182 | 203 |
cmd.append(['mv', '{}'.format(loader0), '{}'.format(loader1)])
|
| ... | ... |
@@ -184,11 +204,13 @@ class OstreeInstaller(object): |
| 184 | 184 |
cmd.append(['mv', '{}'.format(boot01), '{}'.format(boot11)])
|
| 185 | 185 |
self.run(cmd) |
| 186 | 186 |
|
| 187 |
- partuuid=self._get_partuuid(root_partition['path']) |
|
| 187 |
+ partuuid=self._get_partuuid(self.install_config['partitions_data']['root']) |
|
| 188 | 188 |
if partuuid == "" : |
| 189 |
- self.run([['chroot', '{}'.format(deployment), 'bash', '-c', "ostree admin instutil set-kargs '$photon_cmdline' '$systemd_cmdline' root={};".format(root_partition['path'])]], "Add ostree menu entry in grub.cfg")
|
|
| 189 |
+ self.run([['chroot', '{}'.format(deployment), 'bash', '-c', "ostree admin instutil set-kargs '$photon_cmdline' '$systemd_cmdline' root={};"
|
|
| 190 |
+ .format(self.install_config['partitions_data']['root'])]], "Add ostree menu entry in grub.cfg") |
|
| 190 | 191 |
else: |
| 191 |
- self.run([['chroot', '{}'.format(deployment), 'bash', '-c', "ostree admin instutil set-kargs '$photon_cmdline' '$systemd_cmdline' root=PARTUUID={};".format(partuuid)]], "Add ostree menu entry in grub.cfg")
|
|
| 192 |
+ self.run([['chroot', '{}'.format(deployment), 'bash', '-c', "ostree admin instutil set-kargs '$photon_cmdline' '$systemd_cmdline' root=PARTUUID={};"
|
|
| 193 |
+ .format(partuuid)]], "Add ostree menu entry in grub.cfg") |
|
| 192 | 194 |
|
| 193 | 195 |
sysroot_grub2_grub_cfg = os.path.join(self.photon_root, "boot/grub2/grub.cfg") |
| 194 | 196 |
self.run([['ln', '-sf', '../loader/grub.cfg', '{}'.format(sysroot_grub2_grub_cfg)]])
|
| ... | ... |
@@ -21,15 +21,11 @@ |
| 21 | 21 |
"pkg-config", "ncurses", "bash", "bzip2", "cracklib", "cracklib-dicts", "shadow", |
| 22 | 22 |
"procps-ng", "iana-etc", "readline", "coreutils", "bc", "libtool", "net-tools", |
| 23 | 23 |
"findutils", "xz", "grub2", "grub2-efi", "iproute2", "util-linux", "linux", |
| 24 |
- "attr", "libcap", "kmod", "expat", "dbus", "file", |
|
| 25 |
- "sed", "grep", "cpio", "gzip", |
|
| 26 |
- "openssl", "ca-certificates", "curl", |
|
| 27 |
- "systemd", |
|
| 28 |
- "openssh", "iptables", |
|
| 29 |
- "photon-release", |
|
| 30 |
- "vim", "photon-repos", |
|
| 31 |
- "docker", "bridge-utils", |
|
| 32 |
- "dracut", "dracut-tools", "rpm-ostree", "nss-altfiles", "which"], |
|
| 33 |
- |
|
| 34 |
- "packages-x86_64": ["grub2-pc"] |
|
| 24 |
+ "attr", "libcap", "kmod", "expat", "dbus", "file", "sed", "grep", "cpio", "gawk", |
|
| 25 |
+ "gzip", "openssl", "ca-certificates", "curl", "systemd", "openssh", "iptables", |
|
| 26 |
+ "photon-release", "vim", "photon-repos", "docker", "bridge-utils", "rpm", |
|
| 27 |
+ "dracut", "dracut-tools", "rpm-ostree", "nss-altfiles", "which", |
|
| 28 |
+ "grub2-theme-ostree"], |
|
| 29 |
+ |
|
| 30 |
+ "packages-x86_64": ["grub2-pc", "grub2-efi-image"] |
|
| 35 | 31 |
} |