From 5c7862b07623e85676f4bf6496aaf264d72dd484 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Thu, 5 Oct 2017 14:38:21 +1300 Subject: [PATCH 01/11] do not filter block devices by major instead, filter out devices with devpath /devices/virtual/... --- subiquity/models/filesystem.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/subiquity/models/filesystem.py b/subiquity/models/filesystem.py index 5932c733..e12000a9 100644 --- a/subiquity/models/filesystem.py +++ b/subiquity/models/filesystem.py @@ -318,12 +318,11 @@ class FilesystemModel(object): def probe(self): storage = self.prober.get_storage() - VALID_MAJORS = ['8', '253'] currently_mounted = self._get_system_mounted_disks() for path, data in storage.items(): if path in currently_mounted: continue - if data['DEVTYPE'] == 'disk' and data['MAJOR'] in VALID_MAJORS: + if data['DEVTYPE'] == 'disk' and not data["DEVPATH"].startswith('/devices/virtual'): #log.debug('disk={}\n{}'.format( # path, json.dumps(data, indent=4, sort_keys=True))) info = self.prober.get_storage_info(path) From 5ed612399d8b7f463b546dc32f2eb99713aed669 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Thu, 5 Oct 2017 20:57:37 +1300 Subject: [PATCH 02/11] add a trivial oneshot service we can order the subiquity.service in the install after to ensure the mounts are set up --- bin/started | 2 ++ snapcraft.yaml | 4 ++++ 2 files changed, 6 insertions(+) create mode 100755 bin/started diff --git a/bin/started b/bin/started new file mode 100755 index 00000000..0e930fe7 --- /dev/null +++ b/bin/started @@ -0,0 +1,2 @@ +#!/bin/sh +true \ No newline at end of file diff --git a/snapcraft.yaml b/snapcraft.yaml index d0b48a6f..78b0b74d 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -13,6 +13,9 @@ apps: command: usr/bin/console-conf probert: command: bin/probert + started: + command: usr/bin/started + daemon: oneshot parts: subiquity: @@ -44,6 +47,7 @@ parts: 'bin/subiquity-tui': usr/bin/subiquity 'bin/subiquity-loadkeys': usr/bin/subiquity-loadkeys 'bin/curtin-journald-forwarder': usr/bin/curtin-journald-forwarder + 'bin/started': usr/bin/started prime: - usr/bin probert: From 8ff7624d6988cd137a7813da45553359d9466286 Mon Sep 17 00:00:00 2001 From: Igor Vuk Date: Fri, 6 Oct 2017 10:58:44 +0200 Subject: [PATCH 03/11] Fix a typo in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a81104a..a50d6ea2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ > Ubuntu Server Installer & Snappy first boot experience The repository contains the source for the new server installer (the -"subiquity" part, aka "ubuquity for servers") and for the snappy first +"subiquity" part, aka "ubiquity for servers") and for the snappy first boot experience (the "console-conf" part). We track bugs in Launchpad at From 634d0e8013f71650ebb6a660ebf4216d39eb63e5 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 10 Oct 2017 09:19:08 +1300 Subject: [PATCH 04/11] more careful detection of when we are running in a snap --- subiquity/controllers/installprogress.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subiquity/controllers/installprogress.py b/subiquity/controllers/installprogress.py index 2edadf7c..c3fb0429 100644 --- a/subiquity/controllers/installprogress.py +++ b/subiquity/controllers/installprogress.py @@ -18,6 +18,7 @@ import logging import os import random import subprocess +import sys from systemd import journal @@ -226,7 +227,7 @@ class InstallProgressController(BaseController): def start_journald_forwarder(self): log.debug("starting curtin journald forwarder") - if "SNAP" in os.environ: + if "SNAP" in os.environ and sys.executable.startswith(os.environ["SNAP"]): script = os.path.join(os.environ["SNAP"], 'usr/bin/curtin-journald-forwarder') else: script = './bin/curtin-journald-forwarder' From e3aadb195b3210d20174ecc2486ef06931f65b78 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Wed, 23 Nov 2016 12:08:36 +1300 Subject: [PATCH 05/11] add a way to run console-conf or subiquity with a subset of the screens --- bin/console-conf-tui | 1 + bin/subiquity-tui | 1 + subiquitycore/core.py | 2 ++ subiquitycore/ui/frame.py | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/console-conf-tui b/bin/console-conf-tui index 40d4f2c4..c40d962d 100755 --- a/bin/console-conf-tui +++ b/bin/console-conf-tui @@ -52,6 +52,7 @@ def parse_options(argv): parser.add_argument('--machine-config', metavar='CONFIG', dest='machine_config', help="Don't Probe. Use probe data file") + parser.add_argument('--screens', action='append', dest='screens', default=[]) return parser.parse_args(argv) diff --git a/bin/subiquity-tui b/bin/subiquity-tui index 2e179817..fb8d6b4b 100755 --- a/bin/subiquity-tui +++ b/bin/subiquity-tui @@ -63,6 +63,7 @@ def parse_options(argv): parser.add_argument('--uefi', action='store_true', dest='uefi', help='run in uefi support mode') + parser.add_argument('--screens', action='append', dest='screens', default=[]) return parser.parse_args(argv) diff --git a/subiquitycore/core.py b/subiquitycore/core.py index e5243502..4064bc41 100644 --- a/subiquitycore/core.py +++ b/subiquitycore/core.py @@ -98,6 +98,8 @@ class Application: "loop": None, "pool": futures.ThreadPoolExecutor(1), } + if opts.screens: + self.controllers = [c for c in self.controllers if c in opts.screens] ui.progress_completion = len(self.controllers) self.common['controllers'] = dict.fromkeys(self.controllers) self.controller_index = -1 diff --git a/subiquitycore/ui/frame.py b/subiquitycore/ui/frame.py index 292ec98d..2afb06ef 100644 --- a/subiquitycore/ui/frame.py +++ b/subiquitycore/ui/frame.py @@ -29,7 +29,7 @@ class SubiquityUI(WidgetWrap): def __init__(self): self.header = Header() self.body = Body() - self.footer = Footer("", 0, 0) + self.footer = Footer("", 0, 1) self.frame = Frame(self.body, header=self.header, footer=self.footer) self.progress_current = 0 self.progress_completion = 0 From 16bcd55c3f5be7d2a57baf8ea6f6437c4d7dcb3f Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 10 Oct 2017 09:29:19 +1300 Subject: [PATCH 06/11] fix flag on ESP --- subiquity/controllers/filesystem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subiquity/controllers/filesystem.py b/subiquity/controllers/filesystem.py index 6c571888..d99b9c6d 100644 --- a/subiquity/controllers/filesystem.py +++ b/subiquity/controllers/filesystem.py @@ -193,7 +193,7 @@ class FilesystemController(BaseController): if not system_bootable and len(disk.partitions()) == 0: if self.is_uefi(): log.debug('Adding EFI partition first') - part = self.model.add_partition(disk=disk, partnum=1, size=UEFI_GRUB_SIZE_BYTES, flag='bios_grub') + part = self.model.add_partition(disk=disk, partnum=1, size=UEFI_GRUB_SIZE_BYTES, flag='boot') fs = self.model.add_filesystem(part, 'fat32') self.model.add_mount(fs, '/boot/efi') else: From 6db6cfb4b4d9d2090dbfad778159d51af85be69b Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 10 Oct 2017 09:47:57 +1300 Subject: [PATCH 07/11] adapt bootable() --- subiquity/models/filesystem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subiquity/models/filesystem.py b/subiquity/models/filesystem.py index e12000a9..68c14cbb 100644 --- a/subiquity/models/filesystem.py +++ b/subiquity/models/filesystem.py @@ -387,7 +387,7 @@ class FilesystemModel(object): def bootable(self): ''' true if one disk has a boot partition ''' for p in self._partitions: - if p.flag == 'bios_grub': + if p.flag == 'bios_grub' or p.flag == 'boot': return True return False From 60f69f7c91e43871a8036179dbc1bf055e418465 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 10 Oct 2017 12:55:15 +1300 Subject: [PATCH 08/11] emit mount commands in order of increasing path length --- subiquity/models/filesystem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subiquity/models/filesystem.py b/subiquity/models/filesystem.py index 68c14cbb..01c816f4 100644 --- a/subiquity/models/filesystem.py +++ b/subiquity/models/filesystem.py @@ -294,7 +294,7 @@ class FilesystemModel(object): r.append(asdict(p)) for f in self._filesystems: r.append(asdict(f)) - for m in self._mounts: + for m in sorted(self._mounts, key=lambda m:len(m.path)): r.append(asdict(m)) return r From 0ba2d2bc3e152c2126b92c9354ee651eb680d6db Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 10 Oct 2017 15:38:25 +1300 Subject: [PATCH 09/11] do not allow editing or deleting most aspects of uefi partition --- subiquity/ui/views/filesystem/partition.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/subiquity/ui/views/filesystem/partition.py b/subiquity/ui/views/filesystem/partition.py index b45396c6..571de0f4 100644 --- a/subiquity/ui/views/filesystem/partition.py +++ b/subiquity/ui/views/filesystem/partition.py @@ -20,7 +20,7 @@ configuration. """ import logging -from urwid import connect_signal, Text +from urwid import connect_signal, Text, WidgetDisable from subiquitycore.ui.buttons import delete_btn from subiquitycore.ui.container import ListBox @@ -167,11 +167,16 @@ class PartitionView(PartitionFormatView): label = _("Save") super().__init__(max_size, partition, initial, lambda : self.controller.partition_disk(disk)) self.form.buttons.base_widget[0].set_label(label) + if partition is not None and partition.flag == "boot": + self.form.mount.enabled = False + self.form.fstype.enabled = False def make_body(self): body = super().make_body() if self.partition is not None: btn = delete_btn(on_press=self.delete) + if self.partition.flag == "boot": + btn = WidgetDisable(Color.info_minor(btn.original_widget)) body[-2:-2] = [ Text(""), Padding.fixed_10(btn), From bf85eaf05f2fbdd20015dc3de7045536881eb199 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 10 Oct 2017 21:36:06 +1300 Subject: [PATCH 10/11] do not overwrite the top 8 colors of the palette with black --- subiquity/palette.py | 2 +- subiquitycore/core.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/subiquity/palette.py b/subiquity/palette.py index 90e75be3..092044f5 100644 --- a/subiquity/palette.py +++ b/subiquity/palette.py @@ -47,7 +47,7 @@ URWID_16_NAMES = [ URWID16 = {} URWID256 = {} -PALETTE = bytearray(16*3) +PALETTE = bytearray(8*3) colors = { 0: ("bg", (0x00, 0x00, 0x00)), diff --git a/subiquitycore/core.py b/subiquitycore/core.py index 4064bc41..4735c448 100644 --- a/subiquitycore/core.py +++ b/subiquitycore/core.py @@ -44,7 +44,10 @@ UO_R, UO_G, UO_B = 0xe9, 0x54, 0x20 def setup_ubuntu_orange(pal, additional_opts): """Overwrite color 4 (usually "dark blue") to Ubuntu orange.""" if is_linux_tty(): - fcntl.ioctl(sys.stdout.fileno(), PIO_CMAP, pal) + curpal = bytearray(16*3) + fcntl.ioctl(sys.stdout.fileno(), GIO_CMAP, curpal) + curpal[:8] = pal + fcntl.ioctl(sys.stdout.fileno(), PIO_CMAP, curpal) elif os.environ['TERM'] == 'fbterm': print('\033[3;4;%i;%i;%i}' % (UO_R, UO_G, UO_B), flush=True) else: From a1bcaae05255d2f2f0269bf55e9ec3c3ba04d605 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 10 Oct 2017 23:10:32 +1300 Subject: [PATCH 11/11] filter out floppy and read-only block devices --- subiquity/models/filesystem.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/subiquity/models/filesystem.py b/subiquity/models/filesystem.py index 01c816f4..d6501753 100644 --- a/subiquity/models/filesystem.py +++ b/subiquity/models/filesystem.py @@ -322,7 +322,10 @@ class FilesystemModel(object): for path, data in storage.items(): if path in currently_mounted: continue - if data['DEVTYPE'] == 'disk' and not data["DEVPATH"].startswith('/devices/virtual'): + if data['DEVTYPE'] == 'disk' \ + and not data["DEVPATH"].startswith('/devices/virtual') \ + and data["MAJOR"] != "2" \ + and data['attrs'].get('ro') != "1": #log.debug('disk={}\n{}'.format( # path, json.dumps(data, indent=4, sort_keys=True))) info = self.prober.get_storage_info(path)