Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAggam Rahamim <agamclass@gmail.com>2021-04-25 14:56:03 +0300
committerAggam Rahamim <agamclass@gmail.com>2021-04-25 14:56:03 +0300
commite25018131756757999bbe8ba8e54ec3ae8224c7d (patch)
tree828fb3ad3882d4dfac3e522c52a16369c6042990
parent5c9859d316b8064949370c03745cfd99e0d67670 (diff)
parent4db40c06eb37390eaa19b6d8b0afa7b21c5e65b3 (diff)
Merge branch 'master' of https://github.com/AggamR/archinstall
-rw-r--r--.github/workflows/iso-build.yaml11
-rw-r--r--.github/workflows/python-publish.yml9
-rw-r--r--.gitignore3
-rw-r--r--.pypirc6
-rw-r--r--README.md17
-rw-r--r--archinstall/__init__.py5
-rw-r--r--archinstall/lib/disk.py59
-rw-r--r--archinstall/lib/general.py54
-rw-r--r--archinstall/lib/hardware.py57
-rw-r--r--archinstall/lib/installer.py49
-rw-r--r--archinstall/lib/locale_helpers.py13
-rw-r--r--archinstall/lib/profiles.py46
-rw-r--r--archinstall/lib/user_interaction.py72
-rw-r--r--docs/archinstall/general.rst2
-rw-r--r--examples/guided.py79
-rw-r--r--guided.py359
-rw-r--r--profiles/52-54-00-12-34-56.py2
-rw-r--r--profiles/applications/awesome.py12
-rw-r--r--profiles/applications/cinnamon.py2
-rw-r--r--profiles/applications/deepin.py5
-rw-r--r--profiles/applications/sway.py4
-rw-r--r--profiles/applications/xfce4.py4
-rw-r--r--profiles/deepin.py37
-rw-r--r--profiles/desktop.py2
-rw-r--r--profiles/i3-gaps.py43
-rw-r--r--profiles/i3-wm.py42
-rw-r--r--profiles/xorg.py87
-rw-r--r--pyproject.toml31
28 files changed, 544 insertions, 568 deletions
diff --git a/.github/workflows/iso-build.yaml b/.github/workflows/iso-build.yaml
index 229a37be..d08e68ff 100644
--- a/.github/workflows/iso-build.yaml
+++ b/.github/workflows/iso-build.yaml
@@ -2,7 +2,16 @@
name: Build Arch ISO with ArchInstall Commit
-on: pull_request
+on:
+ pull_request:
+ paths-ignore:
+ - '.github/**'
+ - 'docs/**'
+ - '**.editorconfig'
+ - '**.gitignore'
+ - '**.md'
+ - 'LICENSE'
+ - 'PKGBUILD'
jobs:
build:
diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml
index 09bcba55..c24fc0d7 100644
--- a/.github/workflows/python-publish.yml
+++ b/.github/workflows/python-publish.yml
@@ -21,11 +21,10 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- pip install setuptools wheel twine
+ pip install setuptools wheel flit
- name: Build and publish
env:
- TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
- TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
+ FLIT_USERNAME: ${{ secrets.PYPI_USERNAME }}
+ FLIT_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
- python setup.py sdist bdist_wheel
- twine upload dist/*
+ flit publish
diff --git a/.gitignore b/.gitignore
index 78595b08..a21815d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,4 +21,5 @@ SAFETY_LOCK
**/**.target
**/**.qcow2
**/test.py
-**/archiso \ No newline at end of file
+**/archiso
+/guided.py
diff --git a/.pypirc b/.pypirc
new file mode 100644
index 00000000..7b926de7
--- /dev/null
+++ b/.pypirc
@@ -0,0 +1,6 @@
+[distutils]
+index-servers =
+ pypi
+
+[pypi]
+repository = https://upload.pypi.org/legacy/ \ No newline at end of file
diff --git a/README.md b/README.md
index a48f0a91..7025ae81 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,9 @@
-# <img src="https://github.com/archlinux/archinstall/raw/master/docs/logo.png" alt="drawing" width="200"/>
+<!-- <div align="center"> -->
+<img src="https://github.com/archlinux/archinstall/raw/master/docs/logo.png" alt="drawing" width="200"/>
+
+# Arch Installer
+<!-- </div> -->
+
Just another guided/automated [Arch Linux](https://wiki.archlinux.org/index.php/Arch_Linux) installer with a twist.
The installer also doubles as a python library to install Arch Linux and manage services, packages and other things inside the installed system *(Usually from a live medium)*.
@@ -51,7 +56,7 @@ disk_password = getpass.getpass(prompt='Disk password (won\'t echo): ')
harddrive.keep_partitions = False
# First, we configure the basic filesystem layout
-with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) as fs:
+with archinstall.Filesystem(harddrive, archinstall.GPT) as fs:
# We create a filesystem layout that will use the entire drive
# (this is a helper function, you can partition manually as well)
fs.use_entire_disk(root_filesystem_type='btrfs')
@@ -61,9 +66,9 @@ with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT)
boot.format('vfat')
- # Set the flat for encrypted to allow for encryption and then encrypt
+ # Set the flag for encrypted to allow for encryption and then encrypt
root.encrypted = True
- root.encrypt(password=archinstall.arguments.get('!encryption-password', None))
+ root.encrypt(password=disk_password)
with archinstall.luks2(root, 'luksloop', disk_password) as unlocked_root:
unlocked_root.format(root.filesystem)
@@ -90,10 +95,10 @@ with archinstall.Installer('/mnt') as installation:
This installer will perform the following:
* Prompt the user to select a disk and disk-password
- * Proceed to wipe the selected disk with a `GPT` partition table.
+ * Proceed to wipe the selected disk with a `GPT` partition table on a UEFI system and MBR on a bios system.
* Sets up a default 100% used disk with encryption.
* Installs a basic instance of Arch Linux *(base base-devel linux linux-firmware btrfs-progs efibootmgr)*
- * Installs and configures a bootloader to partition 0.
+ * Installs and configures a bootloader to partition 0 on uefi. on bios it sets the root to partition 0.
* Install additional packages *(nano, wget, git)*
* Installs a profile with a window manager called [awesome](https://github.com/archlinux/archinstall/blob/master/profiles/awesome.py) *(more on profile installations in the [documentation](https://python-archinstall.readthedocs.io/en/latest/archinstall/Profile.html))*.
diff --git a/archinstall/__init__.py b/archinstall/__init__.py
index d98b6daa..bc58af54 100644
--- a/archinstall/__init__.py
+++ b/archinstall/__init__.py
@@ -1,8 +1,9 @@
+"""Arch Linux installer - guided, templates etc."""
from .lib.general import *
from .lib.disk import *
from .lib.user_interaction import *
from .lib.exceptions import *
-from .lib.installer import *
+from .lib.installer import __packages__, __base_packages__, Installer
from .lib.profiles import *
from .lib.luks import *
from .lib.mirrors import *
@@ -14,7 +15,7 @@ from .lib.output import *
from .lib.storage import *
from .lib.hardware import *
-__version__ = "2.1.3"
+__version__ = "2.2.0"
## Basic version of arg.parse() supporting:
## --key=value
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index bada4076..67c2bdcd 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -5,6 +5,7 @@ from .exceptions import DiskError
from .general import *
from .output import log, LOG_LEVELS
from .storage import storage
+from .hardware import hasUEFI
ROOT_DIR_PATTERN = re.compile('^.*?/devices')
GPT = 0b00000001
@@ -73,7 +74,7 @@ class BlockDevice():
raise DiskError(f'Could not locate backplane info for "{self.path}"')
if self.info['type'] == 'loop':
- for drive in json.loads(b''.join(sys_command(f'losetup --json', hide_from_log=True)).decode('UTF_8'))['loopdevices']:
+ for drive in json.loads(b''.join(sys_command(['losetup', '--json'], hide_from_log=True)).decode('UTF_8'))['loopdevices']:
if not drive['name'] == self.path: continue
return drive['back-file']
@@ -94,10 +95,10 @@ class BlockDevice():
@property
def partitions(self):
- o = b''.join(sys_command(f'partprobe {self.path}'))
+ o = b''.join(sys_command(['partprobe', self.path]))
#o = b''.join(sys_command('/usr/bin/lsblk -o name -J -b {dev}'.format(dev=dev)))
- o = b''.join(sys_command(f'/usr/bin/lsblk -J {self.path}'))
+ o = b''.join(sys_command(['/usr/bin/lsblk', '-J', self.path]))
if b'not a block device' in o:
raise DiskError(f'Can not read partitions off something that isn\'t a block device: {self.path}')
@@ -427,7 +428,7 @@ class Filesystem():
# TODO:
# When instance of a HDD is selected, check all usages and gracefully unmount them
# as well as close any crypto handles.
- def __init__(self, blockdevice, mode=GPT):
+ def __init__(self, blockdevice,mode):
self.blockdevice = blockdevice
self.mode = mode
@@ -440,6 +441,11 @@ class Filesystem():
return self
else:
raise DiskError(f'Problem setting the partition format to GPT:', f'/usr/bin/parted -s {self.blockdevice.device} mklabel gpt')
+ elif self.mode == MBR:
+ if sys_command(f'/usr/bin/parted -s {self.blockdevice.device} mklabel msdos').exit_code == 0:
+ return self
+ else:
+ raise DiskError(f'Problem setting the partition format to GPT:', f'/usr/bin/parted -s {self.blockdevice.device} mklabel msdos')
else:
raise DiskError(f'Unknown mode selected to format in: {self.mode}')
@@ -482,28 +488,39 @@ class Filesystem():
def use_entire_disk(self, root_filesystem_type='ext4'):
log(f"Using and formatting the entire {self.blockdevice}.", level=LOG_LEVELS.Debug)
- self.add_partition('primary', start='1MiB', end='513MiB', format='fat32')
- self.set_name(0, 'EFI')
- self.set(0, 'boot on')
- # TODO: Probably redundant because in GPT mode 'esp on' is an alias for "boot on"?
- # https://www.gnu.org/software/parted/manual/html_node/set.html
- self.set(0, 'esp on')
- self.add_partition('primary', start='513MiB', end='100%')
-
- self.blockdevice.partition[0].filesystem = 'vfat'
- self.blockdevice.partition[1].filesystem = root_filesystem_type
- log(f"Set the root partition {self.blockdevice.partition[1]} to use filesystem {root_filesystem_type}.", level=LOG_LEVELS.Debug)
-
- self.blockdevice.partition[0].target_mountpoint = '/boot'
- self.blockdevice.partition[1].target_mountpoint = '/'
-
- self.blockdevice.partition[0].allow_formatting = True
- self.blockdevice.partition[1].allow_formatting = True
+ if hasUEFI():
+ self.add_partition('primary', start='1MiB', end='513MiB', format='fat32')
+ self.set_name(0, 'EFI')
+ self.set(0, 'boot on')
+ # TODO: Probably redundant because in GPT mode 'esp on' is an alias for "boot on"?
+ # https://www.gnu.org/software/parted/manual/html_node/set.html
+ self.set(0, 'esp on')
+ self.add_partition('primary', start='513MiB', end='100%')
+
+ self.blockdevice.partition[0].filesystem = 'vfat'
+ self.blockdevice.partition[1].filesystem = root_filesystem_type
+ log(f"Set the root partition {self.blockdevice.partition[1]} to use filesystem {root_filesystem_type}.", level=LOG_LEVELS.Debug)
+
+ self.blockdevice.partition[0].target_mountpoint = '/boot'
+ self.blockdevice.partition[1].target_mountpoint = '/'
+
+ self.blockdevice.partition[0].allow_formatting = True
+ self.blockdevice.partition[1].allow_formatting = True
+ else:
+ #we don't need a seprate boot partition it would be a waste of space
+ self.add_partition('primary', start='1MB', end='100%')
+ self.blockdevice.partition[0].filesystem=root_filesystem_type
+ log(f"Set the root partition {self.blockdevice.partition[0]} to use filesystem {root_filesystem_type}.", level=LOG_LEVELS.Debug)
+ self.blockdevice.partition[0].target_mountpoint = '/'
+ self.blockdevice.partition[0].allow_formatting = True
def add_partition(self, type, start, end, format=None):
log(f'Adding partition to {self.blockdevice}', level=LOG_LEVELS.Info)
previous_partitions = self.blockdevice.partitions
+ if self.mode == MBR:
+ if len(self.blockdevice.partitions)>3:
+ DiskError("Too many partitions on disk, MBR disks can only have 3 parimary partitions")
if format:
partitioning = self.parted(f'{self.blockdevice.device} mkpart {type} {format} {start} {end}') == 0
else:
diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py
index 6e3b66f1..dc0f018a 100644
--- a/archinstall/lib/general.py
+++ b/archinstall/lib/general.py
@@ -76,7 +76,7 @@ class sys_command():#Thread):
"""
Stolen from archinstall_gui
"""
- def __init__(self, cmd, callback=None, start_callback=None, environment_vars={}, *args, **kwargs):
+ def __init__(self, cmd, callback=None, start_callback=None, peak_output=False, environment_vars={}, *args, **kwargs):
kwargs.setdefault("worker_id", gen_uid())
kwargs.setdefault("emulate", False)
kwargs.setdefault("suppress_errors", False)
@@ -86,13 +86,22 @@ class sys_command():#Thread):
if kwargs['emulate']:
self.log(f"Starting command '{cmd}' in emulation mode.", level=LOG_LEVELS.Debug)
- self.raw_cmd = cmd
- try:
- self.cmd = shlex.split(cmd)
- except Exception as e:
- raise ValueError(f'Incorrect string to split: {cmd}\n{e}')
+ if type(cmd) is list:
+ # if we get a list of arguments
+ self.raw_cmd = shlex.join(cmd)
+ self.cmd = cmd
+ else:
+ # else consider it a single shell string
+ # this should only be used if really necessary
+ self.raw_cmd = cmd
+ try:
+ self.cmd = shlex.split(cmd)
+ except Exception as e:
+ raise ValueError(f'Incorrect string to split: {cmd}\n{e}')
+
self.args = args
self.kwargs = kwargs
+ self.peak_output = peak_output
self.environment_vars = environment_vars
self.kwargs.setdefault("worker", None)
@@ -151,6 +160,38 @@ class sys_command():#Thread):
'exit_code': self.exit_code
}
+ def peak(self, output :str):
+ if type(output) == bytes:
+ try:
+ output = output.decode('UTF-8')
+ except UnicodeDecodeError:
+ return None
+
+ output = output.strip('\r\n ')
+ if len(output) <= 0:
+ return None
+
+ if self.peak_output:
+ from .user_interaction import get_terminal_width
+
+ # Move back to the beginning of the terminal
+ sys.stdout.flush()
+ sys.stdout.write("\033[%dG" % 0)
+ sys.stdout.flush()
+
+ # Clear the line
+ sys.stdout.write(" " * get_terminal_width())
+ sys.stdout.flush()
+
+ # Move back to the beginning again
+ sys.stdout.flush()
+ sys.stdout.write("\033[%dG" % 0)
+ sys.stdout.flush()
+
+ # And print the new output we're peaking on:
+ sys.stdout.write(output)
+ sys.stdout.flush()
+
def run(self):
self.status = 'running'
old_dir = os.getcwd()
@@ -182,6 +223,7 @@ class sys_command():#Thread):
for fileno, event in poller.poll(0.1):
try:
output = os.read(child_fd, 8192)
+ self.peak(output)
self.trace_log += output
except OSError:
alive = False
diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py
index 5828fd09..d6cf982c 100644
--- a/archinstall/lib/hardware.py
+++ b/archinstall/lib/hardware.py
@@ -1,14 +1,42 @@
-import os
+import os, subprocess, json
from .general import sys_command
from .networking import list_interfaces, enrichIfaceTypes
+from typing import Optional
-def hasWifi():
+AVAILABLE_GFX_DRIVERS = {
+ # Sub-dicts are layer-2 options to be selected
+ # and lists are a list of packages to be installed
+ 'AMD / ATI' : {
+ 'amd' : ['xf86-video-amdgpu'],
+ 'ati' : ['xf86-video-ati']
+ },
+ 'intel' : ['xf86-video-intel'],
+ 'nvidia' : {
+ 'open-source' : ['xf86-video-nouveau'],
+ 'proprietary' : ['nvidia']
+ },
+ 'mesa' : ['mesa'],
+ 'fbdev' : ['xf86-video-fbdev'],
+ 'vesa' : ['xf86-video-vesa'],
+ 'vmware' : ['xf86-video-vmware']
+}
+
+def hasWifi()->bool:
return 'WIRELESS' in enrichIfaceTypes(list_interfaces().values()).values()
-def hasUEFI():
+def hasAMDCPU()->bool:
+ if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode():
+ return True
+ return False
+def hasIntelCPU()->bool:
+ if subprocess.check_output("lscpu | grep Intel", shell=True).strip().decode():
+ return True
+ return False
+
+def hasUEFI()->bool:
return os.path.isdir('/sys/firmware/efi')
-def graphicsDevices():
+def graphicsDevices()->dict:
cards = {}
for line in sys_command(f"lspci"):
if b' VGA ' in line:
@@ -16,13 +44,28 @@ def graphicsDevices():
cards[identifier.strip().lower().decode('UTF-8')] = line
return cards
-def hasNvidiaGraphics():
+def hasNvidiaGraphics()->bool:
return any('nvidia' in x for x in graphicsDevices())
-def hasAmdGraphics():
+def hasAmdGraphics()->bool:
return any('amd' in x for x in graphicsDevices())
-def hasIntelGraphics():
+def hasIntelGraphics()->bool:
return any('intel' in x for x in graphicsDevices())
+
+def cpuVendor()-> Optional[str]:
+ cpu_info = json.loads(subprocess.check_output("lscpu -J", shell=True).decode('utf-8'))['lscpu']
+ for info in cpu_info:
+ if info.get('field',None):
+ if info.get('field',None) == "Vendor ID:":
+ return info.get('data',None)
+
+def isVM() -> bool:
+ try:
+ subprocess.check_call(["systemd-detect-virt"]) # systemd-detect-virt issues a none 0 exit code if it is not on a virtual machine
+ return True
+ except:
+ return False
+
# TODO: Add more identifiers
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index d952a6ed..7d3364dd 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -9,6 +9,11 @@ from .mirrors import *
from .systemd import Networkd
from .output import log, LOG_LEVELS
from .storage import storage
+from .hardware import *
+
+# Any package that the Installer() is responsible for (optional and the default ones)
+__packages__ = ["base", "base-devel", "linux", "linux-firmware", "efibootmgr", "nano", "ntp", "iwd"]
+__base_packages__ = __packages__[:6]
class Installer():
"""
@@ -18,7 +23,7 @@ class Installer():
:param partition: Requires a partition as the first argument, this is
so that the installer can mount to `mountpoint` and strap packages there.
:type partition: class:`archinstall.Partition`
-
+
:param boot_partition: There's two reasons for needing a boot partition argument,
The first being so that `mkinitcpio` can place the `vmlinuz` kernel at the right place
during the `pacstrap` or `linux` and the base packages for a minimal installation.
@@ -29,7 +34,7 @@ class Installer():
:param profile: A profile to install, this is optional and can be called later manually.
This just simplifies the process by not having to call :py:func:`~archinstall.Installer.install_profile` later on.
:type profile: str, optional
-
+
:param hostname: The given /etc/hostname for the machine.
:type hostname: str, optional
@@ -142,7 +147,7 @@ class Installer():
if not os.path.isfile(f'{self.target}/etc/fstab'):
raise RequirementError(f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n{fstab}')
-
+
return True
def set_hostname(self, hostname :str, *args, **kwargs):
@@ -224,7 +229,7 @@ class Installer():
# If we haven't installed the base yet (function called pre-maturely)
if self.helper_flags.get('base', False) is False:
self.base_packages.append('iwd')
- # This function will be called after minimal_installation()
+ # This function will be called after minimal_installation()
# as a hook for post-installs. This hook is only needed if
# base is not installed yet.
def post_install_enable_iwd_service(*args, **kwargs):
@@ -274,6 +279,7 @@ class Installer():
## (encrypted partitions default to btrfs for now, so we need btrfs-progs)
## TODO: Perhaps this should be living in the function which dictates
## the partitioning. Leaving here for now.
+
MODULES = []
BINARIES = []
FILES = []
@@ -299,10 +305,20 @@ class Installer():
if 'encrypt' not in HOOKS:
HOOKS.insert(HOOKS.index('filesystems'), 'encrypt')
+ if not(hasUEFI()): # TODO: Allow for grub even on EFI
+ self.base_packages.append('grub')
+
self.pacstrap(self.base_packages)
self.helper_flags['base-strapped'] = True
#self.genfstab()
-
+ if not isVM():
+ vendor = cpuVendor()
+ if vendor == "AuthenticAMD":
+ self.base_packages.append("amd-ucode")
+ elif vendor == "GenuineIntel":
+ self.base_packages.append("intel-ucode")
+ else:
+ self.log("Unknown cpu vendor not installing ucode")
with open(f"{self.target}/etc/fstab", "a") as fstab:
fstab.write(
"\ntmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0\n"
@@ -346,6 +362,8 @@ class Installer():
self.log(f'Adding bootloader {bootloader} to {boot_partition}', level=LOG_LEVELS.Info)
if bootloader == 'systemd-bootctl':
+ if not hasUEFI():
+ raise HardwareIncompatibilityError
# TODO: Ideally we would want to check if another config
# points towards the same disk and/or partition.
# And in which case we should do some clean up.
@@ -373,13 +391,20 @@ class Installer():
## For some reason, blkid and /dev/disk/by-uuid are not getting along well.
## And blkid is wrong in terms of LUKS.
#UUID = sys_command('blkid -s PARTUUID -o value {drive}{partition_2}'.format(**args)).decode('UTF-8').strip()
-
# Setup the loader entry
with open(f'{self.target}/boot/loader/entries/{self.init_time}.conf', 'w') as entry:
entry.write(f'# Created by: archinstall\n')
entry.write(f'# Created on: {self.init_time}\n')
entry.write(f'title Arch Linux\n')
entry.write(f'linux /vmlinuz-linux\n')
+ if not isVM():
+ vendor = cpuVendor()
+ if vendor == "AuthenticAMD":
+ entry.write("initrd /amd-ucode.img\n")
+ elif vendor == "GenuineIntel":
+ entry.write("initrd /intel-ucode.img\n")
+ else:
+ self.log("unknow cpu vendor, not adding ucode to systemd-boot config")
entry.write(f'initrd /initramfs-linux.img\n')
## blkid doesn't trigger on loopback devices really well,
## so we'll use the old manual method until we get that sorted out.
@@ -397,7 +422,17 @@ class Installer():
self.helper_flags['bootloader'] = bootloader
return True
- raise RequirementError(f"Could not identify the UUID of {root_partition}, there for {self.target}/boot/loader/entries/arch.conf will be broken until fixed.")
+ raise RequirementError(f"Could not identify the UUID of {self.partition}, there for {self.target}/boot/loader/entries/arch.conf will be broken until fixed.")
+ elif bootloader == "grub-install":
+ if hasUEFI():
+ o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.target} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB'))
+ sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg')
+ else:
+ root_device = subprocess.check_output(f'basename "$(readlink -f "/sys/class/block/{root_partition.path.strip("/dev/")}/..")', shell=True).decode().strip()
+ if root_device == "block":
+ root_device = f"{root_partition.path}"
+ o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.target} grub-install --target=--target=i386-pc /dev/{root_device}'))
+ sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg')
else:
raise RequirementError(f"Unknown (or not yet implemented) bootloader added to add_bootloader(): {bootloader}")
diff --git a/archinstall/lib/locale_helpers.py b/archinstall/lib/locale_helpers.py
index 82964dc9..736bfc47 100644
--- a/archinstall/lib/locale_helpers.py
+++ b/archinstall/lib/locale_helpers.py
@@ -4,27 +4,22 @@ import os
from .exceptions import *
# from .general import sys_command
-def list_keyboard_languages(layout='qwerty'):
+def list_keyboard_languages():
locale_dir = '/usr/share/kbd/keymaps/'
if not os.path.isdir(locale_dir):
raise RequirementError(f'Directory containing locales does not exist: {locale_dir}')
for root, folders, files in os.walk(locale_dir):
- # Since qwerty is under /i386/ but other layouts are
- # in different spots, we'll need to filter the last foldername
- # of the path to verify against the desired layout.
- if os.path.basename(root) != layout:
- continue
for file in files:
if os.path.splitext(file)[1] == '.gz':
yield file.strip('.gz').strip('.map')
-def search_keyboard_layout(filter, layout='qwerty'):
- for language in list_keyboard_languages(layout):
+def search_keyboard_layout(filter):
+ for language in list_keyboard_languages():
if filter.lower() in language.lower():
yield language
def set_keyboard_language(locale):
- return subprocess.call(['loadkeys',locale]) == 0
+ return subprocess.call(['loadkeys', locale]) == 0
diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py
index 21ec5f6f..c5f63e72 100644
--- a/archinstall/lib/profiles.py
+++ b/archinstall/lib/profiles.py
@@ -177,7 +177,7 @@ class Profile(Script):
if hasattr(imported, '_prep_function'):
return True
return False
- """
+
def has_post_install(self):
with open(self.path, 'r') as source:
source_data = source.read()
@@ -193,7 +193,6 @@ class Profile(Script):
with self.load_instructions(namespace=f"{self.namespace}.py") as imported:
if hasattr(imported, '_post_install'):
return True
- """
def is_top_level_profile(self):
with open(self.path, 'r') as source:
@@ -224,6 +223,49 @@ class Profile(Script):
return None
+ def has_post_install(self):
+ with open(self.path, 'r') as source:
+ source_data = source.read()
+
+ # Some crude safety checks, make sure the imported profile has
+ # a __name__ check and if so, check if it's got a _prep_function()
+ # we can call to ask for more user input.
+ #
+ # If the requirements are met, import with .py in the namespace to not
+ # trigger a traditional:
+ # if __name__ == 'moduleName'
+ if '__name__' in source_data and '_post_install' in source_data:
+ with self.load_instructions(namespace=f"{self.namespace}.py") as imported:
+ if hasattr(imported, '_post_install'):
+ return True
+
+ def is_top_level_profile(self):
+ with open(self.path, 'r') as source:
+ source_data = source.read()
+ return 'top_level_profile = True' in source_data
+
+ @property
+ def packages(self) -> list:
+ """
+ Returns a list of packages baked into the profile definition.
+ If no package definition has been done, .packages() will return None.
+ """
+ with open(self.path, 'r') as source:
+ source_data = source.read()
+
+ # Some crude safety checks, make sure the imported profile has
+ # a __name__ check before importing.
+ #
+ # If the requirements are met, import with .py in the namespace to not
+ # trigger a traditional:
+ # if __name__ == 'moduleName'
+ if '__name__' in source_data and '__packages__' in source_data:
+ with self.load_instructions(namespace=f"{self.namespace}.py") as imported:
+ if hasattr(imported, '__packages__'):
+ return imported.__packages__
+ return None
+
+
class Application(Profile):
def __repr__(self, *args, **kwargs):
return f'Application({os.path.basename(self.profile)})'
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index 3da24684..b93f88b3 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -6,6 +6,8 @@ from .locale_helpers import search_keyboard_layout
from .output import log, LOG_LEVELS
from .storage import storage
from .networking import list_interfaces
+from .general import sys_command
+from .hardware import AVAILABLE_GFX_DRIVERS
## TODO: Some inconsistencies between the selection processes.
## Some return the keys from the options, some the values?
@@ -325,6 +327,8 @@ def select_language(options, show_only_country_codes=True):
:return: The language/dictionary key of the selected language
:rtype: str
"""
+ DEFAULT_KEYBOARD_LANGUAGE = 'us'
+
if show_only_country_codes:
languages = sorted([language for language in list(options) if len(language) == 2])
else:
@@ -334,9 +338,12 @@ def select_language(options, show_only_country_codes=True):
for index, language in enumerate(languages):
print(f"{index}: {language}")
- print(' -- You can enter ? or help to search for more languages --')
+ print(' -- You can enter ? or help to search for more languages, or skip to use US layout --')
selected_language = input('Select one of the above keyboard languages (by number or full name): ')
- if selected_language.lower() in ('?', 'help'):
+
+ if len(selected_language.strip()) == 0:
+ return DEFAULT_KEYBOARD_LANGUAGE
+ elif selected_language.lower() in ('?', 'help'):
while True:
filter_string = input('Search for layout containing (example: "sv-"): ')
new_options = list(search_keyboard_layout(filter_string))
@@ -349,6 +356,7 @@ def select_language(options, show_only_country_codes=True):
elif selected_language.isdigit() and (pos := int(selected_language)) <= len(languages)-1:
selected_language = languages[pos]
+ return selected_language
# I'm leaving "options" on purpose here.
# Since languages possibly contains a filtered version of
# all possible language layouts, and we might want to write
@@ -356,9 +364,9 @@ def select_language(options, show_only_country_codes=True):
# go through the search step.
elif selected_language in options:
selected_language = options[options.index(selected_language)]
+ return selected_language
else:
- RequirementError("Selected language does not exist.")
- return selected_language
+ raise RequirementError("Selected language does not exist.")
raise RequirementError("Selecting languages require a least one language to be given as an option.")
@@ -382,26 +390,64 @@ def select_mirror_regions(mirrors, show_top_mirrors=True):
selected_mirrors = {}
if len(regions) >= 1:
- print_large_list(regions, margin_bottom=2)
+ print_large_list(regions, margin_bottom=4)
print(' -- You can skip this step by leaving the option blank --')
selected_mirror = input('Select one of the above regions to download packages from (by number or full name): ')
if len(selected_mirror.strip()) == 0:
+ # Returning back empty options which can be both used to
+ # do "if x:" logic as well as do `x.get('mirror', {}).get('sub', None)` chaining
return {}
- elif selected_mirror.isdigit() and (pos := int(selected_mirror)) <= len(regions)-1:
+ elif selected_mirror.isdigit() and int(selected_mirror) <= len(regions)-1:
+ # I'm leaving "mirrors" on purpose here.
+ # Since region possibly contains a known region of
+ # all possible regions, and we might want to write
+ # for instance Sweden (if we know that exists) without having to
+ # go through the search step.
region = regions[int(selected_mirror)]
selected_mirrors[region] = mirrors[region]
- # I'm leaving "mirrors" on purpose here.
- # Since region possibly contains a known region of
- # all possible regions, and we might want to write
- # for instance Sweden (if we know that exists) without having to
- # go through the search step.
elif selected_mirror in mirrors:
selected_mirrors[selected_mirror] = mirrors[selected_mirror]
else:
- RequirementError("Selected region does not exist.")
+ raise RequirementError("Selected region does not exist.")
return selected_mirrors
- return None
+ raise RequirementError("Selecting mirror region require a least one region to be given as an option.")
+
+def select_driver(options=AVAILABLE_GFX_DRIVERS):
+ """
+ Some what convoluted function, which's job is simple.
+ Select a graphics driver from a pre-defined set of popular options.
+
+ (The template xorg is for beginner users, not advanced, and should
+ there for appeal to the general public first and edge cases later)
+ """
+ if len(options) >= 1:
+ lspci = sys_command(f'/usr/bin/lspci')
+ for line in lspci.trace_log.split(b'\r\n'):
+ if b' vga ' in line.lower():
+ if b'nvidia' in line.lower():
+ print(' ** nvidia card detected, suggested driver: nvidia **')
+ elif b'amd' in line.lower():
+ print(' ** AMD card detected, suggested driver: AMD / ATI **')
+
+ selected_driver = generic_select(options, input_text="Select your graphics card driver: ", sort=True)
+ initial_option = selected_driver
+
+ if type(options[initial_option]) == dict:
+ driver_options = sorted(options[initial_option].keys())
+
+ selected_driver_package_group = generic_select(driver_options, input_text=f"Which driver-type do you want for {initial_option}: ")
+ if selected_driver_package_group in options[initial_option].keys():
+ print(options[initial_option][selected_driver_package_group])
+ selected_driver = options[initial_option][selected_driver_package_group]
+ else:
+ raise RequirementError(f"Selected driver-type does not exist for {initial_option}.")
+
+ return selected_driver_package_group
+
+ return selected_driver
+
+ raise RequirementError("Selecting drivers require a least one profile to be given as an option.")
diff --git a/docs/archinstall/general.rst b/docs/archinstall/general.rst
index c3913ea9..7319d244 100644
--- a/docs/archinstall/general.rst
+++ b/docs/archinstall/general.rst
@@ -12,7 +12,7 @@ Packages
========
.. autofunction:: archinstall.find_package
-
+Be
.. autofunction:: archinstall.find_packages
Locale related
diff --git a/examples/guided.py b/examples/guided.py
index ee7b63d9..ddc4d06f 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -4,9 +4,9 @@ from archinstall.lib.hardware import hasUEFI
from archinstall.lib.profiles import Profile
from archinstall.lib.user_interaction import generic_select
-if hasUEFI() is False:
- log("ArchInstall currently only supports machines booted with UEFI. MBR & GRUB support is coming in version 2.2.0!", fg="red", level=archinstall.LOG_LEVELS.Error)
- exit(1)
+if archinstall.arguments.get('help'):
+ print("See `man archinstall` for help.")
+ exit(0)
def ask_user_questions():
"""
@@ -15,7 +15,12 @@ def ask_user_questions():
will we continue with the actual installation steps.
"""
if not archinstall.arguments.get('keyboard-language', None):
- archinstall.arguments['keyboard-language'] = archinstall.select_language(archinstall.list_keyboard_languages()).strip()
+ while True:
+ try:
+ archinstall.arguments['keyboard-language'] = archinstall.select_language(archinstall.list_keyboard_languages()).strip()
+ break
+ except archinstall.RequirementError as err:
+ archinstall.log(err, fg="red")
# Before continuing, set the preferred keyboard layout/language in the current terminal.
# This will just help the user with the next following questions.
@@ -24,7 +29,12 @@ def ask_user_questions():
# Set which region to download packages from during the installation
if not archinstall.arguments.get('mirror-region', None):
- archinstall.arguments['mirror-region'] = archinstall.select_mirror_regions(archinstall.list_mirrors())
+ while True:
+ try:
+ archinstall.arguments['mirror-region'] = archinstall.select_mirror_regions(archinstall.list_mirrors())
+ break
+ except archinstall.RequirementError as e:
+ archinstall.log(e, fg="red")
else:
selected_region = archinstall.arguments['mirror-region']
archinstall.arguments['mirror-region'] = {selected_region : archinstall.list_mirrors()[selected_region]}
@@ -190,19 +200,24 @@ def ask_user_questions():
# Additional packages (with some light weight error handling for invalid package names)
- if not archinstall.arguments.get('packages', None):
- print("Packages not part of the desktop environment are not installed by default.")
- print("If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.")
- archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)]
-
- if len(archinstall.arguments['packages']):
- # Verify packages that were given
- try:
- archinstall.log(f"Verifying that additional packages exist (this might take a few seconds)")
- archinstall.validate_package_list(archinstall.arguments['packages'])
- except archinstall.RequirementError as e:
- archinstall.log(e, fg='red')
- exit(1)
+ while True:
+ if not archinstall.arguments.get('packages', None):
+ print("Only packages such as base, base-devel, linux, linux-firmware, efibootmgr and optional profile packages are installed.")
+ print("If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.")
+ archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)]
+
+ if len(archinstall.arguments['packages']):
+ # Verify packages that were given
+ try:
+ archinstall.log(f"Verifying that additional packages exist (this might take a few seconds)")
+ archinstall.validate_package_list(archinstall.arguments['packages'])
+ break
+ except archinstall.RequirementError as e:
+ archinstall.log(e, fg='red')
+ archinstall.arguments['packages'] = None # Clear the packages to trigger a new input question
+ else:
+ # no additional packages were selected, which we'll allow
+ break
# Ask or Call the helper function that asks the user to optionally configure a network.
if not archinstall.arguments.get('nic', None):
@@ -236,7 +251,11 @@ def perform_installation_steps():
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:
+ mode = archinstall.GPT
+ if hasUEFI() is False:
+ mode = archinstall.MBR
+
+ with archinstall.Filesystem(archinstall.arguments['harddrive'], mode) 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'))
@@ -299,11 +318,8 @@ def perform_installation(mountpoint):
if installation.minimal_installation():
installation.set_hostname(archinstall.arguments['hostname'])
-
- # Configure the selected mirrors in the installation
- if archinstall.arguments.get('mirror-region', None):
+ if archinstall.arguments['mirror-region'].get("mirrors",{})!= None:
installation.set_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors in the installation medium
-
installation.set_keyboard_language(archinstall.arguments['keyboard-language'])
installation.add_bootloader()
@@ -320,10 +336,11 @@ 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) != None:
installation.log(f"This audio server will be used: {archinstall.arguments.get('audio', None)}", level=archinstall.LOG_LEVELS.Info)
if archinstall.arguments.get('audio', None) == 'pipewire':
print('Installing pipewire ...')
+
installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"])
elif archinstall.arguments.get('audio', None) == 'pulseaudio':
print('Installing pulseaudio ...')
@@ -339,7 +356,7 @@ def perform_installation(mountpoint):
for user, user_info in archinstall.arguments.get('users', {}).items():
installation.user_create(user, user_info["!password"], sudo=False)
-
+
for superuser, user_info in archinstall.arguments.get('superusers', {}).items():
installation.user_create(superuser, user_info["!password"], sudo=True)
@@ -349,6 +366,15 @@ def perform_installation(mountpoint):
if (root_pw := archinstall.arguments.get('!root-password', None)) and len(root_pw):
installation.user_set_pw('root', root_pw)
+ if archinstall.arguments['profile'] and archinstall.arguments['profile'].has_post_install():
+ with archinstall.arguments['profile'].load_instructions(namespace=f"{archinstall.arguments['profile'].namespace}.py") as imported:
+ if not imported._post_install():
+ archinstall.log(
+ ' * Profile\'s post configuration requirements was not fulfilled.',
+ fg='red'
+ )
+ exit(1)
+
installation.log("For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation", fg="yellow")
choice = input("Would you like to chroot into the newly created installation and perform post-installation configuration? [Y/n] ")
if choice.lower() in ("y", ""):
@@ -358,5 +384,4 @@ def perform_installation(mountpoint):
pass
ask_user_questions()
-perform_installation_steps()
-
+perform_installation_steps() \ No newline at end of file
diff --git a/guided.py b/guided.py
deleted file mode 100644
index a927d86b..00000000
--- a/guided.py
+++ /dev/null
@@ -1,359 +0,0 @@
-import getpass, time, json, os
-import archinstall
-from archinstall.lib.hardware import hasUEFI
-from archinstall.lib.profiles import Profile
-
-if hasUEFI() is False:
- log("ArchInstall currently only supports machines booted with UEFI. MBR & GRUB support is coming in version 2.2.0!", fg="red", level=archinstall.LOG_LEVELS.Error)
- exit(1)
-
-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.
- """
- if not archinstall.arguments.get('keyboard-language', None):
- archinstall.arguments['keyboard-language'] = archinstall.select_language(archinstall.list_keyboard_languages()).strip()
-
- # Before continuing, set the preferred keyboard layout/language in the current terminal.
- # This will just help the user with the next following questions.
- if len(archinstall.arguments['keyboard-language']):
- archinstall.set_keyboard_language(archinstall.arguments['keyboard-language'])
-
- # Set which region to download packages from during the installation
- if not archinstall.arguments.get('mirror-region', None):
- archinstall.arguments['mirror-region'] = archinstall.select_mirror_regions(archinstall.list_mirrors())
- else:
- 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'])
- else:
- archinstall.arguments['harddrive'] = archinstall.select_disk(archinstall.all_disks())
- if archinstall.arguments['harddrive'] is None:
- archinstall.arguments['target-mount'] = '/mnt'
-
- # Perform a quick sanity check on the selected harddrive.
- # 1. Check if it has partitions
- # 3. Check that we support the current partitions
- # 2. If so, ask if we should keep them or wipe everything
- if archinstall.arguments['harddrive'] and archinstall.arguments['harddrive'].has_partitions():
- archinstall.log(f"{archinstall.arguments['harddrive']} contains the following partitions:", fg='yellow')
-
- # We curate a list pf supported partitions
- # and print those that we don't support.
- partition_mountpoints = {}
- for partition in archinstall.arguments['harddrive']:
- try:
- if partition.filesystem_supported():
- archinstall.log(f" {partition}")
- 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':
- archinstall.log(f"Safely aborting the installation. No changes to the disk or system has been made.")
- exit(1)
- elif option == 'keep-existing':
- archinstall.arguments['harddrive'].keep_partitions = True
-
- archinstall.log(f" ** You will now select which partitions to use by selecting mount points (inside the installation). **")
- archinstall.log(f" ** The root would be a simple / and the boot partition /boot (as all paths are relative inside the installation). **")
- while True:
- # Select a partition
- partition = archinstall.generic_select(partition_mountpoints.keys(),
- "Select a partition by number that you want to set a mount-point for (leave blank when done): ")
- if not partition:
- break
-
- # Select a mount-point
- mountpoint = input(f"Enter a mount-point for {partition}: ").strip(' ')
- if len(mountpoint):
-
- # Get a valid & supported filesystem for the partition:
- while 1:
- new_filesystem = input(f"Enter a valid filesystem for {partition} (leave blank for {partition.filesystem}): ").strip(' ')
- if len(new_filesystem) <= 0:
- if partition.encrypted and partition.filesystem == 'crypto_LUKS':
- old_password = archinstall.arguments.get('!encryption-password', None)
- if not old_password:
- old_password = input(f'Enter the old encryption password for {partition}: ')
-
- if (autodetected_filesystem := partition.detect_inner_filesystem(old_password)):
- new_filesystem = autodetected_filesystem
- else:
- archinstall.log(f"Could not auto-detect the filesystem inside the encrypted volume.", fg='red')
- archinstall.log(f"A filesystem must be defined for the unlocked encrypted partition.")
- continue
- break
-
- # Since the potentially new filesystem is new
- # we have to check if we support it. We can do this by formatting /dev/null with the partitions filesystem.
- # There's a nice wrapper for this on the partition object itself that supports a path-override during .format()
- try:
- partition.format(new_filesystem, path='/dev/null', log_formating=False, allow_formatting=True)
- except archinstall.UnknownFilesystemFormat:
- archinstall.log(f"Selected filesystem is not supported yet. If you want archinstall to support '{new_filesystem}', please create a issue-ticket suggesting it on github at https://github.com/archlinux/archinstall/issues.")
- 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.
- break
-
- # When we've selected all three criteria,
- # We can safely mark the partition for formatting and where to mount it.
- # TODO: allow_formatting might be redundant since target_mountpoint should only be
- # set if we actually want to format it anyway.
- partition.allow_formatting = True
- partition.target_mountpoint = mountpoint
- # Only overwrite the filesystem definition if we selected one:
- if len(new_filesystem):
- partition.filesystem = new_filesystem
-
- archinstall.log('Using existing partition table reported above.')
- elif option == 'format-all':
- archinstall.arguments['filesystem'] = archinstall.ask_for_main_filesystem_format()
- archinstall.arguments['harddrive'].keep_partitions = False
- elif archinstall.arguments['harddrive']:
- # If the drive doesn't have any partitions, safely mark the disk with keep_partitions = False
- # and ask the user for a root filesystem.
- archinstall.arguments['filesystem'] = archinstall.ask_for_main_filesystem_format()
- archinstall.arguments['harddrive'].keep_partitions = False
-
- # 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): ')):
- archinstall.arguments['!encryption-password'] = passwd
- archinstall.arguments['harddrive'].encryption_password = archinstall.arguments['!encryption-password']
-
- # Get the hostname for the machine
- if not archinstall.arguments.get('hostname', None):
- archinstall.arguments['hostname'] = input('Desired hostname for the installation: ').strip(' ')
-
- # Ask for a root password (optional, but triggers requirement for super-user if skipped)
- if not archinstall.arguments.get('!root-password', None):
- archinstall.arguments['!root-password'] = archinstall.get_password(prompt='Enter root password (Recommendation: leave blank to leave root disabled): ')
-
- # Ask for additional users (super-user if root pw was not set)
- archinstall.arguments['users'] = {}
- archinstall.arguments['superusers'] = {}
- if not archinstall.arguments.get('!root-password', None):
- archinstall.arguments['superusers'] = archinstall.ask_for_superuser_account('Create a required super-user with sudo privileges: ', forced=True)
-
- users, superusers = archinstall.ask_for_additional_users('Enter a username to create a additional user (leave blank to skip & continue): ')
- archinstall.arguments['users'] = users
- archinstall.arguments['superusers'] = {**archinstall.arguments['superusers'], **superusers}
-
- # Ask for archinstall-specific profiles (such as desktop environments etc)
- if not archinstall.arguments.get('profile', None):
- archinstall.arguments['profile'] = archinstall.select_profile(filter(lambda profile: (Profile(None, profile).is_top_level_profile()), archinstall.list_profiles()))
- else:
- archinstall.arguments['profile'] = archinstall.list_profiles()[archinstall.arguments['profile']]
-
- # Check the potentially selected profiles preparations to get early checks if some additional questions are needed.
- if archinstall.arguments['profile'] and archinstall.arguments['profile'].has_prep_function():
- with archinstall.arguments['profile'].load_instructions(namespace=f"{archinstall.arguments['profile'].namespace}.py") as imported:
- if not imported._prep_function():
- archinstall.log(
- ' * Profile\'s preparation requirements was not fulfilled.',
- fg='red'
- )
- exit(1)
-
- # 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
- if str(archinstall.arguments['profile']) == 'Profile(desktop)':
- archinstall.arguments['audio'] = archinstall.ask_for_audio_selection()
- else:
- # packages installed by a profile may depend on audio and something may get installed anyways, not much we can do about that.
- # we will not try to remove packages post-installation to not have audio, as that may cause multiple issues
- archinstall.arguments['audio'] = None
-
- # Ask what kernel user wants:
- kernel = input("choose a kernel:\n1. linux\n2. linux-lts\n3. linux-zen")
- try:
- archinstall.arguments['kernel'] = ['linux', 'linux-lts', 'linux-zen'][int(kernel) - 1]
- except:
- archinstall.log('invalid kernel selected. defaulting to \'linux\'.')
- archinstall.arguments['kernel'] = 'linux'
-
-
- # Additional packages (with some light weight error handling for invalid package names)
- if not archinstall.arguments.get('packages', None):
- print("Packages not part of the desktop environment are not installed by default.")
- print("If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.")
- archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)]
-
- if len(archinstall.arguments['packages']):
- # Verify packages that were given
- try:
- archinstall.log(f"Verifying that additional packages exist (this might take a few seconds)")
- archinstall.validate_package_list(archinstall.arguments['packages'])
- except archinstall.RequirementError as e:
- archinstall.log(e, fg='red')
- exit(1)
-
- # Ask or Call the helper function that asks the user to optionally configure a network.
- if not archinstall.arguments.get('nic', None):
- archinstall.arguments['nic'] = archinstall.ask_to_configure_network()
- if not archinstall.arguments['nic']:
- archinstall.log(f"No network configuration was selected. Network is going to be unavailable until configured manually!", fg="yellow")
-
- if not archinstall.arguments.get('timezone', None):
- archinstall.arguments['timezone'] = archinstall.ask_for_a_timezone()
-
-
-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')
-
- perform_installation('/mnt')
-
-
-def perform_installation(mountpoint):
- """
- Performs the installation steps on a block device.
- Only requirement is that the block devices are
- formatted and setup prior to entering this function.
- """
- with archinstall.Installer(mountpoint, kernel=archinstall.arguments['kernel']) as installation:
- ## 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.
- installation.log(f'Waiting for automatic mirror selection (reflector) to complete.', level=archinstall.LOG_LEVELS.Info)
- while archinstall.service_state('reflector') not in ('dead', 'failed'):
- time.sleep(1)
-
- # Set mirrors used by pacstrap (outside of installation)
- if archinstall.arguments.get('mirror-region', None):
- archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium
-
- if installation.minimal_installation():
- installation.set_hostname(archinstall.arguments['hostname'])
-
- # Configure the selected mirrors in the installation
- if archinstall.arguments.get('mirror-region', None):
- installation.set_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors in the installation medium
-
- installation.set_keyboard_language(archinstall.arguments['keyboard-language'])
- installation.add_bootloader()
-
- # If user selected to copy the current ISO network configuration
- # Perform a copy of the config
- if archinstall.arguments.get('nic', {}) == 'Copy ISO network configuration to installation':
- installation.copy_ISO_network_config(enable_services=True) # Sources the ISO network configuration to the install medium.
- elif archinstall.arguments.get('nic', {}).get('NetworkManager',False):
- installation.add_additional_packages("networkmanager")
- installation.enable_service('NetworkManager.service')
- # Otherwise, if a interface was selected, configure that interface
- elif archinstall.arguments.get('nic', {}):
- installation.configure_nic(**archinstall.arguments.get('nic', {}))
- installation.enable_service('systemd-networkd')
- installation.enable_service('systemd-resolved')
-
- if archinstall.arguments.get('audio', None) != None:
- installation.log(f"This audio server will be used: {archinstall.arguments.get('audio', None)}", level=archinstall.LOG_LEVELS.Info)
- if archinstall.arguments.get('audio', None) == 'pipewire':
- print('Installing pipewire ...')
- installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"])
- elif archinstall.arguments.get('audio', None) == 'pulseaudio':
- print('Installing pulseaudio ...')
- installation.add_additional_packages("pulseaudio")
- else:
- installation.log("No audio server will be installed.", level=archinstall.LOG_LEVELS.Info)
-
- if archinstall.arguments.get('packages', None) and archinstall.arguments.get('packages', None)[0] != '':
- installation.add_additional_packages(archinstall.arguments.get('packages', None))
-
- if archinstall.arguments.get('profile', None):
- installation.install_profile(archinstall.arguments.get('profile', None))
-
- for user, user_info in archinstall.arguments.get('users', {}).items():
- installation.user_create(user, user_info["!password"], sudo=False)
-
- 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)):
- installation.set_timezone(timezone)
-
- if (root_pw := archinstall.arguments.get('!root-password', None)) and len(root_pw):
- installation.user_set_pw('root', root_pw)
-
- installation.log("For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation", fg="yellow")
- choice = input("Would you like to chroot into the newly created installation and perform post-installation configuration? [Y/n] ")
- if choice.lower() in ("y", ""):
- try:
- installation.drop_to_shell()
- except:
- pass
-
-ask_user_questions()
-perform_installation_steps()
-
diff --git a/profiles/52-54-00-12-34-56.py b/profiles/52-54-00-12-34-56.py
index 679c6721..ed2c9d78 100644
--- a/profiles/52-54-00-12-34-56.py
+++ b/profiles/52-54-00-12-34-56.py
@@ -11,7 +11,7 @@ archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop', suppress_error
harddrive = archinstall.all_disks()['/dev/sda']
disk_password = '1234'
-with archinstall.Filesystem(harddrive, archinstall.GPT) as fs:
+with archinstall.Filesystem(harddrive) as fs:
# Use the entire disk instead of setting up partitions on your own
fs.use_entire_disk('luks2')
diff --git a/profiles/applications/awesome.py b/profiles/applications/awesome.py
index 578f246e..a63c707b 100644
--- a/profiles/applications/awesome.py
+++ b/profiles/applications/awesome.py
@@ -1,12 +1,12 @@
import archinstall
+__packages__ = ["awesome", "xorg-xrandr", "xterm", "feh", "slock", "terminus-font", "gnu-free-fonts", "ttf-liberation", "xsel"]
+
installation.install_profile('xorg')
-installation.add_additional_packages(
- "awesome xorg-xrandr xterm feh slock terminus-font gnu-free-fonts ttf-liberation xsel"
-)
+installation.add_additional_packages(__packages__)
-with open(f'{installation.mountpoint}/etc/X11/xinit/xinitrc', 'r') as xinitrc:
+with open(f'{installation.target}/etc/X11/xinit/xinitrc', 'r') as xinitrc:
xinitrc_data = xinitrc.read()
for line in xinitrc_data.split('\n'):
@@ -20,5 +20,5 @@ for line in xinitrc_data.split('\n'):
xinitrc_data += '\n'
xinitrc_data += 'exec awesome\n'
-with open(f'{installation.mountpoint}/etc/X11/xinit/xinitrc', 'w') as xinitrc:
- xinitrc.write(xinitrc_data) \ No newline at end of file
+with open(f'{installation.target}/etc/X11/xinit/xinitrc', 'w') as xinitrc:
+ xinitrc.write(xinitrc_data)
diff --git a/profiles/applications/cinnamon.py b/profiles/applications/cinnamon.py
index de29aa09..0a1d9cc2 100644
--- a/profiles/applications/cinnamon.py
+++ b/profiles/applications/cinnamon.py
@@ -1,3 +1,3 @@
import archinstall
-installation.add_additional_packages("cinnamon system-config-printer gnome-keyring gnome-terminal blueberry metacity lightdm lightdm-gtk-greeter") \ No newline at end of file
+installation.add_additional_packages("cinnamon system-config-printer gnome-keyring gnome-terminal blueberry metacity lightdm lightdm-gtk-greeter")
diff --git a/profiles/applications/deepin.py b/profiles/applications/deepin.py
new file mode 100644
index 00000000..0db1572d
--- /dev/null
+++ b/profiles/applications/deepin.py
@@ -0,0 +1,5 @@
+import archinstall
+
+packages = "deepin deepin-terminal deepin-editor"
+
+installation.add_additional_packages(packages)
diff --git a/profiles/applications/sway.py b/profiles/applications/sway.py
index 56d7f318..59921aa0 100644
--- a/profiles/applications/sway.py
+++ b/profiles/applications/sway.py
@@ -1,3 +1,3 @@
import archinstall
-packages = "sway swaylock swayidle waybar dmenu light grim slurp pavucontrol alacritty"
-installation.add_additional_packages(packages)
+__packages__ = "sway swaylock swayidle waybar dmenu light grim slurp pavucontrol alacritty"
+installation.add_additional_packages(__packages__)
diff --git a/profiles/applications/xfce4.py b/profiles/applications/xfce4.py
index e8f659c2..9f4260da 100644
--- a/profiles/applications/xfce4.py
+++ b/profiles/applications/xfce4.py
@@ -1,3 +1,3 @@
import archinstall
-
-installation.add_additional_packages("xfce4 xfce4-goodies lightdm lightdm-gtk-greeter") \ No newline at end of file
+__packages__ = "xfce4 xfce4-goodies lightdm lightdm-gtk-greeter"
+installation.add_additional_packages(__packages__) \ No newline at end of file
diff --git a/profiles/deepin.py b/profiles/deepin.py
new file mode 100644
index 00000000..52bcdde5
--- /dev/null
+++ b/profiles/deepin.py
@@ -0,0 +1,37 @@
+# A desktop environment using "Deepin".
+
+import archinstall, os
+
+is_top_level_profile = False
+
+
+def _prep_function(*args, **kwargs):
+ """
+ Magic function called by the importing installer
+ before continuing any further. It also avoids executing any
+ other code in this stage. So it's a safe way to ask the user
+ for more input before any other installer steps start.
+ """
+
+ # Deepin requires a functioning Xorg installation.
+ profile = archinstall.Profile(None, 'xorg')
+ with profile.load_instructions(namespace='xorg.py') as imported:
+ if hasattr(imported, '_prep_function'):
+ return imported._prep_function()
+ else:
+ print('Deprecated (??): xorg profile has no _prep_function() anymore')
+
+
+# Ensures that this code only gets executed if executed
+# through importlib.util.spec_from_file_location("deepin", "/somewhere/deepin.py")
+# or through conventional import deepin
+if __name__ == 'deepin':
+ # Install dependency profiles
+ installation.install_profile('xorg')
+
+ # Install the application deepin from the template under /applications/
+ deepin = archinstall.Application(installation, 'deepin')
+ deepin.install()
+
+ # Enable autostart of Deepin for all users
+ installation.enable_service('lightdm')
diff --git a/profiles/desktop.py b/profiles/desktop.py
index 846182e2..dce2e18b 100644
--- a/profiles/desktop.py
+++ b/profiles/desktop.py
@@ -16,7 +16,7 @@ def _prep_function(*args, **kwargs):
for more input before any other installer steps start.
"""
- supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie', 'mate']
+ supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie', 'mate', 'deepin']
desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ')
# Temporarily store the selected desktop profile
diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py
new file mode 100644
index 00000000..e900117a
--- /dev/null
+++ b/profiles/i3-gaps.py
@@ -0,0 +1,43 @@
+import archinstall, subprocess
+
+is_top_level_profile = False
+
+def _prep_function(*args, **kwargs):
+ """
+ Magic function called by the importing installer
+ before continuing any further. It also avoids executing any
+ other code in this stage. So it's a safe way to ask the user
+ for more input before any other installer steps start.
+ """
+
+ # i3 requires a functioning Xorg installation.
+ profile = archinstall.Profile(None, 'xorg')
+ with profile.load_instructions(namespace='xorg.py') as imported:
+ if hasattr(imported, '_prep_function'):
+ return imported._prep_function()
+ else:
+ print('Deprecated (??): xorg profile has no _prep_function() anymore')
+
+def _post_install(*args, **kwargs):
+ """
+ Another magic function called after the system
+ has been installed.
+ """
+ installation.log("the installation of i3 does not conatain any configuerations for the wm. In this shell you should take your time to add your desiired configueration. Exit the shell once you are done to continue the installation.", fg="yellow")
+ try:
+ subprocess.check_call("arch-chroot /mnt",shell=True)
+ except subprocess.CallProcessError:
+ return False
+
+ return True
+
+if __name__ == 'i3-wm':
+ # Install dependency profiles
+ installation.install_profile('xorg')
+ # gaps is installed by deafult so we are overriding it here
+ installation.add_additional_packages("lightdm-gtk-greeter lightdm")
+ # install the i3 group now
+ i3 = archinstall.Application(installation, 'i3-gaps')
+ i3.install()
+ # Auto start lightdm for all users
+ installation.enable_service('lightdm')
diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py
new file mode 100644
index 00000000..a2449e39
--- /dev/null
+++ b/profiles/i3-wm.py
@@ -0,0 +1,42 @@
+import archinstall, subprocess
+
+is_top_level_profile = False
+
+def _prep_function(*args, **kwargs):
+ """
+ Magic function called by the importing installer
+ before continuing any further. It also avoids executing any
+ other code in this stage. So it's a safe way to ask the user
+ for more input before any other installer steps start.
+ """
+
+ # i3 requires a functioning Xorg installation.
+ profile = archinstall.Profile(None, 'xorg')
+ with profile.load_instructions(namespace='xorg.py') as imported:
+ if hasattr(imported, '_prep_function'):
+ return imported._prep_function()
+ else:
+ print('Deprecated (??): xorg profile has no _prep_function() anymore')
+def _post_install(*args, **kwargs):
+ """
+ Another magic function called after the system
+ has been installed.
+ """
+ installation.log("the installation of i3 does not conatain any configuerations for the wm. In this shell you should take your time to add your desiired configueration. Exit the shell once you are done to continue the installation.", fg="yellow")
+ try:
+ subprocess.check_call("arch-chroot /mnt",shell=True)
+ except subprocess.CallProcessError:
+ return False
+
+ return True
+
+if __name__ == 'i3-wm':
+ # Install dependency profiles
+ installation.install_profile('xorg')
+ # we are installing lightdm to auto start i3
+ installation.add_additional_packages("lightdm-gtk-greeter lightdm")
+ # install the i3 group now
+ i3 = archinstall.Application(installation, 'i3-wm')
+ i3.install()
+ # Auto start lightdm for all users
+ installation.enable_service('lightdm')
diff --git a/profiles/xorg.py b/profiles/xorg.py
index e905d533..42597a37 100644
--- a/profiles/xorg.py
+++ b/profiles/xorg.py
@@ -4,89 +4,6 @@ import archinstall, os
is_top_level_profile = True
-AVAILABLE_DRIVERS = {
- # Sub-dicts are layer-2 options to be selected
- # and lists are a list of packages to be installed
- 'AMD / ATI' : {
- 'amd' : ['xf86-video-amdgpu'],
- 'ati' : ['xf86-video-ati']
- },
- 'intel' : ['xf86-video-intel'],
- 'nvidia' : {
- 'open source' : ['xf86-video-nouveau'],
- 'proprietary' : ['nvidia']
- },
- 'mesa' : ['mesa'],
- 'fbdev' : ['xf86-video-fbdev'],
- 'vesa' : ['xf86-video-vesa'],
- 'vmware' : ['xf86-video-vmware']
-}
-
-def select_driver(options):
- """
- Some what convoluted function, which's job is simple.
- Select a graphics driver from a pre-defined set of popular options.
-
- (The template xorg is for beginner users, not advanced, and should
- there for appeal to the general public first and edge cases later)
- """
- drivers = sorted(list(options))
-
- if len(drivers) >= 1:
- for index, driver in enumerate(drivers):
- print(f"{index}: {driver}")
-
- print(' -- The above list are supported graphic card drivers. --')
- print(' -- You need to select (and read about) which one you need. --')
-
- lspci = archinstall.sys_command(f'/usr/bin/lspci')
- for line in lspci.trace_log.split(b'\r\n'):
- if b' vga ' in line.lower():
- if b'nvidia' in line.lower():
- print(' ** nvidia card detected, suggested driver: nvidia **')
- elif b'amd' in line.lower():
- print(' ** AMD card detected, suggested driver: AMD / ATI **')
-
- selected_driver = input('Select your graphics card driver: ')
- initial_option = selected_driver
-
- # Disabled search for now, only a few profiles exist anyway
- #
- #print(' -- You can enter ? or help to search for more drivers --')
- #if selected_driver.lower() in ('?', 'help'):
- # filter_string = input('Search for layout containing (example: "sv-"): ')
- # new_options = search_keyboard_layout(filter_string)
- # return select_language(new_options)
- if selected_driver.isdigit() and (pos := int(selected_driver)) <= len(drivers)-1:
- selected_driver = options[drivers[pos]]
- elif selected_driver in options:
- selected_driver = options[options.index(selected_driver)]
- elif len(selected_driver) == 0:
- raise archinstall.RequirementError("At least one graphics driver is needed to support a graphical environment. Please restart the installer and try again.")
- else:
- raise archinstall.RequirementError("Selected driver does not exist.")
-
- if type(selected_driver) == dict:
- driver_options = sorted(list(selected_driver))
- for index, driver_package_group in enumerate(driver_options):
- print(f"{index}: {driver_package_group}")
-
- selected_driver_package_group = input(f'Which driver-type do you want for {initial_option}: ')
- if selected_driver_package_group.isdigit() and (pos := int(selected_driver_package_group)) <= len(driver_options)-1:
- selected_driver_package_group = selected_driver[driver_options[pos]]
- elif selected_driver_package_group in selected_driver:
- selected_driver_package_group = selected_driver[selected_driver.index(selected_driver_package_group)]
- elif len(selected_driver_package_group) == 0:
- raise archinstall.RequirementError(f"At least one driver package is required for a graphical environment using {selected_driver}. Please restart the installer and try again.")
- else:
- raise archinstall.RequirementError(f"Selected driver-type does not exist for {initial_option}.")
-
- return selected_driver_package_group
-
- return selected_driver
-
- raise archinstall.RequirementError("Selecting drivers require a least one profile to be given as an option.")
-
def _prep_function(*args, **kwargs):
"""
Magic function called by the importing installer
@@ -94,10 +11,8 @@ def _prep_function(*args, **kwargs):
other code in this stage. So it's a safe way to ask the user
for more input before any other installer steps start.
"""
- print('You need to select which graphics card you\'re using.')
- print('This in order to setup the required graphics drivers.')
- __builtins__['_gfx_driver_packages'] = select_driver(AVAILABLE_DRIVERS)
+ __builtins__['_gfx_driver_packages'] = archinstall.select_driver()
# TODO: Add language section and/or merge it with the locale selected
# earlier in for instance guided.py installer.
diff --git a/pyproject.toml b/pyproject.toml
index 9787c3bd..da6f860e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,30 @@
[build-system]
-requires = ["setuptools", "wheel"]
-build-backend = "setuptools.build_meta"
+requires = ["flit_core >=2,<4"]
+build-backend = "flit_core.buildapi"
+
+[tool.flit.metadata]
+module = "archinstall"
+author = "Anton Hvornum"
+author-email = "anton@hvornum.se"
+home-page = "https://archlinux.org"
+classifiers = [ "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
+"Programming Language :: Python :: 3.8",
+"Programming Language :: Python :: 3.9",
+"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
+"Operating System :: POSIX :: Linux",
+]
+description-file = "README.md"
+requires-python=">=3.8"
+[tool.flit.metadata.urls]
+Source = "https://github.com/archlinux/archinstall"
+Documentation = "https://archinstall.readthedocs.io/"
+
+[tool.flit.scripts]
+archinstall = "archinstall:run_as_a_module"
+
+[tool.flit.sdist]
+include = ["docs/"]
+exclude = ["docs/*.html", "docs/_static","docs/*.png","docs/*.psd"]
+
+[tool.flit.metadata.requires-extra]
+doc = ["sphinx"] \ No newline at end of file