Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-07-22 14:19:41 +0000
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-07-22 14:19:41 +0000
commit6c5c24ecefb8512a77225d772d2758391ed5b54f (patch)
tree80457932e0386a4378efc0e76f81b78c44dca635 /archinstall/lib
parent0cd088572d4c9a45711eb7a358cb4c2edd98e450 (diff)
Added a function to the installer, also added a function to make it easier to enable it in a installation, after which can be called.
Diffstat (limited to 'archinstall/lib')
-rw-r--r--archinstall/lib/installer.py28
1 files changed, 25 insertions, 3 deletions
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 9247c635..3310c335 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -91,10 +91,10 @@ class Installer():
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} ln -s /usr/share/zoneinfo/{zone} /etc/localtime'))
return True
- def run_command(self, cmd):
+ def run_command(self, cmd, *args, **kwargs):
return sys_command(f'/usr/bin/arch-chroot {self.mountpoint} {cmd}')
- def arch_chroot(self, cmd):
+ def arch_chroot(self, cmd, *args, **kwargs):
return self.run_command(cmd)
def minimal_installation(self):
@@ -196,4 +196,26 @@ class Installer():
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} sh -c "chown -R aibuilder.aibuilder /home/aibuilder/yay"'))
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} sh -c "su - aibuilder -c \\"(cd /home/aibuilder/yay; makepkg -si --noconfirm)\\" >/dev/null"'))
- o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} sh -c "userdel aibuilder; rm -rf /hoem/aibuilder"')) \ No newline at end of file
+ o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} sh -c "userdel aibuilder; rm -rf /hoem/aibuilder"'))
+ o = b''.join(sys_command(f"/usr/bin/sed -i 's/^%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/' {self.mountpoint}/etc/sudoers"))
+
+ def yay(self, *packages, **kwargs):
+ if type(packages[0]) in (list, tuple): packages = packages[0]
+ log(f'Installing AUR packages: {packages}')
+
+ if (sync_mirrors := sys_command('/usr/bin/pacman -Syy')).exit_code == 0:
+ o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} sh -c "useradd -m -G wheel aibuilder"'))
+ o = b''.join(sys_command(f"/usr/bin/sed -i 's/# %wheel ALL=(ALL) NO/%wheel ALL=(ALL) NO/' {self.mountpoint}/etc/sudoers"))
+
+ o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} sh -c "su - aibuilder -c \\"/usr/bin/yay -S --noconfirm {" ".join(packages)}\\" >/dev/null"'))
+
+ o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} sh -c "userdel aibuilder; rm -rf /hoem/aibuilder"'))
+ o = b''.join(sys_command(f"/usr/bin/sed -i 's/^%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/' {self.mountpoint}/etc/sudoers"))
+
+ return True
+ else:
+ log(f'Could not sync mirrors: {sync_mirrors.exit_code}')
+
+
+ def add_AUR_packages(self, *packages):
+ return self.yay(*packages) \ No newline at end of file