mirror of
https://github.com/Foltik/dotfiles
synced 2025-02-25 17:00:07 -05:00
Reorganize deploy
This commit is contained in:
parent
4984a66e5e
commit
2cd2015210
@ -1,8 +1,12 @@
|
|||||||
import os
|
import os
|
||||||
import distutils
|
import distutils
|
||||||
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import lib.pacman as pacman
|
|
||||||
from lib.package import Package
|
from lib.package import Package
|
||||||
|
import lib.proc as proc
|
||||||
|
import lib.pacman as pacman
|
||||||
|
import lib.yay as yay
|
||||||
|
import lib.git as git
|
||||||
|
|
||||||
installed_packages = pacman.get_installed()
|
installed_packages = pacman.get_installed()
|
||||||
|
|
||||||
@ -13,48 +17,64 @@ 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_item(path):
|
def import_path(paths):
|
||||||
copy(Path('~') / path, Path('./lain') / path)
|
if not isinstance(paths, list):
|
||||||
|
paths = [paths]
|
||||||
|
for path in paths:
|
||||||
|
copy(Path('~') / path, Path('./lain') / path)
|
||||||
|
|
||||||
def export_item(path):
|
def export_path(paths):
|
||||||
copy(Path('./lain') / path, Path('~') / path)
|
if not isinstance(paths, list):
|
||||||
|
paths = [paths]
|
||||||
|
for path in paths:
|
||||||
|
copy(Path('./lain') / path, Path('~') / path)
|
||||||
|
|
||||||
def install(package):
|
def install(package):
|
||||||
if not package.install or not package.source:
|
if not package.install or not package.source:
|
||||||
return
|
return
|
||||||
if package.source == 'core' and package.name not in installed_packages:
|
if package.source == 'core':# and package.name not in installed_packages:
|
||||||
res = pacman.install(package.name)
|
print('pacman', package.name)
|
||||||
|
#pacman.install(package.name)
|
||||||
|
elif package.source == 'aur':# and package.name not in installed_packages:
|
||||||
|
print('yay', package.name)
|
||||||
|
#yay.install(package.name)
|
||||||
|
elif package.source == 'git':
|
||||||
|
print('git', package.name)
|
||||||
|
#git.clone(package.url, 'git/' + package.name)
|
||||||
|
|
||||||
|
|
||||||
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_item(package.config)
|
|
||||||
|
|
||||||
def import_config(package):
|
def import_config(package):
|
||||||
if not package.config:
|
if not package.config:
|
||||||
return
|
return
|
||||||
|
import_path(package.config)
|
||||||
import_item(package.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)
|
||||||
|
#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.userunits:
|
||||||
return
|
return
|
||||||
|
export_path(package.userunits)
|
||||||
for unit in package.userunits:
|
|
||||||
export_item(unit)
|
|
||||||
|
|
||||||
def import_units(package):
|
def import_units(package):
|
||||||
if not package.userunits:
|
if not package.userunits:
|
||||||
return
|
return
|
||||||
|
import_path(package.userunits)
|
||||||
|
|
||||||
|
def enable_units(package):
|
||||||
|
if not package.enable_units or not package.userunits:
|
||||||
|
return
|
||||||
for unit in package.userunits:
|
for unit in package.userunits:
|
||||||
import_item(unit)
|
print('systemctl --user enable', unit.name)
|
||||||
|
#proc.exec(['systemctl', '--user', 'enable', unit.name])
|
||||||
|
|
||||||
def deploy(package):
|
def deploy(package):
|
||||||
if not package.enabled:
|
if not package.enabled:
|
||||||
|
Loading…
Reference in New Issue
Block a user