Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archinstall.py50
1 files changed, 35 insertions, 15 deletions
diff --git a/archinstall.py b/archinstall.py
index 725d05ee..06e51300 100644
--- a/archinstall.py
+++ b/archinstall.py
@@ -781,6 +781,7 @@ def setup_args_defaults(args, interactive=True):
if not 'password' in args: args['password'] = '0000' # Default disk passord, can be <STDIN> or a fixed string
if not 'default' in args: args['default'] = False
if not 'profile' in args: args['profile'] = None
+ if not 'skip-encrypt' in args: args['skip-encrypt'] = False
if not 'profiles-path' in args: args['profiles-path'] = profiles_path
if not 'rerun' in args: args['rerun'] = None
if not 'aur-keep' in args: args['aur-keep'] = False
@@ -902,7 +903,7 @@ def encrypt_partition(drive, partition, keyfile='/tmp/diskpw', *positionals, **k
return True
def mkfs_btrfs(drive='/dev/mapper/luksdev', *positionals, **kwargs):
- o = b''.join(sys_command('/usr/bin/mkfs.btrfs -f /dev/mapper/luksdev'))
+ o = b''.join(sys_command(f'/usr/bin/mkfs.btrfs -f {drive}'))
if not b'UUID' in o:
return False
return True
@@ -915,6 +916,17 @@ def mount_luksdev(where='/dev/mapper/luksdev', to='/mnt', *positionals, **kwargs
o = b''.join(sys_command('/usr/bin/mount /dev/mapper/luksdev /mnt', *positionals, **kwargs))
return True
+def mount_part(drive, partition, mountpoint='/mnt', *positionals, **kwargs):
+ os.makedirs(mountpoint, exist_ok=True)
+ #o = b''.join(sys_command('/usr/bin/mount | /usr/bin/grep /mnt/boot', *positionals, **kwargs)) # /dev/dm-0
+
+ check_mounted = simple_command(f'/usr/bin/mount | /usr/bin/grep {mountpoint}', *positionals, **kwargs).decode('UTF-8').strip()
+ if len(check_mounted):
+ return False
+
+ o = b''.join(sys_command(f'/usr/bin/mount {drive}{partition} {mountpoint}', *positionals, **kwargs))
+ return True
+
def mount_boot(drive, partition, mountpoint='/mnt/boot', *positionals, **kwargs):
os.makedirs('/mnt/boot', exist_ok=True)
#o = b''.join(sys_command('/usr/bin/mount | /usr/bin/grep /mnt/boot', *positionals, **kwargs)) # /dev/dm-0
@@ -926,11 +938,13 @@ def mount_boot(drive, partition, mountpoint='/mnt/boot', *positionals, **kwargs)
o = b''.join(sys_command(f'/usr/bin/mount {drive}{partition} {mountpoint}', *positionals, **kwargs))
return True
-def mount_mountpoints(drive, bootpartition, mountpoint='/mnt/boot', *positionals, **kwargs):
+def mount_mountpoints(drive, bootpartition, mountpoint='/mnt', *positionals, **kwargs):
drive = args[drive]
- bootpartition = args['partitions'][bootpartition]
- mount_luksdev(*positionals, **kwargs)
- mount_boot(drive, bootpartition, mountpoint='/mnt/boot', *positionals, **kwargs)
+ if args['skip-encrypt']:
+ mount_part(drive, args['partitions']["2"], mountpoint, *positionals, **kwargs)
+ else:
+ mount_luksdev(*positionals, **kwargs)
+ mount_boot(drive, args['partitions'][bootpartition], mountpoint=f'{mountpoint}/boot', *positionals, **kwargs)
return True
def re_rank_mirrors(top=10, *positionals, **kwargs):
@@ -1190,20 +1204,26 @@ if __name__ == '__main__':
print(f'[E] Could not setup {args["drive"]}{args["partitions"]["1"]}')
exit(1)
- # "--cipher sha512" breaks the shit.
- # TODO: --use-random instead of --use-urandom
- print(f'[N] Adding encryption to {args["drive"]}{args["partitions"]["2"]}.')
- if not encrypt_partition('drive', '2', 'pwfile'):
- print('[E] Failed to setup disk encryption.', o)
- exit(1)
+ if not args['skip-encrypt']:
+ # "--cipher sha512" breaks the shit.
+ # TODO: --use-random instead of --use-urandom
+ print(f'[N] Adding encryption to {args["drive"]}{args["partitions"]["2"]}.')
+ if not encrypt_partition('drive', '2', 'pwfile'):
+ print('[E] Failed to setup disk encryption.', o)
+ exit(1)
- if not mount_luktsdev('drive', '2', 'pwfile'):
- print('[E] Could not open encrypted device.', o)
- exit(1)
+ if not args['skip-encrypt']:
+ if not mount_luktsdev('drive', '2', 'pwfile'):
+ print('[E] Could not open encrypted device.', o)
+ exit(1)
if not args['rerun'] or args['ignore-rerun']:
print(f'[N] Creating btrfs filesystem inside {args["drive"]}{args["partitions"]["2"]}')
- if not mkfs_btrfs():
+
+ on_part = '/dev/mapper/luksdev'
+ if args['skip-encrypt']:
+ on_part = f'{args["drive"]}/{args["partitions"]["2"]}'
+ if not mkfs_btrfs(on_part):
print('[E] Could not setup btrfs filesystem.', o)
exit(1)