Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2019-11-14 00:12:04 +0000
committerAnton Hvornum <anton.feeds+github@gmail.com>2019-11-14 00:12:04 +0000
commitb13d9c964bc487b71a4f7c3a63b0510210373c9d (patch)
tree904cb27f2408cabdb0821e8209c34b210937068c
parent2abef082a7d037a0e0f6414ca75a9030c43c3e42 (diff)
parent977c554124576c4c2782d1784a45af1ee0d7d56e (diff)
Merge branch 'master' of github.com:Torxed/archinstall into experimental
-rw-r--r--README.md2
-rw-r--r--archinstall.py40
-rw-r--r--deployments/workstation_aur.json2
3 files changed, 33 insertions, 11 deletions
diff --git a/README.md b/README.md
index 5d9cb242..1df05748 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ This will start a guided install. Add `--default` for unattended.
## Run on Live-CD (Binary)
- # wget https://gzip.life/archinstall
+ # wget https://gzip.app/archinstall
# chmod +x archinstall; ./archinstall
# Features
diff --git a/archinstall.py b/archinstall.py
index e65a5a02..10266545 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)
@@ -336,8 +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)')
+ 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')
+ 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)
@@ -763,6 +770,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())
@@ -811,15 +820,18 @@ 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())
- 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())
+ 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())
+ ## 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 <package>" to deploy in POST.')
conf = {}
if 'post' in instructions:
@@ -841,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 {}
@@ -859,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
@@ -914,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)
diff --git a/deployments/workstation_aur.json b/deployments/workstation_aur.json
index f64a794f..d3c26672 100644
--- a/deployments/workstation_aur.json
+++ b/deployments/workstation_aur.json
@@ -23,7 +23,7 @@
"pacman -Syy --noconfirm {_webbrowser} {_utils} {_mediaplayer} {_window_manager} {_window_manager_dependencies} {_window_manager_utilities} {_virtulization} {_filebrowser} {_editor}" : {"pass-args" : true}
},
"Install aur packages" : {
- "yay -Syy --noconfirm {_code_editor}" : {"pass-args" : true}
+ "yay -Syy --noconfirm {_code_editor}" : {"pass-args" : true, "runas" : "aibuilder"}
},
"Setup virtulization" : {
"sh -c \"Description=\\\"Bridge for virtual machines\\\"\nInterface=br0\nConnection=bridge\nBindsToInterfaces=(eno1)\nIP=no\nExecUpPost=\\\"ip link set dev br0 address $(cat /sys/class/net/eno1/address); IP=dhcp; ip_set\\\"\nExecDownPre=\\\"IP=dhcp\\\"\n\n## Ignore (R)STP and immediately activate the bridge\nSkipForwardingDelay=yes\"" : null