From 2dbfa429261753c0b621e862571f05d74c77fffc Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Mon, 6 Jul 2020 23:22:45 +0200 Subject: Updated the script example. --- README.md | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index bc6f843b..3c403b35 100644 --- a/README.md +++ b/README.md @@ -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') -- cgit v1.2.3-54-g00ecf