1
0
mirror of https://github.com/Foltik/dotfiles synced 2025-02-15 05:27:16 -05:00
dotfiles/lib/configure.py

36 lines
842 B
Python
Raw Normal View History

2018-12-05 16:51:19 -05:00
import os
from pathlib import Path
2018-12-06 01:31:23 -05:00
import lib.pacman as pacman
from lib.package import Package
2018-12-05 16:51:19 -05:00
2018-12-06 01:31:23 -05:00
installed_packages = pacman.get_installed()
2018-12-01 14:24:43 -05:00
2018-12-05 16:51:19 -05:00
def install(package):
2018-12-06 01:31:23 -05:00
if not package.install or not package.source:
2018-12-05 16:51:19 -05:00
return
2018-12-06 01:31:23 -05:00
if package.source == 'core' and package.name not in installed_packages:
res = pacman.install(package.name)
2018-12-05 16:51:19 -05:00
def copy_config(package):
2018-12-06 01:31:23 -05:00
if not package.copy_config or not package.config:
2018-12-05 16:51:19 -05:00
return
def run_script(package):
2018-12-06 01:31:23 -05:00
if not package.run_script or not package.script:
2018-12-05 16:51:19 -05:00
return
def enable_units(package):
2018-12-06 01:31:23 -05:00
if not package.enable_units or not package.userunits:
2018-12-05 16:51:19 -05:00
return
2018-12-01 14:24:43 -05:00
def configure(package):
2018-12-06 01:31:23 -05:00
if not package.enabled:
return
#print(vars(package))
2018-12-05 16:51:19 -05:00
install(package)
copy_config(package)
run_script(package)
enable_units(package)