Updated the script example.

This commit is contained in:
Anton Hvornum 2020-07-06 23:22:45 +02:00
parent 377868cfcd
commit 2dbfa42926
1 changed files with 16 additions and 10 deletions

View File

@ -41,25 +41,31 @@ This is probably what you'll need, a minimal example of how to install using arc
```python
import archinstall, getpass
# Unmount and close previous runs
archinstall.sys_command(f'umount -R /mnt', surpress_errors=True)
archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop', surpress_errors=True)
hdd = archinstall.select_disk(archinstall.all_disks())
# Select a harddrive and a disk password
harddrive = archinstall.select_disk(archinstall.all_disks())
disk_password = getpass.getpass(prompt='Disk password (won\'t echo): ')
with archinstall.Filesystem(hdd, archinstall.GPT) as fs:
with archinstall.Filesystem(harddrive, archinstall.GPT) as fs:
# Use the entire disk instead of setting up partitions on your own
fs.use_entire_disk('luks2')
with archinstall.Luks2(fs) as crypt:
if hdd.partition[1]['size'] == '512M':
raise OSError('Trying to encrypt the boot partition for petes sake..')
key_file = crypt.encrypt(hdd.partition[1], password=disk_password, key_size=512, hash_type='sha512', iter_time=10000, key_file='./pwfile')
unlocked_crypt_vol = crypt.mount(hdd.partition[1], 'luksloop', key_file)
if harddrive.partition[1].size == '512M':
raise OSError('Trying to encrypt the boot partition for petes sake..')
harddrive.partition[0].format('fat32')
with archinstall.Installer(unlocked_crypt_vol, hostname='testmachine') as installation:
with archinstall.luks2(harddrive.partition[1], 'luksloop', disk_password) as unlocked_device:
unlocked_device.format('btrfs')
with archinstall.Installer(unlocked_device, hostname='testmachine') as installation:
if installation.minimal_installation():
installation.add_bootloader()
installation.add_bootloader(harddrive.partition[0])
installation.add_additional_packages(['nano', 'wget', 'git'])
installation.install_profile('desktop')
installation.install_profile('workstation')
installation.user_create('anton', 'test')
installation.user_set_pw('root', 'toor')