Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/installer.py
diff options
context:
space:
mode:
Diffstat (limited to 'installer.py')
-rw-r--r--installer.py44
1 files changed, 28 insertions, 16 deletions
diff --git a/installer.py b/installer.py
index 91a8139a..faeb7edc 100644
--- a/installer.py
+++ b/installer.py
@@ -1,28 +1,40 @@
import archinstall, getpass
-archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop')
+## dd if=/dev/zero of=test.img bs=1G count=4
+## losetup -fP test.img
+archinstall.sys_command(f'umount -R /mnt', surpress_errors=True)
+archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop', surpress_errors=True)
-#selected_hdd = archinstall.select_disk(archinstall.all_disks())
-selected_hdd = archinstall.all_disks()['/dev/loop0']
+#harddrive = archinstall.select_disk(archinstall.all_disks())
+harddrive = archinstall.all_disks()['/dev/loop0']
disk_password = '1234' # getpass.getpass(prompt='Disk password (won\'t echo): ')
-with archinstall.Filesystem(selected_hdd, archinstall.GPT) as fs:
+with archinstall.Filesystem(harddrive, archinstall.GPT) as fs:
+ print(f'Formatting {harddrive}')
fs.use_entire_disk('luks2')
with archinstall.luks2(fs) as crypt:
- if selected_hdd.partition[1]['size'] == '512M':
+ if harddrive.partition[1].size == '512M':
raise OSError('Trying to encrypt the boot partition for petes sake..')
- key_file = crypt.encrypt(selected_hdd.partition[1], password=disk_password, key_size=512, hash_type='sha512', iter_time=10000, key_file='./pwfile')
- crypt.mount(selected_hdd.partition[1], 'luksloop', key_file)
- exit(1)
- with archinstall.installer(root_partition, hostname='testmachine') as installation:
- if installation.minimal_installation():
- installation.add_bootloader()
+ print(f'Encrypting {harddrive.partition[1]}')
+ key_file = crypt.encrypt(harddrive.partition[1], password=disk_password, key_size=512, hash_type='sha512', iter_time=10000, key_file='./pwfile')
- installation.add_additional_packages(['nano', 'wget', 'git'])
- installation.install_profile('desktop')
+ unlocked_device = crypt.unlock(harddrive.partition[1], 'luksloop', key_file)
+
+ print('Formatting partitions.')
+ harddrive.partition[0].format('fat32')
+ unlocked_device.format('btrfs')
+
+ with archinstall.Installer(unlocked_device, hostname='testmachine') as installation:
+ print('Installing minimal installation to disk.')
+ if installation.minimal_installation():
+ print('Adding bootloader.')
+ installation.add_bootloader(harddrive.partition[0])
- installation.user_create('anton', 'test')
- installation.user_set_pw('root', 'toor')
+ installation.add_additional_packages(['nano', 'wget', 'git'])
+ installation.install_profile('desktop')
- installation.add_AUR_support() \ No newline at end of file
+ installation.user_create('anton', 'test')
+ installation.user_set_pw('root', 'toor')
+
+ installation.add_AUR_support() \ No newline at end of file