Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archinstall/__init__.py27
-rw-r--r--archinstall/lib/installer.py2
-rw-r--r--docs/installing/guided.rst108
-rw-r--r--examples/guided.py9
4 files changed, 119 insertions, 27 deletions
diff --git a/archinstall/__init__.py b/archinstall/__init__.py
index ee4748f6..b914c7ec 100644
--- a/archinstall/__init__.py
+++ b/archinstall/__init__.py
@@ -23,7 +23,7 @@ from .lib.user_interaction import *
parser = ArgumentParser()
-__version__ = "2.2.0.dev1"
+__version__ = "2.2.0.RC1"
def initialize_arguments():
@@ -32,16 +32,7 @@ def initialize_arguments():
parser.add_argument("--silent", action="store_true",
help="Warning!!! No prompts, ignored if config is not passed")
parser.add_argument("--script", default="guided", nargs="?", help="Script to run for installation", type=str)
- parser.add_argument("--vars",
- metavar="KEY=VALUE",
- nargs='?',
- help="Set a number of key-value pairs "
- "(do not put spaces before or after the = sign). "
- "If a value contains spaces, you should define "
- "it with double quotes: "
- 'foo="this is a sentence". Note that '
- "values are always treated as strings.")
- args = parser.parse_args()
+ args, unknowns = parser.parse_known_args()
if args.config is not None:
try:
# First, let's check if this is a URL scheme instead of a filename
@@ -57,13 +48,13 @@ def initialize_arguments():
print(e)
# Installation can't be silent if config is not passed
config["silent"] = args.silent
- if args.vars is not None:
- try:
- for var in args.vars.split(' '):
- key, val = var.split("=")
- config[key] = val
- except Exception as e:
- print(e)
+ for arg in unknowns:
+ if '--' == arg[:2]:
+ if '=' in arg:
+ key, val = [x.strip() for x in arg[2:].split('=', 1)]
+ else:
+ key, val = arg[2:], True
+ config[key] = val
config["script"] = args.script
return config
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 1be398e9..b459e990 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -453,7 +453,7 @@ class Installer:
self.pacstrap('efibootmgr')
o = b''.join(SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB'))
SysCommand('/usr/bin/arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg')
- self.helper_flags['bootloder'] = True
+ self.helper_flags['bootloader'] = True
return True
else:
root_device = subprocess.check_output(f'basename "$(readlink -f /sys/class/block/{root_partition.path.replace("/dev/", "")}/..)"', shell=True).decode().strip()
diff --git a/docs/installing/guided.rst b/docs/installing/guided.rst
index 88b4e480..e442d927 100644
--- a/docs/installing/guided.rst
+++ b/docs/installing/guided.rst
@@ -26,17 +26,113 @@ Running the guided installation
To install archinstall and subsequently the guided installer, simply do the following:
-.. code::bash
- # pacman -S python-archinstall
+.. code-block:: sh
+
+ pacman -S python-archinstall
And to run it, execute archinstall as a Python module:
-.. code::bash
- # python -m archinstall guided
+.. code-block:: sh
-| The guided parameter is optional as it's the default behavior.
+ python -m archinstall --script guided
+
+| The ``--script guided`` argument is optional as it's the default behavior.
| But this will start the process of guiding you through a installation of a quite minimal Arch Linux experience.
+Installing directly from a config file
+--------------------------------------
+
+.. note::
+ Edit the following json according to your needs,
+ save this as a json file, and provide the local or remote path (URL)
+
+.. code-block:: json
+
+ {
+ "audio": "pipewire",
+ "bootloader": "systemd-bootctl",
+ "custom-commands": [
+ "cd /home/devel; git clone https://aur.archlinux.org/paru.git",
+ "chown -R devel:devel /home/devel/paru",
+ "usermod -aG docker devel"
+ ],
+ "!encryption-password": "supersecret",
+ "filesystem": "btrfs",
+ "harddrive": {
+ "path": "/dev/nvme0n1"
+ },
+ "hostname": "development-box",
+ "kernels": [
+ "linux"
+ ],
+ "keyboard-language": "us",
+ "mirror-region": {
+ "Worldwide": {
+ "https://mirror.rackspace.com/archlinux/$repo/os/$arch": true
+ }
+ },
+ "nic": {
+ "NetworkManager": true
+ },
+ "packages": ["docker", "git", "wget", "zsh"],
+ "profile": "gnome",
+ "services": ["docker"],
+ "superusers": {
+ "devel": {
+ "!password": "devel"
+ }
+ },
+ "timezone": "US/Eastern",
+ "users": {}
+ }
+
+To run it, execute archinstall as a Python module:
+
+.. code-block:: sh
+
+ python -m archinstall --config <local path or remote URL>
+
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| Key | Values/Description | Description | Required |
+| | | | |
++======================+========================================================+============================================================================+===============================================+
+| audio | pipewire/pulseaudio | Audioserver to be installed | No |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| bootloader | systemd-bootctl/grub-install | Bootloader to be installed | Yes |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| custom-commands | [ <command1>, <command2>, ...] | Custom commands to be run post install | No |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| !encryption-password | any | Password to encrypt disk, not encrypted if password not provided | No |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| filesystem | ext4 / btrfs / fat32 etc. | Filesystem for root and home partitions | Yes |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| harddrive | { "path": <path of device> } | Path of device to be used | Yes |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| hostname | any | Hostname of machine after installation | Yes |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| kernels | [ "kernel1", "kernel2"] | List of kernels to install eg: linux, linux-lts, linux-zen etc | Atleast 1 |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| keyboard-language | 2 letter code for your keyboard language | eg: us, de etc | Yes |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| mirror-region | {"<Region Name>": { "Mirror Name": True/False}, ..} | List of regions and mirrors to use | Yes |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| nic | nic to use, Use value NetworkManager for installing it | | Yes |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| packages | [ "package1", "package2", ..] | List of packages to install post-installation | No |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| profile | Name of profile to install | profiles are present in profiles/, use the name of a profile to install it | No |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| !root-password | any | The root account password | No |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| services | [ "service1", "service2", ..] | Services to enable post-installation | No |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| superusers | { "<username>": { "!password": "<password>"}, ..} | List of superuser credentials, see config for reference | Yes, if root account password is not provided |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| timezone | Timezone to configure in installation | Timezone eg: UTC, Asia/Kolkata etc. | Yes |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+| users | { "<username>": { "!password": "<password>"}, ..} | List of regular user credentials, see config for reference | Yes, can be {} |
++----------------------+--------------------------------------------------------+----------------------------------------------------------------------------+-----------------------------------------------+
+
Description individual steps
============================
@@ -173,4 +269,4 @@ After which you can press :code:`Enter` can be pressed in order to start the for
Post installation
-----------------
-Once the installation is complete, green text should appear saying that it's safe to `reboot`, which is also the command you use to reboot.
+Once the installation is complete, green text should appear saying that it's safe to `reboot`, which is also the command you use to reboot. \ No newline at end of file
diff --git a/examples/guided.py b/examples/guided.py
index cbf30eb3..73fded4e 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -250,7 +250,7 @@ def ask_user_questions():
if archinstall.arguments['timezone']:
if not archinstall.arguments.get('ntp', False):
- archinstall.arguments['ntp'] = input("Would you like to use automatic time synchronization (NTP) with the default time servers? [Y/n]: ").strip().lower() in ('y', 'yes')
+ archinstall.arguments['ntp'] = input("Would you like to use automatic time synchronization (NTP) with the default time servers? [Y/n]: ").strip().lower() in ('y', 'yes', '')
if archinstall.arguments['ntp']:
archinstall.log("Hardware time and other post-configuration steps might be required in order for NTP to work. For more information, please check the Arch wiki.", fg="yellow")
@@ -445,5 +445,10 @@ else:
archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None))
else:
archinstall.arguments['profile'] = None
-
+ if archinstall.arguments.get('mirror-region', None) is not None:
+ selected_region = archinstall.arguments.get('mirror-region', None)
+ archinstall.arguments['mirror-region'] = {selected_region: archinstall.list_mirrors()[selected_region]}
+ archinstall.arguments['sys-language'] = archinstall.arguments.get('sys-language', 'en_US')
+ archinstall.arguments['sys-encoding'] = archinstall.arguments.get('sys-encoding', 'utf-8')
+
perform_installation_steps()