1
0
mirror of https://github.com/Foltik/dotfiles synced 2024-11-28 05:27:06 -05:00

Fix package deploy

This commit is contained in:
Jack Foltz 2018-12-08 23:46:13 -05:00
parent cd475a4ac8
commit 72c6abb1b6
Signed by: foltik
GPG Key ID: D1F0331758D1F29A
2 changed files with 16 additions and 15 deletions

View File

@ -17,17 +17,17 @@ def copy(source, dest):
else: else:
pass#distutils.file_util.copy_file(source.absolute(), dest.absolute()) pass#distutils.file_util.copy_file(source.absolute(), dest.absolute())
def import_path(paths): def import_paths(paths, base):
if not isinstance(paths, list): if not isinstance(paths, list):
paths = [paths] paths = [paths]
for path in paths: for path in paths:
copy(Path('~') / path, Path('./lain') / path) copy(Path('~') / Path(base) / path, Path('lain') / Path(base) / path)
def export_path(paths): def export_paths(paths, base):
if not isinstance(paths, list): if not isinstance(paths, list):
paths = [paths] paths = [paths]
for path in paths: for path in paths:
copy(Path('./lain') / path, Path('~') / path) copy(Path('lain') / Path(base) / path, Path('~') / Path(base) / path)
def install(package): def install(package):
if not package.install or not package.source: if not package.install or not package.source:
@ -46,33 +46,34 @@ def install(package):
def export_config(package): def export_config(package):
if not package.export_config or not package.config: if not package.export_config or not package.config:
return return
export_path(package.config) export_paths(package.config, '.config')
def import_config(package): def import_config(package):
if not package.config: if not package.config:
return return
import_path(package.config) import_paths(package.config, '.config')
def run_script(package): def run_script(package):
if not package.run_script or not package.script: if not package.run_script or not package.script:
return return
print('fish', package.script) for script in package.script:
print('fish', script)
#proc.exec(['fish', package.script.absolute()]) #proc.exec(['fish', package.script.absolute()])
def export_units(package): def export_units(package):
if not package.export_units or not package.userunits: if not package.export_units or not package.userunit:
return return
export_path(package.userunits) export_paths(package.userunit, '.config/systemd/user')
def import_units(package): def import_units(package):
if not package.userunits: if not package.userunit:
return return
import_path(package.userunits) import_paths(package.userunit, 'lain/.config/systemd/user')
def enable_units(package): def enable_units(package):
if not package.enable_units or not package.userunits: if not package.enable_units or not package.userunit:
return return
for unit in package.userunits: for unit in package.userunit:
print('systemctl --user enable', unit.name) print('systemctl --user enable', unit.name)
#proc.exec(['systemctl', '--user', 'enable', unit.name]) #proc.exec(['systemctl', '--user', 'enable', unit.name])

View File

@ -57,7 +57,7 @@ class Package:
elif self[prop] == 'none': elif self[prop] == 'none':
self[prop] = None self[prop] = None
elif self[prop] != None: elif self[prop] != None:
self[prop] = Path(self[prop]) self[prop] = [Path(self[prop])]
elif (Path(basepath) / default_path).is_dir() or (Path(basepath) / default_path).is_file(): elif (Path(basepath) / default_path).is_dir() or (Path(basepath) / default_path).is_file():
self[prop] = [default_path] self[prop] = [default_path]
else: else: