More manual fixes

This commit is contained in:
Dylan Taylor 2021-05-15 12:07:46 -04:00
parent d93ef24e8e
commit 37e818b3d1
5 changed files with 29 additions and 29 deletions

View File

@ -10,11 +10,12 @@ if archinstall.arguments.get('help'):
# For support reasons, we'll log the disk layout pre installation to match against post-installation layout
archinstall.log(f"Disk states before installing: {archinstall.disk_layouts()}", level=archinstall.LOG_LEVELS.Debug)
def ask_user_questions():
"""
First, we'll ask the user for a bunch of user input.
Not until we're satisfied with what we want to install
will we continue with the actual installation steps.
First, we'll ask the user for a bunch of user input.
Not until we're satisfied with what we want to install
will we continue with the actual installation steps.
"""
if not archinstall.arguments.get('keyboard-language', None):
while True:
@ -41,7 +42,6 @@ def ask_user_questions():
selected_region = archinstall.arguments['mirror-region']
archinstall.arguments['mirror-region'] = {selected_region : archinstall.list_mirrors()[selected_region]}
# Ask which harddrive/block-device we will install to
if archinstall.arguments.get('harddrive', None):
archinstall.arguments['harddrive'] = archinstall.BlockDevice(archinstall.arguments['harddrive'])
@ -67,7 +67,6 @@ def ask_user_questions():
partition_mountpoints[partition] = None
except archinstall.UnknownFilesystemFormat as err:
archinstall.log(f" {partition} (Filesystem not supported)", fg='red')
# We then ask what to do with the partitions.
if (option := archinstall.ask_for_disk_layout()) == 'abort':
@ -122,8 +121,7 @@ def ask_user_questions():
archinstall.log(f"Until then, please enter another supported filesystem.")
continue
except archinstall.SysCallError:
pass # Expected exception since mkfs.<format> can not format /dev/null.
# But that means our .format() function supported it.
pass # Expected exception since mkfs.<format> can not format /dev/null. But that means our .format() function supported it.
break
# When we've selected all three criteria,
@ -151,7 +149,7 @@ def ask_user_questions():
# Get disk encryption password (or skip if blank)
if archinstall.arguments['harddrive'] and archinstall.arguments.get('!encryption-password', None) is None:
if (passwd := archinstall.get_password(prompt='Enter disk encryption password (leave blank for no encryption): ')):
if passwd := archinstall.get_password(prompt='Enter disk encryption password (leave blank for no encryption): '):
archinstall.arguments['!encryption-password'] = passwd
archinstall.arguments['harddrive'].encryption_password = archinstall.arguments['!encryption-password']
archinstall.arguments["bootloader"] = archinstall.ask_for_bootloader()
@ -191,7 +189,7 @@ def ask_user_questions():
# Ask about audio server selection if one is not already set
if not archinstall.arguments.get('audio', None):
# only ask for audio server selection on a desktop profile
# only ask for audio server selection on a desktop profile
if str(archinstall.arguments['profile']) == 'Profile(desktop)':
archinstall.arguments['audio'] = archinstall.ask_for_audio_selection()
else:
@ -264,12 +262,12 @@ def perform_installation_steps():
# 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']:
@ -293,10 +291,10 @@ def perform_installation_steps():
unlocked_device.mount('/mnt')
else:
fs.find_partition('/').mount('/mnt')
if hasUEFI():
fs.find_partition('/boot').mount('/mnt/boot')
perform_installation('/mnt')
@ -307,7 +305,7 @@ def perform_installation(mountpoint):
formatted and setup prior to entering this function.
"""
with archinstall.Installer(mountpoint, kernels=archinstall.arguments.get('kernels', 'linux')) as installation:
## if len(mirrors):
# if len(mirrors):
# Certain services might be running that affects the system during installation.
# Currently, only one such service is "reflector.service" which updates /etc/pacman.d/mirrorlist
# We need to wait for it before we continue since we opted in to use a custom mirror/region.
@ -319,7 +317,7 @@ def perform_installation(mountpoint):
archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium
if installation.minimal_installation():
installation.set_hostname(archinstall.arguments['hostname'])
if archinstall.arguments['mirror-region'].get("mirrors",{})!= None:
if archinstall.arguments['mirror-region'].get("mirrors", {}) is not None:
installation.set_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors in the installation medium
if archinstall.arguments["bootloader"]=="grub-install" and hasUEFI()==True:
installation.add_additional_packages("grub")
@ -339,7 +337,7 @@ def perform_installation(mountpoint):
installation.enable_service('systemd-networkd')
installation.enable_service('systemd-resolved')
if archinstall.arguments.get('audio', None) != None:
if archinstall.arguments.get('audio', None) is not None:
installation.log(f"This audio server will be used: {archinstall.arguments.get('audio', None)}", level=logging.INFO)
if archinstall.arguments.get('audio', None) == 'pipewire':
print('Installing pipewire ...')
@ -350,7 +348,7 @@ def perform_installation(mountpoint):
installation.add_additional_packages("pulseaudio")
else:
installation.log("No audio server will be installed.", level=logging.INFO)
if archinstall.arguments.get('packages', None) and archinstall.arguments.get('packages', None)[0] != '':
installation.add_additional_packages(archinstall.arguments.get('packages', None))
@ -363,7 +361,7 @@ def perform_installation(mountpoint):
for superuser, user_info in archinstall.arguments.get('superusers', {}).items():
installation.user_create(superuser, user_info["!password"], sudo=True)
if (timezone := archinstall.arguments.get('timezone', None)):
if timezone := archinstall.arguments.get('timezone', None):
installation.set_timezone(timezone)
if (root_pw := archinstall.arguments.get('!root-password', None)) and len(root_pw):
@ -390,4 +388,4 @@ def perform_installation(mountpoint):
archinstall.log(f"Disk states after installing: {archinstall.disk_layouts()}", level=archinstall.LOG_LEVELS.Debug)
ask_user_questions()
perform_installation_steps()
perform_installation_steps()

View File

@ -11,8 +11,9 @@ if archinstall.arguments.get('help', None):
archinstall.arguments['harddrive'] = archinstall.select_disk(archinstall.all_disks())
def install_on(mountpoint):
# We kick off the installer by telling it where the
# We kick off the installer by telling it where the
with archinstall.Installer(mountpoint) as installation:
# Strap in the base system, add a boot loader and configure
# some other minor details as specified by this profile and user.
@ -36,9 +37,10 @@ def install_on(mountpoint):
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()
@ -68,4 +70,4 @@ if archinstall.arguments['harddrive']:
boot.mount('/mnt/boot')
install_on('/mnt')
install_on('/mnt')

View File

@ -17,4 +17,4 @@ for name, info in archinstall.list_profiles().items():
profile = archinstall.Profile(None, info['path'])
profile.install()
break
break

View File

@ -1,6 +1,6 @@
import archinstall
import json
import urllib.request
# import json
# import urllib.request
__packages__ = ['nano', 'wget', 'git']
@ -27,7 +27,7 @@ with archinstall.Filesystem(harddrive) as fs:
with archinstall.luks2(harddrive.partition[1], 'luksloop', disk_password) as unlocked_device:
unlocked_device.format('btrfs')
with archinstall.Installer(
unlocked_device,
boot_partition=harddrive.partition[0],

View File

@ -40,14 +40,14 @@ if __name__ == 'awesome':
with open(f"{archinstall.storage['installation_session'].target}/etc/xdg/awesome/rc.lua", 'r') as fh:
awesome_lua = fh.read()
## Replace xterm with alacritty for a smoother experience.
# Replace xterm with alacritty for a smoother experience.
awesome_lua = awesome_lua.replace('"xterm"', '"alacritty"')
with open(f"{archinstall.storage['installation_session'].target}/etc/xdg/awesome/rc.lua", 'w') as fh:
fh.write(awesome_lua)
## TODO: Configure the right-click-menu to contain the above packages that were installed. (as a user config)
# TODO: Configure the right-click-menu to contain the above packages that were installed. (as a user config)
## Remove some interfering nemo settings
# Remove some interfering nemo settings
archinstall.storage['installation_session'].arch_chroot("gsettings set org.nemo.desktop show-desktop-icons false")
archinstall.storage['installation_session'].arch_chroot("xdg-mime default nemo.desktop inode/directory application/x-gnome-saved-search")