1
0
mirror of https://github.com/Foltik/dotfiles synced 2024-11-30 14:32:08 -05:00

Rename configure to deploy and add wip import/export stuff

This commit is contained in:
Jack Foltz 2018-12-08 19:01:28 -05:00
parent 9644b3f076
commit a28ed01fde
Signed by: foltik
GPG Key ID: D1F0331758D1F29A
2 changed files with 66 additions and 35 deletions

View File

@ -1,35 +0,0 @@
import os
from pathlib import Path
import lib.pacman as pacman
from lib.package import Package
installed_packages = pacman.get_installed()
def install(package):
if not package.install or not package.source:
return
if package.source == 'core' and package.name not in installed_packages:
res = pacman.install(package.name)
def copy_config(package):
if not package.copy_config or not package.config:
return
def run_script(package):
if not package.run_script or not package.script:
return
def enable_units(package):
if not package.enable_units or not package.userunits:
return
def configure(package):
if not package.enabled:
return
#print(vars(package))
install(package)
copy_config(package)
run_script(package)
enable_units(package)

66
lib/deploy.py Normal file
View File

@ -0,0 +1,66 @@
import os
import distutils
from pathlib import Path
import lib.pacman as pacman
from lib.package import Package
installed_packages = pacman.get_installed()
def copy(source, dest):
print(source, '->', dest)
if source.is_dir():
pass#distutils.dir_util.copy_tree(source.absolute(), dest.absolute())
else:
pass#distutils.file_util.copy_file(source.absolute(), dest.absolute())
def import_item(path):
copy(Path('~') / path, Path('./lain') / path)
def export_item(path):
copy(Path('./lain') / path, Path('~') / path)
def install(package):
if not package.install or not package.source:
return
if package.source == 'core' and package.name not in installed_packages:
res = pacman.install(package.name)
def export_config(package):
if not package.export_config or not package.config:
return
export_item(package.config)
def import_config(package):
if not package.config:
return
import_item(package.config)
def run_script(package):
if not package.run_script or not package.script:
return
def export_units(package):
if not package.export_units or not package.userunits:
return
for unit in package.userunits:
export_item(unit)
def import_units(package):
if not package.userunits:
return
for unit in package.userunits:
import_item(unit)
def deploy(package):
if not package.enabled:
return
install(package)
export_config(package)
run_script(package)
export_units(package)