From ebcb5ae7953bb018f485f9b7ba7d181ff998eb45 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 8 Jul 2020 22:22:24 +0000 Subject: Fixed a bug where minimal_installation() didn't return anything. --- archinstall/lib/installer.py | 2 ++ examples/guided.py | 49 ++++++++++++++++++++++++++------------------ setup.py | 2 +- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index a397e1bc..58bd5123 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -85,6 +85,8 @@ class Installer(): mkinit.write('HOOKS=(base udev autodetect modconf block encrypt filesystems keyboard fsck)\n') sys_command(f'/usr/bin/arch-chroot {self.mountpoint} mkinitcpio -p linux') + return True + def add_bootloader(self): log(f'Adding bootloader to {self.boot_partition}') o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} bootctl --no-variables --path=/boot install')) diff --git a/examples/guided.py b/examples/guided.py index e2e45539..16c75c1e 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -13,8 +13,30 @@ while (disk_password := getpass.getpass(prompt='Enter disk encryption password ( continue break +while (root_pw := getpass.getpass(prompt='Enter root password (leave blank for no password): ')): + root_pw_verification = getpass.getpass(prompt='And one more time for verification: ') + if root_pw != root_pw_verification: + archinstall.log(' * Passwords did not match * ', bg='black', fg='red') + continue + break + +users = {} +while 1: + new_user = input('Any additional users to install (leave blank for no users): ') + if not len(new_user.strip()): break + new_user_passwd = getpass.getpass(prompt=f'Password for user {new_user}: ') + new_user_passwd_verify = getpass.getpass(prompt=f'Enter password again for verification: ') + if new_user_passwd != new_user_passwd_verify: + archinstall.log(' * Passwords did not match * ', bg='black', fg='red') + continue + + users[new_user] = new_user_passwd + +aur = input('Would you like AUR support? (leave blank for no): ') +if len(aur.strip()): + archinstall.log(' - AUR support provided by yay (https://aur.archlinux.org/packages/yay/)', bg='black', fg='white') + def perform_installation(device, boot_partition): - hostname = input('Desired hostname for the installation: ') with archinstall.Installer(device, boot_partition=boot_partition, hostname=hostname) as installation: if installation.minimal_installation(): installation.add_bootloader() @@ -27,28 +49,13 @@ def perform_installation(device, boot_partition): if len(profile.strip()): installation.install_profile(profile) - while 1: - new_user = input('Any additional users to install (leave blank for no users): ') - if not len(new_user.strip()): break - new_user_passwd = getpass.getpass(prompt=f'Password for user {new_user}: ') - new_user_passwd_verify = getpass.getpass(prompt=f'Enter password again for verification: ') - if new_user_passwd != new_user_passwd_verify: - archinstall.log(' * Passwords did not match * ', bg='black', fg='red') - continue - - installation.user_create(new_user, new_user_passwd) - - while (root_pw := getpass.getpass(prompt='Enter root password (leave blank for no password): ')): - root_pw_verification = getpass.getpass(prompt='And one more time for verification: ') - if root_pw != root_pw_verification: - archinstall.log(' * Passwords did not match * ', bg='black', fg='red') - continue + for user, password in users.items(): + installation.user_create(user, password) + + if root_pw: installation.user_set_pw('root', root_pw) - break - aur = input('Would you like AUR support? (leave blank for no): ') if len(aur.strip()): - archinstall.log(' - AUR support provided by yay (https://aur.archlinux.org/packages/yay/)', bg='black', fg='white') installation.add_AUR_support() with archinstall.Filesystem(harddrive, archinstall.GPT) as fs: @@ -62,6 +69,8 @@ with archinstall.Filesystem(harddrive, archinstall.GPT) as fs: raise OSError('Trying to encrypt the boot partition for petes sake..') harddrive.partition[0].format('fat32') + hostname = input('Desired hostname for the installation: ') + if disk_password: # First encrypt and unlock, then format the desired partition inside the encrypted part. with archinstall.luks2(harddrive.partition[1], 'luksloop', disk_password) as unlocked_device: diff --git a/setup.py b/setup.py index e6fa4f80..4bec19f3 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open("README.md", "r") as fh: setuptools.setup( name="archinstall", - version="2.0.3rc21", + version="2.0.3rc20", author="Anton Hvornum", author_email="anton@hvornum.se", description="Arch Linux installer - guided, templates etc.", -- cgit v1.2.3-70-g09d2