Skip to content

Commit

Permalink
fix for unknown EFI partition (Git: #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
hakuna-m committed Apr 8, 2016
1 parent 068bb0f commit 1563e9f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion data/custom-installation/hooks/post-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ -f /custom-installation/patch/loop-remount ]; then
fi

if [ -f /custom-installation/patch/grub-install ] && [ -f /custom-installation/patch/grub-install-efi ] ; then
if [ -d /target/boot/efi ]; then
if [ -d /sys/firmware/efi ]; then
mkdir -p /target/usr/local/sbin
cp /custom-installation/patch/grub-install /target/usr/local/sbin/grub-install
chmod +x /target/usr/local/sbin/grub-install
Expand Down
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
wubi (16.04r304) xenial; urgency=low

[Hakuna Matata]

* Fix EFI error if bcdedit returns unknown device
https://github.com/hakuna-m/wubiuefi/issues/3

wubi (16.04r303) xenial; urgency=low

[Hakuna Matata]
Expand Down
14 changes: 10 additions & 4 deletions src/wubi/backends/win32/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,10 @@ def check_EFI(self):
def modify_EFI_folder(self, associated_task,bcdedit):
command = [bcdedit, '/enum', '{bootmgr}']
boot_drive = run_command(command)
boot_drive = boot_drive[boot_drive.index('partition=')+10:]
if 'partition=' in boot_drive:
boot_drive = boot_drive[boot_drive.index('partition=')+10:]
else:
boot_drive = boot_drive[boot_drive.index('device')+24:]
boot_drive = boot_drive[:boot_drive.index('\r')]
log.debug("EFI boot partition %s" % boot_drive)
# if EFI boot partition is mounted we use it
Expand Down Expand Up @@ -808,9 +811,12 @@ def modify_bcd(self, drive, associated_task):
id = run_command(command)
id = id[id.index('{'):id.index('}')+1]
run_command([bcdedit, '/set', id, 'path', efi_path])
run_command([bcdedit, '/set', '{fwbootmgr}', 'displayorder', id, '/addlast'])
run_command([bcdedit, '/set', '{fwbootmgr}', 'timeout', '10'])
run_command([bcdedit, '/set', '{fwbootmgr}', 'bootsequence', id])
try:
run_command([bcdedit, '/set', '{fwbootmgr}', 'displayorder', id, '/addlast'])
run_command([bcdedit, '/set', '{fwbootmgr}', 'timeout', '10'])
run_command([bcdedit, '/set', '{fwbootmgr}', 'bootsequence', id])
except Exception, err: #this shouldn't be fatal
log.error(err)
registry.set_value(
'HKEY_LOCAL_MACHINE',
self.info.registry_key,
Expand Down

0 comments on commit 1563e9f

Please sign in to comment.