Skip to content

Commit

Permalink
cbuild: implement service linter
Browse files Browse the repository at this point in the history
  • Loading branch information
nekopsykose committed Jul 27, 2024
1 parent ec6a8d2 commit fefddbb
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/cbuild/hooks/post_install/199_lint_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from cbuild.core.chroot import host_path_to_chroot


def invoke(pkg):
# we skip dinitcheck on base-cbuild until we're done bootstrapping
if pkg.stage < 2:
return

syspath = "etc/dinit.d"
userpath = "etc/dinit.d/user"

dservicepaths = []

if (dsyspath := pkg.destdir / syspath).is_dir():
dservicepaths.extend(dsyspath.iterdir())
if (duserpath := pkg.destdir / userpath).is_dir():
dservicepaths.extend(duserpath.iterdir())

for dservicepath in dservicepaths:
if dservicepath.is_dir() or dservicepath.is_symlink():
continue
cdservicepath = host_path_to_chroot(dservicepath)
pkg.do(
"dinitcheck",
"--user" if cdservicepath.parent.name == "user" else "--system",
"--services-dir",
cdservicepath.parent,
cdservicepath.name,
)

0 comments on commit fefddbb

Please sign in to comment.