Skip to content

Commit 791c043

Browse files
committed
osinstall: Allow overriding the default icon in OSes
Signed-off-by: Hector Martin <[email protected]>
1 parent 6dcf3cd commit 791c043

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ def do_install(self, total_size=None):
417417
pkg.close()
418418
self.osins.firmware_package = pkg
419419

420-
self.osins.install(self.ins.boot_obj_path)
420+
self.osins.install(self.ins)
421421

422422
for i in self.osins.idata_targets:
423423
self.ins.collect_installer_data(i)

src/osinstall.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,14 @@ def partition_disk(self, prev, total_size=None):
9595

9696
prev = info.name
9797

98-
def install(self, boot_obj_path):
98+
def install(self, stub_ins):
9999
p_progress("Installing OS...")
100100
logging.info("OSInstaller.install()")
101101

102+
icon = self.template.get("icon", None)
103+
if icon:
104+
self.extract_file(icon, stub_ins.icon_path)
105+
102106
for part, info in zip(self.template["partitions"], self.part_info):
103107
logging.info(f"Installing partition {part!r} -> {info.name}")
104108
image = part.get("image", None)
@@ -151,6 +155,6 @@ def install(self, boot_obj_path):
151155
for i in m1n1_vars:
152156
logging.info(f" {i}")
153157

154-
m1n1.build(os.path.join("boot", boot_object), boot_obj_path, m1n1_vars)
158+
m1n1.build(os.path.join("boot", boot_object), stub_ins.boot_obj_path, m1n1_vars)
155159

156-
logging.info(f"Built boot object at {boot_obj_path}")
160+
logging.info(f"Built boot object at {stub_ins.boot_obj_path}")

src/stub.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def get_paths(self):
114114
self.core_services = os.path.join(self.osi.system, "System/Library/CoreServices")
115115
self.sv_path = os.path.join(self.core_services, "SystemVersion.plist")
116116
self.sv_dis_path = os.path.join(self.core_services, "SystemVersion-disabled.plist")
117+
self.icon_path = os.path.join(self.osi.system, ".VolumeIcon.icns")
117118

118119
def check_existing_install(self, osi):
119120
self.osi = osi
@@ -194,7 +195,7 @@ def install_files(self, cur_os):
194195
logging.info("Setting up System volume")
195196

196197
self.extract("usr/standalone/bootcaches.plist", self.osi.system)
197-
shutil.copy("logo.icns", os.path.join(self.osi.system, ".VolumeIcon.icns"))
198+
shutil.copy("logo.icns", self.icon_path)
198199

199200
cs = os.path.join(self.osi.system, "System/Library/CoreServices")
200201
os.makedirs(cs, exist_ok=True)

0 commit comments

Comments
 (0)