From d9a986922cf74b31cdb00d33d718af73e3fcb48b Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 13 Nov 2019 21:15:15 +0000 Subject: Added AUR support via yay. Not tested --- archinstall.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'archinstall.py') diff --git a/archinstall.py b/archinstall.py index 11149ff7..ad1830be 100644 --- a/archinstall.py +++ b/archinstall.py @@ -480,6 +480,7 @@ if __name__ == '__main__': if not 'profile' in args: args['profile'] = None if not 'profiles-path' in args: args['profiles-path'] = profiles_path if not 'rerun' in args: args['rerun'] = None + if not 'support-aur' in args: args['support-aur'] = True # Support adds yay (https://github.com/Jguer/yay) in installation steps. 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: @@ -727,7 +728,7 @@ if __name__ == '__main__': o = b''.join(sys_command('/usr/bin/pacman -Syy').exec()) o = b''.join(sys_command('/usr/bin/pacstrap /mnt base base-devel linux linux-firmware btrfs-progs efibootmgr nano wpa_supplicant dialog {packages}'.format(**args)).exec()) - if not os.path.isdir('/mnt/etc'): + if not os.path.isdir('/mnt/etc'): # TODO: This might not be the most long term stable thing to rely on... print('[E] Failed to strap in packages', o) exit(1) @@ -771,6 +772,17 @@ if __name__ == '__main__': entry.write('initrd /initramfs-linux.img\n') entry.write('options cryptdevice=UUID={UUID}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n'.format(UUID=UUID)) + if args['support-aur']: + o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "useradd -m -G wheel aibuilder"').exec()) + o = b''.join(sys_command("/usr/bin/sed -i 's/# %wheel ALL=(ALL) NO/%wheel ALL=(ALL) NO/' /mnt/etc/sudoers").exec()) + + o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "git clone https://aur.archlinux.org/yay.git"').exec()) + o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "chown -R aibuilder.aibuilder yay"').exec()) + o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "su - aibuilder -c \"(cd /root/yay; makepkg -si --noconfirm)\" >/dev/null"').exec()) + o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "sed -i \'s/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/\' /mnt/etc/sudoers"').exec()) + o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "userdel aibuilder"').exec()) + o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "rm -rf /home/aibuilder"').exec()) + conf = {} if 'post' in instructions: conf = instructions['post'] -- cgit v1.2.3-70-g09d2 From a16f7442a9be04a93ba698511fca15266061a053 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 13 Nov 2019 22:21:41 +0000 Subject: Deleting git-branch after use since it breaks the syntax later. --- archinstall.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'archinstall.py') diff --git a/archinstall.py b/archinstall.py index 4d85c9ce..e65a5a02 100644 --- a/archinstall.py +++ b/archinstall.py @@ -508,7 +508,7 @@ if __name__ == '__main__': if not 'profile' in args: args['profile'] = None if not 'profiles-path' in args: args['profiles-path'] = profiles_path if not 'rerun' in args: args['rerun'] = None - if not 'support-aur' in args: args['support-aur'] = True # Support adds yay (https://github.com/Jguer/yay) in installation steps. + if not 'aur-support' in args: args['aur-support'] = True # Support adds yay (https://github.com/Jguer/yay) in installation steps. 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: @@ -641,13 +641,11 @@ if __name__ == '__main__': print('[!] Disk PASSWORD is: {}'.format(args['password'])) print() - - for i in range(5, 0, -1): - print(f'Formatting in {i}...') - sleep(1) - - if not args['rerun'] or args['ignore-rerun']: + for i in range(5, 0, -1): + print(f'Formatting {args["drive"]} in {i}...') + sleep(1) + o = simple_command('/usr/bin/umount -R /mnt') o = simple_command('/usr/bin/cryptsetup close /dev/mapper/luksdev') print('[N] Setting up {drive}.'.format(**args)) @@ -726,6 +724,7 @@ if __name__ == '__main__': if 'git-branch' in pre_conf: update_git(pre_conf['git-branch']) + del(pre_conf['git-branch']) ## Prerequisit steps needs to NOT be executed in arch-chroot. ## Mainly because there's no root structure to chroot into. @@ -811,7 +810,7 @@ if __name__ == '__main__': entry.write('initrd /initramfs-linux.img\n') entry.write('options cryptdevice=UUID={UUID}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n'.format(UUID=UUID)) - if args['support-aur']: + if args['aur-support']: o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "useradd -m -G wheel aibuilder"').exec()) o = b''.join(sys_command("/usr/bin/sed -i 's/# %wheel ALL=(ALL) NO/%wheel ALL=(ALL) NO/' /mnt/etc/sudoers").exec()) @@ -829,7 +828,8 @@ if __name__ == '__main__': conf = instructions if 'git-branch' in conf: - update_git(pre_conf['git-branch']) + update_git(conf['git-branch']) + del(conf['git-branch']) for title in conf: if args['rerun'] and args['rerun'] != title and not rerun: -- cgit v1.2.3-70-g09d2 From 7e1f2dc8ff5017e5e85e1ffa8a17b81089ec3729 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 13 Nov 2019 22:36:29 +0000 Subject: Adding git as base package if we're supporting AUR. Since we need this (until we move over to HTTPS) --- archinstall.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'archinstall.py') diff --git a/archinstall.py b/archinstall.py index e65a5a02..9dfe3204 100644 --- a/archinstall.py +++ b/archinstall.py @@ -763,6 +763,8 @@ if __name__ == '__main__': if not args['rerun'] or rerun: print('[N] Straping in packages.') + if args['aur-support']: + args['packages'] += ' git' o = b''.join(sys_command('/usr/bin/pacman -Syy').exec()) o = b''.join(sys_command('/usr/bin/pacstrap /mnt base base-devel linux linux-firmware btrfs-progs efibootmgr nano wpa_supplicant dialog {packages}'.format(**args)).exec()) -- cgit v1.2.3-70-g09d2 From d08f9835a21a8f3101a4cf05de975bf41a076a67 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 13 Nov 2019 22:43:28 +0000 Subject: Fix for branch switching (?). Also fixed the su aibuilder command-oneliner --- archinstall.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'archinstall.py') diff --git a/archinstall.py b/archinstall.py index 9dfe3204..b9e08de2 100644 --- a/archinstall.py +++ b/archinstall.py @@ -338,6 +338,11 @@ def update_git(branch='master'): if branch != 'master': print(f'[N] Changing branch to {branch}') output = simple_command(f'(cd /root/archinstall; git checkout {branch}; git pull)') + print('[N] Rebooting the new branch') + if not 'rebooted' in args: + os.execv('/usr/bin/python3', ['archinstall.py'] + sys.argv + ['--rebooted','--rerun']) + else: + os.execv('/usr/bin/python3', ['archinstall.py'] + sys.argv + ['--rerun',]) if not 'rebooted' in args: ## Reboot the script (in same context) @@ -818,7 +823,7 @@ if __name__ == '__main__': o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "git clone https://aur.archlinux.org/yay.git"').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "chown -R aibuilder.aibuilder yay"').exec()) - o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "su - aibuilder -c \"(cd /root/yay; makepkg -si --noconfirm)\" >/dev/null"').exec()) + o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "su - aibuilder -c \\"(cd /root/yay; makepkg -si --noconfirm)\\" >/dev/null"').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "sed -i \'s/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/\' /mnt/etc/sudoers"').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "userdel aibuilder"').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "rm -rf /home/aibuilder"').exec()) -- cgit v1.2.3-70-g09d2 From 9627e2079b663b9dfdd561001255eb1aca26014d Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 13 Nov 2019 22:46:41 +0000 Subject: Improiving on git branch switching --- archinstall.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'archinstall.py') diff --git a/archinstall.py b/archinstall.py index b9e08de2..4c4fd116 100644 --- a/archinstall.py +++ b/archinstall.py @@ -336,13 +336,15 @@ def update_git(branch='master'): # if(num_changes): if branch != 'master': - print(f'[N] Changing branch to {branch}') - output = simple_command(f'(cd /root/archinstall; git checkout {branch}; git pull)') - print('[N] Rebooting the new branch') - if not 'rebooted' in args: - os.execv('/usr/bin/python3', ['archinstall.py'] + sys.argv + ['--rebooted','--rerun']) - else: - os.execv('/usr/bin/python3', ['archinstall.py'] + sys.argv + ['--rerun',]) + on_branch = simple_command('(cd /root/archinstall; git branch | grep "*" | cut -d\' \' -f 2)') + if on_branch.strip().lower() != branch.strip().lower(): + print(f'[N] Changing branch to {branch}') + output = simple_command(f'(cd /root/archinstall; git checkout {branch}; git pull)') + print('[N] Rebooting the new branch') + if not 'rebooted' in args: + os.execv('/usr/bin/python3', ['archinstall.py'] + sys.argv + ['--rebooted','--rerun']) + else: + os.execv('/usr/bin/python3', ['archinstall.py'] + sys.argv + ['--rerun',]) if not 'rebooted' in args: ## Reboot the script (in same context) -- cgit v1.2.3-70-g09d2 From 010e931aeb5ca40577e9e7db933c31b8fa594eb3 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 13 Nov 2019 22:48:33 +0000 Subject: Added debug --- archinstall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall.py') diff --git a/archinstall.py b/archinstall.py index 4c4fd116..35938763 100644 --- a/archinstall.py +++ b/archinstall.py @@ -338,7 +338,7 @@ def update_git(branch='master'): if branch != 'master': on_branch = simple_command('(cd /root/archinstall; git branch | grep "*" | cut -d\' \' -f 2)') if on_branch.strip().lower() != branch.strip().lower(): - print(f'[N] Changing branch to {branch}') + print(f'[N] Changing branch from {on_branch} to {branch}') output = simple_command(f'(cd /root/archinstall; git checkout {branch}; git pull)') print('[N] Rebooting the new branch') if not 'rebooted' in args: -- cgit v1.2.3-70-g09d2 From 211fdee511b0defabee12439344dfcade18863b9 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 13 Nov 2019 22:51:16 +0000 Subject: Fixed branch checking --- archinstall.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'archinstall.py') diff --git a/archinstall.py b/archinstall.py index 35938763..2222a511 100644 --- a/archinstall.py +++ b/archinstall.py @@ -336,8 +336,8 @@ def update_git(branch='master'): # if(num_changes): if branch != 'master': - on_branch = simple_command('(cd /root/archinstall; git branch | grep "*" | cut -d\' \' -f 2)') - if on_branch.strip().lower() != branch.strip().lower(): + on_branch = simple_command('(cd /root/archinstall; git branch | grep "*" | cut -d\' \' -f 2)').decode('UTF-8').strip() + if on_branch.lower() != branch.lower(): print(f'[N] Changing branch from {on_branch} to {branch}') output = simple_command(f'(cd /root/archinstall; git checkout {branch}; git pull)') print('[N] Rebooting the new branch') -- cgit v1.2.3-70-g09d2 From 51523a4e6a6a4e4a19364fbcd9728febbb6657c4 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 13 Nov 2019 22:57:28 +0000 Subject: Improved aibuilder for building yay --- archinstall.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'archinstall.py') diff --git a/archinstall.py b/archinstall.py index 2222a511..b58804f7 100644 --- a/archinstall.py +++ b/archinstall.py @@ -823,9 +823,9 @@ if __name__ == '__main__': o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "useradd -m -G wheel aibuilder"').exec()) o = b''.join(sys_command("/usr/bin/sed -i 's/# %wheel ALL=(ALL) NO/%wheel ALL=(ALL) NO/' /mnt/etc/sudoers").exec()) - o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "git clone https://aur.archlinux.org/yay.git"').exec()) - o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "chown -R aibuilder.aibuilder yay"').exec()) - o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "su - aibuilder -c \\"(cd /root/yay; makepkg -si --noconfirm)\\" >/dev/null"').exec()) + o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "su - aibuilder -c \\"(cd /home/aibuilder; git clone https://aur.archlinux.org/yay.git)"').exec()) + o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "chown -R aibuilder.aibuilder /home/aibuilder/yay"').exec()) + o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "su - aibuilder -c \\"(cd /home/aibuilder/yay; makepkg -si --noconfirm)\\" >/dev/null"').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "sed -i \'s/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/\' /mnt/etc/sudoers"').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "userdel aibuilder"').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "rm -rf /home/aibuilder"').exec()) -- cgit v1.2.3-70-g09d2 From a10965c13cbb903af3ff02b389bb3a3e415fea16 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 13 Nov 2019 23:02:01 +0000 Subject: Forgot ending " --- archinstall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall.py') diff --git a/archinstall.py b/archinstall.py index b58804f7..9171b55c 100644 --- a/archinstall.py +++ b/archinstall.py @@ -823,7 +823,7 @@ if __name__ == '__main__': o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "useradd -m -G wheel aibuilder"').exec()) o = b''.join(sys_command("/usr/bin/sed -i 's/# %wheel ALL=(ALL) NO/%wheel ALL=(ALL) NO/' /mnt/etc/sudoers").exec()) - o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "su - aibuilder -c \\"(cd /home/aibuilder; git clone https://aur.archlinux.org/yay.git)"').exec()) + o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "su - aibuilder -c \\"(cd /home/aibuilder; git clone https://aur.archlinux.org/yay.git)\\""').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "chown -R aibuilder.aibuilder /home/aibuilder/yay"').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "su - aibuilder -c \\"(cd /home/aibuilder/yay; makepkg -si --noconfirm)\\" >/dev/null"').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "sed -i \'s/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/\' /mnt/etc/sudoers"').exec()) -- cgit v1.2.3-70-g09d2 From 06873cbbea2276c45ea6f9f7ca9d10ac57bdacea Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 13 Nov 2019 23:08:07 +0000 Subject: Fixing sed command --- archinstall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall.py') diff --git a/archinstall.py b/archinstall.py index 9171b55c..0727d235 100644 --- a/archinstall.py +++ b/archinstall.py @@ -826,7 +826,7 @@ if __name__ == '__main__': o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "su - aibuilder -c \\"(cd /home/aibuilder; git clone https://aur.archlinux.org/yay.git)\\""').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "chown -R aibuilder.aibuilder /home/aibuilder/yay"').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "su - aibuilder -c \\"(cd /home/aibuilder/yay; makepkg -si --noconfirm)\\" >/dev/null"').exec()) - o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "sed -i \'s/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/\' /mnt/etc/sudoers"').exec()) + o = b''.join(sys_command('/usr/bin/sed -i \'s/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/\' /mnt/etc/sudoers').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "userdel aibuilder"').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "rm -rf /home/aibuilder"').exec()) -- cgit v1.2.3-70-g09d2 From dad1e444c0d6f592ab3c97e49f698d163490170f Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 13 Nov 2019 23:16:16 +0000 Subject: Added debug output for the AUR step --- archinstall.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'archinstall.py') diff --git a/archinstall.py b/archinstall.py index 0727d235..74f69320 100644 --- a/archinstall.py +++ b/archinstall.py @@ -820,6 +820,7 @@ if __name__ == '__main__': entry.write('options cryptdevice=UUID={UUID}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n'.format(UUID=UUID)) if args['aur-support']: + print('[N] AUR support demanded, building "yay" before running POST steps.') o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "useradd -m -G wheel aibuilder"').exec()) o = b''.join(sys_command("/usr/bin/sed -i 's/# %wheel ALL=(ALL) NO/%wheel ALL=(ALL) NO/' /mnt/etc/sudoers").exec()) @@ -829,6 +830,7 @@ if __name__ == '__main__': o = b''.join(sys_command('/usr/bin/sed -i \'s/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/\' /mnt/etc/sudoers').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "userdel aibuilder"').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "rm -rf /home/aibuilder"').exec()) + print('[N] AUR support added. use "yay -Syy --noconfirm " to deploy in POST.') conf = {} if 'post' in instructions: -- cgit v1.2.3-70-g09d2 From 9774daa2b6bcf353d16510dc69194f4bf502f2ce Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 13 Nov 2019 23:26:49 +0000 Subject: Improving tracelog output on error --- archinstall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall.py') diff --git a/archinstall.py b/archinstall.py index 74f69320..18ad9f22 100644 --- a/archinstall.py +++ b/archinstall.py @@ -259,8 +259,8 @@ class sys_command(): exit_code = os.waitpid(self.pid, 0)[1] if exit_code != 0: + print(trace_log.decode('UTF-8')) print('[E] Command "{}" on line ~150 exited with status code:'.format(self.cmd[0]), exit_code) - print(trace_log) print('[?] Command executed: {}'.format(self.cmd)) exit(1) -- cgit v1.2.3-70-g09d2 From da008c6284b36255aaca3caa4b368d7b1c44de0d Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 13 Nov 2019 23:36:22 +0000 Subject: Adding runas in options to POST commands. To be able to run AUR commands as a certain user since yay refuses to build as root --- archinstall.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'archinstall.py') diff --git a/archinstall.py b/archinstall.py index 18ad9f22..10266545 100644 --- a/archinstall.py +++ b/archinstall.py @@ -827,9 +827,10 @@ if __name__ == '__main__': o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "su - aibuilder -c \\"(cd /home/aibuilder; git clone https://aur.archlinux.org/yay.git)\\""').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "chown -R aibuilder.aibuilder /home/aibuilder/yay"').exec()) o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "su - aibuilder -c \\"(cd /home/aibuilder/yay; makepkg -si --noconfirm)\\" >/dev/null"').exec()) - o = b''.join(sys_command('/usr/bin/sed -i \'s/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/\' /mnt/etc/sudoers').exec()) - o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "userdel aibuilder"').exec()) - o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "rm -rf /home/aibuilder"').exec()) + ## Do not remove aibuilder just yet, can be used later for aur packages. + #o = b''.join(sys_command('/usr/bin/sed -i \'s/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/\' /mnt/etc/sudoers').exec()) + #o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "userdel aibuilder"').exec()) + #o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "rm -rf /home/aibuilder"').exec()) print('[N] AUR support added. use "yay -Syy --noconfirm " to deploy in POST.') conf = {} @@ -852,6 +853,7 @@ if __name__ == '__main__': if type(conf[title]) == str: print('[N] Loading {} configuration'.format(conf[title])) conf[title] = get_application_instructions(conf[title]) + for command in conf[title]: raw_command = command opts = conf[title][command] if type(conf[title][command]) in (dict, oDict) else {} @@ -870,6 +872,10 @@ if __name__ == '__main__': if 'pass-args' in opts and opts['pass-args']: command = command.format(**args) + if 'runas' in opts and f'su - {opts["runas"]} -c' not in command: + command = command.replace('"', '\\"') + command = f'su - {opts["runas"]} -c "{command}"' + #print('[N] Command: {} ({})'.format(command, opts)) ## https://superuser.com/questions/1242978/start-systemd-nspawn-and-execute-commands-inside @@ -925,6 +931,11 @@ if __name__ == '__main__': print('[W] Post install command failed: {}'.format(o.decode('UTF-8'))) #print(o) + if args['aur-support']: + o = b''.join(sys_command('/usr/bin/sed -i \'s/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/\' /mnt/etc/sudoers').exec()) + o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "userdel aibuilder"').exec()) + o = b''.join(sys_command('/usr/bin/arch-chroot /mnt sh -c "rm -rf /home/aibuilder"').exec()) + ## == Passwords # o = sys_command('arch-chroot /mnt usermod --password {} root'.format(args['password'])) # o = sys_command("arch-chroot /mnt sh -c 'echo {pin} | passwd --stdin root'".format(pin='"{pin}"'.format(**args, pin=args['password'])), echo=True) -- cgit v1.2.3-70-g09d2