From f973df9c39b6f9bb43abaaf6285a3c68b7a04ae8 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 24 Sep 2019 15:20:32 +0200 Subject: Fixes issue #14. If multiple drives are found, do not swallow the whole disk at once. --- archinstall.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'archinstall.py') diff --git a/archinstall.py b/archinstall.py index d45a36b6..3ea629db 100644 --- a/archinstall.py +++ b/archinstall.py @@ -466,7 +466,6 @@ if __name__ == '__main__': exit(1) ## Setup some defaults (in case no command-line parameters or netdeploy-params were given) - if not 'drive' in args: args['drive'] = sorted(list(harddrives.keys()))[0] # First drive found if not 'size' in args: args['size'] = '100%' if not 'start' in args: args['start'] = '513MiB' if not 'pwfile' in args: args['pwfile'] = '/tmp/diskpw' @@ -480,6 +479,12 @@ if __name__ == '__main__': if not 'profiles-path' in args: args['profiles-path'] = profiles_path if not 'rerun' in args: args['rerun'] = None if not 'ignore-rerun' in args: args['ignore-rerun'] = False + if not 'localtime' in args: args['localtime'] = 'Europe/Stockholm' if args['country'] == 'SE' else 'GMT+0' # TODO: Arbitrary for now + if not 'drive' in args: + drives = list(harddrives.keys()) + if len(drives) > 1 and not ('force' in args or 'first-drive' in args): + raise KeyError("Multiple disks found, and --force / --first-drive wasn't specified.") + args['drive'] = sorted(drives)[0] # First drive found rerun = args['ignore-rerun'] if args['drive'][0] != '/': @@ -722,7 +727,7 @@ if __name__ == '__main__': fstab.write('\ntmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0\n') # Redundant \n at the start? who knoes? o = b''.join(sys_command('/usr/bin/arch-chroot /mnt rm /etc/localtime').exec()) - o = b''.join(sys_command('/usr/bin/arch-chroot /mnt ln -s /usr/share/zoneinfo/Europe/Stockholm /etc/localtime').exec()) + o = b''.join(sys_command('/usr/bin/arch-chroot /mnt ln -s /usr/share/zoneinfo/{localtime} /etc/localtime'.format(**args)).exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt hwclock --hctosys --localtime').exec()) #o = sys_command('arch-chroot /mnt echo "{hostname}" > /etc/hostname'.format(**args)).exec() #o = sys_command("arch-chroot /mnt sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen").exec() -- cgit v1.2.3-70-g09d2