Exemple #1
0
def perform_installation_steps():
	print()
	print('This is your chosen configuration:')
	archinstall.log("-- Guided template chosen (with below config) --", level=archinstall.LOG_LEVELS.Debug)
	archinstall.log(json.dumps(archinstall.arguments, indent=4, sort_keys=True, cls=archinstall.JSON), level=archinstall.LOG_LEVELS.Info)
	print()

	input('Press Enter to continue.')

	"""
		Issue a final warning before we continue with something un-revertable.
		We mention the drive one last time, and count from 5 to 0.
	"""

	if archinstall.arguments.get('harddrive', None):
		print(f" ! Formatting {archinstall.arguments['harddrive']} in ", end='')
		archinstall.do_countdown()

		"""
			Setup the blockdevice, filesystem (and optionally encryption).
			Once that's done, we'll hand over to perform_installation()
		"""
		with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) as fs:
			# Wipe the entire drive if the disk flag `keep_partitions`is False.
			if archinstall.arguments['harddrive'].keep_partitions is False:
				fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs'))
			
			# Check if encryption is desired and mark the root partition as encrypted.
			if archinstall.arguments.get('!encryption-password', None):
				root_partition = fs.find_partition('/')
				root_partition.encrypted = True
					
			# After the disk is ready, iterate the partitions and check
			# which ones are safe to format, and format those.
			for partition in archinstall.arguments['harddrive']:
				if partition.safe_to_format():
					# Partition might be marked as encrypted due to the filesystem type crypt_LUKS
					# But we might have omitted the encryption password question to skip encryption.
					# In which case partition.encrypted will be true, but passwd will be false.
					if partition.encrypted and (passwd := archinstall.arguments.get('!encryption-password', None)):
						partition.encrypt(password=passwd)
					else:
						partition.format()
				else:
					archinstall.log(f"Did not format {partition} because .safe_to_format() returned False or .allow_formatting was False.", level=archinstall.LOG_LEVELS.Debug)

			fs.find_partition('/boot').format('vfat')

			if archinstall.arguments.get('!encryption-password', None):
				# First encrypt and unlock, then format the desired partition inside the encrypted part.
				# archinstall.luks2() encrypts the partition when entering the with context manager, and
				# unlocks the drive so that it can be used as a normal block-device within archinstall.
				with archinstall.luks2(fs.find_partition('/'), 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_device:
					unlocked_device.format(fs.find_partition('/').filesystem)
					unlocked_device.mount('/mnt')
			else:
				fs.find_partition('/').format(fs.find_partition('/').filesystem)
				fs.find_partition('/').mount('/mnt')

			fs.find_partition('/boot').mount('/mnt/boot')
Exemple #2
0
def perform_filesystem_operations():
    print()
    print('This is your chosen configuration:')
    archinstall.log("-- Guided template chosen (with below config) --",
                    level=logging.DEBUG)

    user_configuration = json.dumps(
        {
            **archinstall.arguments, 'version': archinstall.__version__
        },
        indent=4,
        sort_keys=True,
        cls=archinstall.JSON)
    archinstall.log(user_configuration, level=logging.INFO)

    if archinstall.arguments.get('disk_layouts'):
        user_disk_layout = json.dumps(archinstall.arguments['disk_layouts'],
                                      indent=4,
                                      sort_keys=True,
                                      cls=archinstall.JSON)
        archinstall.log(user_disk_layout, level=logging.INFO)

    print()

    if archinstall.arguments.get('dry_run'):
        exit(0)

    if not archinstall.arguments.get('silent'):
        input('Press Enter to continue.')
    """
		Issue a final warning before we continue with something un-revertable.
		We mention the drive one last time, and count from 5 to 0.
	"""

    if archinstall.arguments.get('harddrives', None):
        print(f" ! Formatting {archinstall.arguments['harddrives']} in ",
              end='')
        archinstall.do_countdown()
        """
			Setup the blockdevice, filesystem (and optionally encryption).
			Once that's done, we'll hand over to perform_installation()
		"""
        mode = archinstall.GPT
        if archinstall.has_uefi() is False:
            mode = archinstall.MBR

        for drive in archinstall.arguments.get('harddrives', []):
            if archinstall.arguments.get('disk_layouts', {}).get(drive.path):
                with archinstall.Filesystem(drive, mode) as fs:
                    fs.load_layout(
                        archinstall.arguments['disk_layouts'][drive.path])
Exemple #3
0
def perform_disk_operations():
	"""
		Issue a final warning before we continue with something un-revertable.
		We mention the drive one last time, and count from 5 to 0.
	"""
	if archinstall.arguments.get('harddrives', None):
		print(f" ! Formatting {archinstall.arguments['harddrives']} in ", end='')
		archinstall.do_countdown()
		"""
			Setup the blockdevice, filesystem (and optionally encryption).
			Once that's done, we'll hand over to perform_installation()
		"""
		mode = archinstall.GPT
		if archinstall.has_uefi() is False:
			mode = archinstall.MBR

		for drive in archinstall.arguments.get('harddrives', []):
			if archinstall.arguments.get('disk_layouts', {}).get(drive.path):
				with archinstall.Filesystem(drive, mode) as fs:
					fs.load_layout(archinstall.arguments['disk_layouts'][drive.path])
Exemple #4
0
            installation.user_create('devel', 'devel')
            installation.user_set_pw('root', 'airoot')

    # Once this is done, we output some useful information to the user
    # And the installation is complete.
    archinstall.log(
        f"There are two new accounts in your installation after reboot:")
    archinstall.log(f" * root (password: airoot)")
    archinstall.log(f" * devel (password: devel)")


if archinstall.arguments['harddrive']:
    archinstall.arguments['harddrive'].keep_partitions = False

    print(f" ! Formatting {archinstall.arguments['harddrive']} in ", end='')
    archinstall.do_countdown()

    # First, we configure the basic filesystem layout
    with archinstall.Filesystem(archinstall.arguments['harddrive'],
                                archinstall.GPT) as fs:
        # We use the entire disk instead of setting up partitions on your own
        if archinstall.arguments['harddrive'].keep_partitions is False:
            fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get(
                'filesystem', 'btrfs'))

        boot = fs.find_partition('/boot')
        root = fs.find_partition('/')

        boot.format('vfat')

        # We encrypt the root partition if we got a password to do so with,