diff --git a/lib/deploy.py b/lib/deploy.py index 45c0eef..8bca1a8 100644 --- a/lib/deploy.py +++ b/lib/deploy.py @@ -6,6 +6,7 @@ import lib.proc as proc import lib.pacman as pacman import lib.yay as yay import lib.git as git +import lib.systemd as systemd from lib.diff import diff from lib.fish import fish @@ -91,7 +92,7 @@ def enable_units(package): return for unit in package.userunit: print('systemctl --user enable', unit.name) - #proc.exec(['systemctl', '--user', 'enable', unit.name]) + systemd.enable(unit.name, True) def deploy(package): diff --git a/lib/systemd.py b/lib/systemd.py new file mode 100644 index 0000000..3fe1b07 --- /dev/null +++ b/lib/systemd.py @@ -0,0 +1,10 @@ +import lib.proc as proc + +def enable(unit, user): + flags = (['--user'] if user else []) + ['enable', unit] + output = systemd(flags) + +def systemd(flags): + cmd = ['systemctl'] + flags + subproc = proc.exec(cmd) + return proc.communicate(subproc, cmd) diff --git a/lib/yay.py b/lib/yay.py index 9a790e9..698658e 100644 --- a/lib/yay.py +++ b/lib/yay.py @@ -1,12 +1,12 @@ import lib.proc as proc def install(package): - output = yay(['-S', package], True) + output = yay(['-S', package]) def install_all(packages): - output = yay(['-S'] + packages, True) + output = yay(['-S'] + packages) -def yay(flags, sudo = False): +def yay(flags): cmd = ['yay', '--noconfirm'] + flags - subproc = proc.sudo(cmd) if sudo else proc.exec(cmd) + subproc = proc.exec(cmd) return proc.communicate(subproc, cmd)