Commit 30fcd8ad974ddc3bbcc8d521c7023d6abdfcc11d

Thomas de Grivel 2023-02-17T12:40:28

NetBSD

diff --git a/cl-unix-cybernetics.asd b/cl-unix-cybernetics.asd
index 67f7d35..35fde8f 100644
--- a/cl-unix-cybernetics.asd
+++ b/cl-unix-cybernetics.asd
@@ -62,6 +62,7 @@
 	     (:file "linux" :depends-on ("commands" "defs"))
 	     (:file "openbsd" :depends-on ("commands" "defs"))
 	     (:file "freebsd" :depends-on ("commands" "defs"))
+	     (:file "netbsd" :depends-on ("commands" "defs"))
 	     (:file "darwin" :depends-on ("commands" "defs"))
 	     (:file "operations" :depends-on ("commands" "defs"))
 	     (:file "probes"  :depends-on ("commands" "defs"
diff --git a/core/os.lisp b/core/os.lisp
index fac96dd..72f338c 100644
--- a/core/os.lisp
+++ b/core/os.lisp
@@ -46,6 +46,7 @@
 
 (defclass os-bsd (os-unix) ())
 (defclass os-freebsd (os-bsd) ())
+(defclass os-netbsd (os-bsd) ())
 (defclass os-openbsd (os-bsd) ())
 (defclass os-darwin (os-bsd) ())
 
diff --git a/package.lisp b/package.lisp
index 98b7401..31d6d9d 100644
--- a/package.lisp
+++ b/package.lisp
@@ -95,6 +95,7 @@
    #:os-linux-debian
    #:os-machine
    #:os-name
+   #:os-netbsd
    #:os-openbsd
    #:os-release
    #:os-unix
diff --git a/unix/freebsd.lisp b/unix/freebsd.lisp
index b9b7c23..9b117d6 100644
--- a/unix/freebsd.lisp
+++ b/unix/freebsd.lisp
@@ -61,6 +61,7 @@
                                                          realname home shell
                                                          login-class
                                                          groups)
+  (sync-groups)
   (run-as-root
    (join-str " "
              (ecase ensure
diff --git a/unix/netbsd.lisp b/unix/netbsd.lisp
new file mode 100644
index 0000000..a7920ed
--- /dev/null
+++ b/unix/netbsd.lisp
@@ -0,0 +1,40 @@
+;; cl-unix-cybernetics
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
+;;
+;; Permission is hereby granted to use this software granted
+;; the above copyright notice and this permission paragraph
+;; are included in all copies and substantial portions of this
+;; software.
+;;
+;; THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+;; PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+;; AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+;; THIS SOFTWARE.
+
+(in-package :cl-unix-cybernetics)
+
+(in-re-readtable)
+
+(defmethod run-as-root-command ((host t) (os os-netbsd))
+  "sudo ")
+
+(defmethod probe-hostname ((host host) (os os-netbsd))
+  (list :hostname (run-1 "hostname -s")))
+
+#+nil
+(clear-resources)
+
+#+nil
+(describe-probed (resource 'netbsd-pkg "emacs"))
+
+#+nil
+(probe-host-packages *host* (host-os *host*))
+
+#+nil
+(probe *host* :packages)
+
+#+nil
+(map nil #'describe-probed (probe-installed-packages))
+
+#+nil
+(run "pkg_info -q | grep emacs-")