summaryrefslogtreecommitdiff
path: root/debian/source_shim-signed.py
diff options
context:
space:
mode:
authorSteve Langasek <vorlon@debian.org>2017-04-14 21:44:06 +0000
committerSteve McIntyre <steve@einval.com>2019-03-06 21:15:15 +0000
commitbf3018eb1399f512672127987fbc134e898d3102 (patch)
tree7d6f95ae8a61bb363e67e3001b7f8bfec86dfa60 /debian/source_shim-signed.py
downloadshim-signed-debian/1.28.tar.gz
shim-signed-debian/1.28.zip
Import Debian version 1.28debian/1.28
shim-signed (1.28) unstable; urgency=medium * Initial Debian upload, based on Ubuntu package.
Diffstat (limited to 'debian/source_shim-signed.py')
-rw-r--r--debian/source_shim-signed.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/debian/source_shim-signed.py b/debian/source_shim-signed.py
new file mode 100644
index 0000000..d03504f
--- /dev/null
+++ b/debian/source_shim-signed.py
@@ -0,0 +1,55 @@
+'''apport package hook for shim and shim-signed
+
+(c) 2015 Canonical Ltd.
+Author: Brian Murray <brian@ubuntu.com>
+'''
+
+import errno
+import os
+
+from apport.hookutils import (
+ command_available,
+ command_output,
+ attach_file,
+ attach_root_command_outputs)
+
+efiarch = {'amd64': 'x64',
+ 'i386': 'ia32',
+ 'arm64': 'aarch64'
+ }
+grubarch = {'amd64': 'x86_64',
+ 'i386': 'i386',
+ 'arm64': 'arm64'
+ }
+
+def add_info(report, ui):
+ efiboot = '/boot/efi/EFI/ubuntu'
+ if command_available('efibootmgr'):
+ report['EFIBootMgr'] = command_output(['efibootmgr', '-v'])
+ else:
+ report['EFIBootMgr'] = 'efibootmgr not available'
+ commands = {}
+ try:
+ directory = os.stat(efiboot)
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ report['Missing'] = '/boot/efi/EFI/ubuntu directory is missing'
+ return
+ if e.errno == errno.EACCES:
+ directory= True
+ if directory:
+ arch = report['Architecture']
+ commands['BootEFIContents'] = 'ls %s' % efiboot
+ commands['ShimDiff'] = 'diff %s/shim%s.efi /usr/lib/shim/shim%s.efi.signed' % (efiboot, efiarch[arch], efiarch[arch])
+ commands['GrubDiff'] = 'diff %s/grub%s.efi /usr/lib/grub/%s-efi-signed/grub%s.efi.signed' %(efiboot, efiarch[arch], grubarch[arch], efiarch[arch])
+ attach_root_command_outputs(report, commands)
+
+ efivars_dir = '/sys/firmware/efi/efivars'
+ sb_var = os.path.join(efivars_dir,
+ 'SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c')
+ mok_var = os.path.join(efivars_dir,
+ 'MokSBStateRT-605dab50-e046-4300-abb6-3dd810dd8b23')
+
+ attach_file(report, '/proc/sys/kernel/moksbstate_disabled')
+ attach_file(report, sb_var)
+ attach_file(report, mok_var)