Skip to content

Commit

Permalink
Deploy systemd units
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAssassin committed Nov 27, 2024
1 parent 6beb5f1 commit b29b359
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ldnp/abstractpackager.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ def find_cloudproviders_files(self) -> Iterable[Path]:
self.appdir_install_path / AppDir.CLOUDPROVIDERS_FILES_RELATIVE_LOCATION
)

def find_systemd_files(self) -> Iterable[Path]:
files = []

for systemd_path in AppDir.SYSTEMD_RELATIVE_LOCATIONS:
files += self._find_file_paths_in_directory(self.appdir_install_path / systemd_path)

return files

def copy_data_to_usr(self):
def create_relative_symlink(src: Path, dst: Path):
# to calculate the amount of parent directories we need to move up, we can't use relative_to directly
Expand Down Expand Up @@ -256,6 +264,9 @@ def deploy_file_as_is(path):
for cloudproviders_file in self.find_cloudproviders_files():
deploy_file_as_is(cloudproviders_file)

for systemd_file in self.find_systemd_files():
deploy_file_as_is(systemd_file)

def copy_appdir_contents(self):
if os.path.exists(self.appdir_install_path):
shutil.rmtree(self.appdir_install_path)
Expand Down
3 changes: 3 additions & 0 deletions ldnp/appdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class AppDir:
ICONS_RELATIVE_LOCATION = "usr/share/icons"
MIME_FILES_RELATIVE_LOCATION = "usr/share/mime"
CLOUDPROVIDERS_FILES_RELATIVE_LOCATION = "usr/share/cloud-providers"
SYSTEMD_RELATIVE_LOCATIONS = [
"usr/lib/systemd",
]

def __init__(self, path: str | os.PathLike):
self.path = Path(path)
Expand Down

0 comments on commit b29b359

Please sign in to comment.