changelog shortlog graph tags branches files raw help

Mercurial > core / changeset: init systemd

changeset 590: 71c05868c4e7
parent 589: 16a3cdc06cbc
child 591: f9279a1f2347
author: Richard Westhaver <ellis@rwest.io>
date: Mon, 12 Aug 2024 21:44:58 -0400
files: lisp/lib/cli/tools/pkg.lisp lisp/lib/cli/tools/systemd.lisp
description: init systemd
     1.1--- a/lisp/lib/cli/tools/pkg.lisp	Mon Aug 12 21:16:14 2024 -0400
     1.2+++ b/lisp/lib/cli/tools/pkg.lisp	Mon Aug 12 21:44:58 2024 -0400
     1.3@@ -40,7 +40,8 @@
     1.4 
     1.5 (defpackage :cli/tools/systemd
     1.6   (:use :cl :std :cli/env)
     1.7-  (:export :*systemctl* :run-systemd :run-systemctl))
     1.8+  (:export :*systemctl* :run-systemd :run-systemctl
     1.9+           :systemd-error))
    1.10 
    1.11 (defpackage :cli/tools/cargo
    1.12   (:use :cl :std :cli/env)
     2.1--- a/lisp/lib/cli/tools/systemd.lisp	Mon Aug 12 21:16:14 2024 -0400
     2.2+++ b/lisp/lib/cli/tools/systemd.lisp	Mon Aug 12 21:44:58 2024 -0400
     2.3@@ -4,3 +4,20 @@
     2.4 
     2.5 ;;; Code:
     2.6 (in-package :cli/tools/systemd)
     2.7+
     2.8+(deferror systemd-error (simple-error error) ())
     2.9+
    2.10+(defun systemd-error (fmt &rest args)
    2.11+  (error 'systemd-error :format-arguments args :format-control fmt))
    2.12+
    2.13+(defparameter *systemctl* (find-exe "systemctl"))
    2.14+
    2.15+(defun run-systemctl (&rest args)
    2.16+  (let ((proc (sb-ext:run-program *systemctl* (or args nil) :output :stream)))
    2.17+    (with-open-stream (s (sb-ext:process-output proc))
    2.18+      (loop for l = (read-line s nil nil)
    2.19+            while l
    2.20+            do (write-line l)))
    2.21+    (if (eq 0 (sb-ext:process-exit-code proc))
    2.22+        nil
    2.23+        (systemd-error "SYSTEMCTL command failed: ~A ~A" *systemctl* (or args "")))))