[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#863180: live-wrapper: Add keyboard shortcuts and revamp menus



Package: live-wrapper
Version: 0.6
Severity: important
User: debian-accessibility@lists.debian.org
Usertags: a11y

Hello,

As discussed on
https://lists.debian.org/debian-accessibility/2017/04/msg00130.html
it would be useful to have keyboard shortcuts in the live boot menu. The
attached patch implements it in both isolinux and grub. The shortcuts
are marked with '^', so that they can be implemented correctly in
syslinux. The patch also revamps the boot menu so as to integrate the
whole debian installer options (expert, rescue, auto, speech).

Samuel

-- System Information:
Debian Release: 9.0
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'buildd-unstable'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental-debug'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64
 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.11.0 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages live-wrapper depends on:
ii  debian-archive-keyring  2014.3
ii  isolinux                3:6.03+dfsg-14.1
ii  python-apt              1.4.0~beta3
ii  python-cliapp           1.20160724-2
ii  python-distro-info      0.14
ii  python-requests         2.12.4-1
pn  python:any              <none>
ii  vmdebootstrap           1.7-1
ii  xorriso                 1.4.6-1+b1

live-wrapper recommends no packages.

Versions of packages live-wrapper suggests:
pn  cmdtest  <none>

-- no debconf information

-- 
Samuel
<s> T'as pas de portable ?
<m> J'ai un nokia, dans le bassin d'arcachon
diff --git a/lwr/bootloader.py b/lwr/bootloader.py
index 69c27a2..9a0541a 100644
--- a/lwr/bootloader.py
+++ b/lwr/bootloader.py
@@ -25,28 +25,84 @@ class BootloaderConfig(object):
                                  'cmdline': 'boot=live components',
                                  'initrd': '/live/initrd.img-%s' % (version,),
                                 })
+        for version in self.versions:
+            self.entries.append({
+                                 'description': 'Debian GNU/Linux Live with ^Speech (kernel %s)' % (version,),
+                                 'type': 'linux',
+                                 'kernel': '/live/vmlinuz-%s' % (version,),
+                                 'cmdline': 'boot=live components speakup.synth=soft',
+                                 'initrd': '/live/initrd.img-%s' % (version,),
+                                })
 
     def add_installer(self, kernel, ramdisk):  # pylint: disable=no-self-use
-        self.entries.append({
-                             'description': 'Graphical Debian Installer',
+        installcfg = BootloaderConfig(self.cdroot)
+        installcfg.entries.append({
+                             'description': '^Graphical Debian Installer',
                              'type': 'linux',
                              'kernel': '/d-i/gtk/%s' % (os.path.basename(kernel),),
                              'initrd': '/d-i/gtk/%s' % (os.path.basename(ramdisk),),
                              'cmdline': 'append video=vesa:ywrap,mtrr vga=788'
                             })
-        self.entries.append({
-                             'description': 'Debian Installer',
+        installcfg.entries.append({
+                             'description': 'Debian ^Installer',
                              'type': 'linux',
                              'kernel': '/d-i/%s' % (os.path.basename(kernel),),
                              'initrd': '/d-i/%s' % (os.path.basename(ramdisk),),
                             })
-        self.entries.append({
-                             'description': 'Debian Installer with Speech Synthesis',
+        advancedinstallcfg = BootloaderConfig(self.cdroot)
+        advancedinstallcfg.entries.append({
+                             'description': 'E^xpert install',
+                             'type': 'linux',
+                             'kernel': '/d-i/%s' % (os.path.basename(kernel),),
+                             'initrd': '/d-i/%s' % (os.path.basename(ramdisk),),
+                             'cmdline': 'append priority=low'
+                            })
+        advancedinstallcfg.entries.append({
+                             'description': '^Rescue mode',
+                             'type': 'linux',
+                             'kernel': '/d-i/%s' % (os.path.basename(kernel),),
+                             'initrd': '/d-i/%s' % (os.path.basename(ramdisk),),
+                             'cmdline': 'append rescue/enable=true'
+                            })
+        advancedinstallcfg.entries.append({
+                             'description': '^Automated install',
+                             'type': 'linux',
+                             'kernel': '/d-i/%s' % (os.path.basename(kernel),),
+                             'initrd': '/d-i/%s' % (os.path.basename(ramdisk),),
+                             'cmdline': 'append auto=true priority=critical'
+                            })
+        speechadvancedinstallcfg = BootloaderConfig(self.cdroot)
+        speechadvancedinstallcfg.entries.append({
+                             'description': 'E^xpert install',
+                             'type': 'linux',
+                             'kernel': '/d-i/gtk/%s' % (os.path.basename(kernel),),
+                             'initrd': '/d-i/gtk/%s' % (os.path.basename(ramdisk),),
+                             'cmdline': 'append priority=low speakup.synth=soft'
+                            })
+        speechadvancedinstallcfg.entries.append({
+                             'description': '^Rescue mode',
+                             'type': 'linux',
+                             'kernel': '/d-i/gtk/%s' % (os.path.basename(kernel),),
+                             'initrd': '/d-i/gtk/%s' % (os.path.basename(ramdisk),),
+                             'cmdline': 'append rescue/enable=true speakup.synth=soft'
+                            })
+        speechadvancedinstallcfg.entries.append({
+                             'description': '^Automated install',
+                             'type': 'linux',
+                             'kernel': '/d-i/gtk/%s' % (os.path.basename(kernel),),
+                             'initrd': '/d-i/gtk/%s' % (os.path.basename(ramdisk),),
+                             'cmdline': 'append auto=true priority=critical speakup.synth=soft'
+                            })
+        advancedinstallcfg.add_submenu('^Speech-enabled advanced options', speechadvancedinstallcfg)
+        installcfg.add_submenu('^Advanced options', advancedinstallcfg)
+        installcfg.entries.append({
+                             'description': 'Debian Installer with ^Speech Synthesis',
                              'type': 'linux',
                              'kernel': '/d-i/gtk/%s' % (os.path.basename(kernel),),
                              'initrd': '/d-i/gtk/%s' % (os.path.basename(ramdisk),),
                              'cmdline': 'speakup.synth=soft',
                             })
+        self.add_submenu('^Installer', installcfg)
     def add_live_localisation(self):
         # FIXME: need declarative paths
         self.versions = detect_kernels(self.cdroot)
@@ -58,7 +114,7 @@ class BootloaderConfig(object):
             language = line.split(';') 
             for version in self.versions:
                 self.entries.append({
-                                 'description': '%s (%s)' % (language[1], language[0],),
+                                 'description': '^%s (%s)' % (language[1], language[0],),
                                  'type': 'linux',
                                  'kernel': '/live/vmlinuz-%s' % (version,),
                                  'cmdline': 'boot=live components locales=%s' % (language[5],),
diff --git a/lwr/grub.py b/lwr/grub.py
index b755c55..872e480 100644
--- a/lwr/grub.py
+++ b/lwr/grub.py
@@ -19,14 +19,20 @@ def generate_cfg(bootconfig, submenu=False):
     else:
         ret = str()
     for entry in bootconfig.entries:
+        i = str.find(entry['description'], '^')
+        if i >= 0:
+            hotkey = " --hotkey=" + str.lower(entry['description'][i+1])
+            entry['description'] = str.replace(entry['description'], '^', '')
+        else:
+            hotkey = ""
         if entry['type'] == "menu":
             if entry['subentries'].is_empty(["linux", "menu"]):
                 continue
-            ret += "submenu \"%s\" {\n"  % (entry['description'],)
+            ret += "submenu%s \"%s\" {\n"  % (hotkey, entry['description'],)
             ret += generate_cfg(entry['subentries'], submenu=True)
             ret += "}\n"
         if entry['type'] == "linux": 
-            ret += "menuentry \"%s\" {\n" % (entry['description'],)
+            ret += "menuentry%s \"%s\" {\n" % (hotkey, entry['description'],)
             ret += "  linux  %s %s \"${loopback}\"\n" % (entry['kernel'], entry.get('cmdline', ''),)
             if entry.get('initrd') is not None:
                 ret += "  initrd %s\n" % (entry['initrd'],)
diff --git a/lwr/isolinux.py b/lwr/isolinux.py
index 3ef950b..f44d9e2 100644
--- a/lwr/isolinux.py
+++ b/lwr/isolinux.py
@@ -43,9 +43,10 @@ def generate_cfg(bootconfig, submenu=False):
                continue
            ret += "MENU begin advanced\n"
            ret += "MENU title %s\n" % (label,)
+           ret += " MENU LABEL %s\n" % (label,)
            ret += generate_cfg(entry['subentries'], submenu=True) 
            ret += " LABEL mainmenu \n "
-           ret += " MENU label Back\n "
+           ret += " MENU label ^Back\n "
            ret += " MENU exit\n "
            ret += " MENU end\n "
           
@@ -56,6 +57,7 @@ def generate_cfg(bootconfig, submenu=False):
         if entry['type'].startswith('linux') or entry['type'] is 'com32':
             type = 'linux' if entry['type'].startswith('linux') else entry['type']
             ret += "LABEL %s\n" % (label,)
+            ret += "  MENU LABEL %s\n" % (label,)
             ret += "  SAY \"Booting %s...\"\n" % (entry['description'],)
             ret += "  %s %s\n" % (entry['type'], entry['kernel'],)
             if entry.get('initrd') is not None:
diff --git a/lwr/run.py b/lwr/run.py
index c235cf0..9877174 100644
--- a/lwr/run.py
+++ b/lwr/run.py
@@ -257,7 +257,7 @@ class LiveWrapper(cliapp.Application):
             bootconfig.add_live()
             locallivecfg = BootloaderConfig(self.cdroot.path)
             locallivecfg.add_live_localisation()
-            bootconfig.add_submenu('Debian Live with Localisation Support', locallivecfg)
+            bootconfig.add_submenu('Debian Live with ^Localisation Support', locallivecfg)
         if self.settings['installer']:
             bootconfig.add_installer(self.kernel_path, self.ramdisk_path)
 

Reply to: