From 332bb97a782a4f467b24fa6b9320f9d1de597110 Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 00:21:11 +0200 Subject: Gefunked the awk command --- archinstall.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/archinstall.py b/archinstall.py index 58e423e2..a5e88700 100644 --- a/archinstall.py +++ b/archinstall.py @@ -118,9 +118,16 @@ if __name__ == '__main__': if not 'packages' in args: args['packages'] = '' print(args) - PIN = '0000' - with open(args['pwfile'], 'w') as pw: - pw.write(PIN) + if not os.path.isfile(args['pwfile']): + PIN = '0000' + with open(args['pwfile'], 'w') as pw: + pw.write(PIN) + else: + ## TODO: Convert to `rb` instead. + # We shouldn't discriminate \xfu from being a passwd phrase. + with open(args['pwfile'], 'r') as pw: + PIN = pw.read().strip() + print('[!] Disk PASSWORD is: {}'.format(PIN)) # dd if=/dev/random of=args['drive'] bs=4096 status=progress @@ -192,7 +199,7 @@ if __name__ == '__main__': ## For some reason, blkid and /dev/disk/by-uuid are not getting along well. ## And blkid is wrong in terms of LUKS. #UUID = run('blkid -s PARTUUID -o value {drive}{part2}'.format(**args, part2=second)).decode('UTF-8').strip() - UUID = run("ls -l /dev/disk/by-uuid/ | grep {basename}{part2} | awk '{print $9}'".format(basename=os.path.basename(args['drive']), part2=second)).decode('UTF-8').strip() + UUID = run("ls -l /dev/disk/by-uuid/ | grep {basename}{part2} | awk '{awk}'".format(basename=os.path.basename(args['drive']), part2=second, awk='{print $9}')).decode('UTF-8').strip() with open('/mnt/boot/loader/entries/arch.conf', 'w') as entry: entry.write('title Arch Linux\n') entry.write('linux /vmlinuz-linux\n') -- cgit v1.2.3-70-g09d2