@@ -104,67 +104,9 @@ All available console fonts can be found in `/usr/share/kbd/consolefonts` and se
104104
105105# # Scripting interactive installation
106106
107- There are some examples in the ` examples/` directory that should serve as a starting point.
107+ For an example of a fully scripted, interactive installation please refer to the example
108+ [interactive_installation.py](https://github.com/archlinux/archinstall/blob/master/archinstall/scripts/guided.py)
108109
109- The following is a small example of how to script your own * interactive* installation:
110-
111- ` ` ` python
112- from pathlib import Path
113-
114- from archinstall import Installer, ProfileConfiguration, profile_handler, User
115- from archinstall.default_profiles.minimal import MinimalProfile
116- from archinstall.lib.disk.device_model import FilesystemType
117- from archinstall.lib.disk.encryption_menu import DiskEncryptionMenu
118- from archinstall.lib.disk.filesystem import FilesystemHandler
119- from archinstall.lib.interactions.disk_conf import select_disk_config
120-
121- fs_type = FilesystemType(' ext4' )
122-
123- # Select a device to use for the installation
124- disk_config = select_disk_config ()
125-
126- # Optional: ask for disk encryption configuration
127- data_store = {}
128- disk_encryption = DiskEncryptionMenu(disk_config.device_modifications, data_store).run ()
129-
130- # initiate file handler with the disk config and the optional disk encryption config
131- fs_handler = FilesystemHandler(disk_config, disk_encryption)
132-
133- # perform all file operations
134- # WARNING: this will potentially format the filesystem and delete all data
135- fs_handler.perform_filesystem_operations ()
136-
137- mountpoint = Path(' /tmp' )
138-
139- with Installer(
140- mountpoint,
141- disk_config,
142- disk_encryption=disk_encryption,
143- kernels=[' linux' ]
144- ) as installation:
145- installation.mount_ordered_layout ()
146- installation.minimal_installation(hostname=' minimal-arch' )
147- installation.add_additional_packages([' nano' , ' wget' , ' git' ])
148-
149- # Optionally, install a profile of choice.
150- # In this case, we install a minimal profile that is empty
151- profile_config = ProfileConfiguration(MinimalProfile ())
152- profile_handler.install_profile_config(installation, profile_config)
153-
154- user = User(' archinstall' , ' password' , True)
155- installation.create_users(user)
156- ` ` `
157-
158- This installer will perform the following actions:
159-
160- * Prompt the user to configure the disk partitioning
161- * Prompt the user to setup disk encryption
162- * Create a file handler instance for the configured disk and the optional disk encryption
163- * Perform the disk operations (WARNING: this will potentially format the disks and erase all data)
164- * Install a basic instance of Arch Linux * (base base-devel linux linux-firmware btrfs-progs efibootmgr)*
165- * Install and configures a bootloader to partition 0 on UEFI. On BIOS, it sets the root to partition 0.
166- * Install additional packages * (nano, wget, git)*
167- * Create a new user
168110
169111> ** To create your own ISO with this script in it:** Follow [ArchISO](https://wiki.archlinux.org/index.php/archiso)' s guide on creating your own ISO.
170112
@@ -226,7 +168,7 @@ This can be done by installing `pacman -S arch-install-scripts util-linux` local
226168 # losetup --partscan --show --find ./testimage.img
227169 # pip install --upgrade archinstall
228170 # python -m archinstall --script guided
229- # qemu-system-x86_64 -enable-kvm -machine q35,accel=kvm -device intel-iommu -cpu host -m 4096 -boot order=d -drive file=./testimage.img,format=raw -drive if=pflash,format=raw,readonly,file=/usr/share/ovmf/x64/OVMF_CODE. fd -drive if=pflash,format=raw,readonly,file=/usr/share/ovmf/x64/OVMF_VARS.fd
171+ # qemu-system-x86_64 -enable-kvm -machine q35,accel=kvm -device intel-iommu -cpu host -m 4096 -boot order=d -drive file=./testimage.img,format=raw -drive if=pflash,format=raw,readonly,file=/usr/share/ovmf/x64/OVMF.4m. fd -drive if=pflash,format=raw,readonly,file=/usr/share/ovmf/x64/OVMF.4m.fd
230172
231173This will create a *20 GB* `testimage.img` and create a loop device which we can use to format and install to.<br>
232174`archinstall` is installed and executed in [guided mode](#docs-todo). Once the installation is complete, ~~you can use qemu/kvm to boot the test media.~~<br>
0 commit comments