mirror of
https://github.com/Foltik/dotfiles
synced 2024-11-27 21:19:51 -05:00
Rename configure to deploy and add wip import/export stuff
This commit is contained in:
parent
9644b3f076
commit
a28ed01fde
@ -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
66
lib/deploy.py
Normal 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)
|
||||
|
Loading…
Reference in New Issue
Block a user