예제 #1
0
 def test_avoid_cdrom(self, *args):
     self.devices = [
         ['hd0', 'sda', 'cdrom'],
         ['hd1', 'sdb', 'disk'],
     ]
     self.cdrom_mount = ('/dev/sda', 'vfat')
     self.assertEqual('/dev/sdb', misc.grub_default())
     self.cdrom_mount = ('/dev/disk/by-id/cdrom', 'vfat')
     self.assertEqual('/dev/sdb', misc.grub_default())
예제 #2
0
파일: test_misc.py 프로젝트: swem/ubiquity
 def test_avoid_cdrom(self, *args):
     self.devices = [
         ['hd0', 'sda', 'cdrom'],
         ['hd1', 'sdb', 'disk'],
     ]
     self.cdrom_mount = ('/dev/sda', 'vfat')
     self.assertEqual('/dev/sdb', misc.grub_default())
     self.cdrom_mount = ('/dev/disk/by-id/cdrom', 'vfat')
     self.assertEqual('/dev/sdb', misc.grub_default())
예제 #3
0
    def run(self, priority, question):
        if question == 'grub-installer/bootdev':
            # Force to the default in the case of an unsupported OS.
            if self.db.get(question) == '':
                self.preseed(question, misc.grub_default())

        return FilteredCommand.run(self, priority, question)
예제 #4
0
 def test_use_first_disk(self):
     self.devices = [
         ['hd0', 'sda', 'disk-1'],
         ['hd1', 'sdb', 'disk-2'],
     ]
     self.cdrom_mount = ('/dev/sr0', 'vfat')
     self.assertEqual('/dev/sda', misc.grub_default())
예제 #5
0
파일: test_misc.py 프로젝트: swem/ubiquity
 def test_use_first_disk(self):
     self.devices = [
         ['hd0', 'sda', 'disk-1'],
         ['hd1', 'sdb', 'disk-2'],
     ]
     self.cdrom_mount = ('/dev/sr0', 'vfat')
     self.assertEqual('/dev/sda', misc.grub_default())
예제 #6
0
    def run(self, priority, question):
        if question == 'grub-installer/bootdev':
            # Force to the default in the case of an unsupported OS.
            if self.db.get(question) == '':
                self.preseed(question, misc.grub_default())

        return FilteredCommand.run(self, priority, question)
예제 #7
0
    def prepare(self, unfiltered=False):
        automatic_mode = 'UBIQUITY_AUTOMATIC' in os.environ

        if os.access('/usr/share/grub-installer/grub-installer', os.X_OK):
            bootdevice = self.db.get('grub-installer/bootdev')
            with_other_os = self.db.get('grub-installer/with_other_os')
            only_debian = self.db.get('grub-installer/only_debian')

            # If we're in automatic mode and there's already preseeded data, we
            # want to use it, rather than blindly writing over it.
            if not (automatic_mode and bootdevice != ''):
                bootdev = self.frontend.get_summary_device()
                if bootdev is None or bootdev == '':
                    bootdev = misc.grub_default()
                self.preseed('grub-installer/bootdev', bootdev)
            if not (automatic_mode and with_other_os != ''):
                self.preseed('grub-installer/with_other_os', 'false')
            if not (automatic_mode and only_debian != ''):
                self.preseed('grub-installer/only_debian', 'false')

        install_bootloader_seen = self.db.fget('ubiquity/install_bootloader',
                                               'seen')
        if not (automatic_mode and install_bootloader_seen):
            if self.frontend.oem_user_config:
                self.preseed_bool('ubiquity/install_bootloader', False)
            elif self.frontend.get_grub() is not None:
                self.preseed_bool('ubiquity/install_bootloader',
                                  self.frontend.get_grub())
            else:
                self.preseed_bool('ubiquity/install_bootloader', True)

        popcon = self.frontend.get_popcon()
        if popcon is not None:
            if popcon:
                self.preseed('popularity-contest/participate', 'true')
            else:
                self.preseed('popularity-contest/participate', 'false')

        http_proxy = self.frontend.get_proxy()
        if http_proxy:
            self.preseed('mirror/http/proxy', http_proxy)

        reboot = self.db.get('ubiquity/reboot')
        if reboot == 'true':
            self.frontend.set_reboot(True)
        else:
            self.frontend.set_reboot(False)

        if self.frontend.oem_config:
            self.preseed('oem-config/enable', 'true')

        # for clock-setup
        self.preseed('netcfg/dhcp_ntp_servers', '', seen=False)

        questions = [
            '^.*/apt-install-failed$', 'migration-assistant/failed-unmount',
            'ubiquity/install/copying_error/md5',
            'ubiquity/install/new-bootdev', 'CAPB', 'ERROR', 'PROGRESS'
        ]
        return (['/usr/share/ubiquity/install.py'], questions)
 def test_usb_iso9660(self):
     self.devices = [
         ['hd0', 'sda', 'usb'],
         ['hd1', 'sdb', 'disk'],
         ]
     self.cdrom_mount = ('/dev/sda', 'iso9660')
     self.boot_device = '/dev/sdb'
     self.removable_devices = ['/dev/sda']
     self.assertEqual('/dev/sdb', misc.grub_default())
예제 #9
0
 def test_removable(self):
     self.devices = [['hd0', 'sda', 'serial-number-for-sda']]
     self.cdrom_mount = ('/dev/sr0', 'iso9660')
     self.boot_device = '/dev/sdb'
     self.removable_devices = [self.boot_device]
     self.assertEqual('/dev/sdb', misc.grub_default())
예제 #10
0
파일: test_misc.py 프로젝트: swem/ubiquity
 def test_removable(self):
     self.devices = [['hd0', 'sda', 'serial-number-for-sda']]
     self.cdrom_mount = ('/dev/sr0', 'iso9660')
     self.boot_device = '/dev/sdb'
     self.removable_devices = [self.boot_device]
     self.assertEqual('/dev/sdb', misc.grub_default())
예제 #11
0
파일: install.py 프로젝트: JoliOS/ubiquity
    def prepare(self, unfiltered=False):
        automatic_mode = "UBIQUITY_AUTOMATIC" in os.environ

        if os.access("/usr/share/grub-installer/grub-installer", os.X_OK):
            bootdevice = self.db.get("grub-installer/bootdev")
            with_other_os = self.db.get("grub-installer/with_other_os")
            only_debian = self.db.get("grub-installer/only_debian")

            # If we're in automatic mode and there's already preseeded data, we
            # want to use it, rather than blindly writing over it.
            if not (automatic_mode and bootdevice != ""):
                bootdev = self.frontend.get_summary_device()
                if bootdev is None or bootdev == "":
                    bootdev = misc.grub_default()
                self.preseed("grub-installer/bootdev", bootdev)
            if not (automatic_mode and with_other_os != ""):
                self.preseed("grub-installer/with_other_os", "false")
            if not (automatic_mode and only_debian != ""):
                self.preseed("grub-installer/only_debian", "false")

        install_bootloader_seen = self.db.fget("ubiquity/install_bootloader", "seen")
        if not (automatic_mode and install_bootloader_seen):
            if self.frontend.oem_user_config:
                self.preseed_bool("ubiquity/install_bootloader", False)
            elif self.frontend.get_grub() is not None:
                self.preseed_bool("ubiquity/install_bootloader", self.frontend.get_grub())
            else:
                self.preseed_bool("ubiquity/install_bootloader", True)

        popcon = self.frontend.get_popcon()
        if popcon is not None:
            if popcon:
                self.preseed("popularity-contest/participate", "true")
            else:
                self.preseed("popularity-contest/participate", "false")

        http_proxy = self.frontend.get_proxy()
        if http_proxy:
            self.preseed("mirror/http/proxy", http_proxy)

        reboot = self.db.get("ubiquity/reboot")
        if reboot == "true":
            self.frontend.set_reboot(True)
        else:
            self.frontend.set_reboot(False)

        if self.frontend.oem_config:
            self.preseed("oem-config/enable", "true")

        # for clock-setup
        self.preseed("netcfg/dhcp_ntp_servers", "", seen=False)

        questions = [
            "^.*/apt-install-failed$",
            "migration-assistant/failed-unmount",
            "ubiquity/install/copying_error/md5",
            "ubiquity/install/new-bootdev",
            "CAPB",
            "ERROR",
            "PROGRESS",
        ]
        return (["/usr/share/ubiquity/install.py"], questions)