changeset 686:bda643a6310e

fpkg: Implement the "etcupdate-status" command
author Franz Glasner <fzglas.hg@dom66.de>
date Tue, 01 Oct 2024 14:49:40 +0200
parents 918932936c68
children 5156eaa27ac9
files docs/man/man8/fpkg.rst sbin/fpkg
diffstat 2 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/docs/man/man8/fpkg.rst	Tue Oct 01 14:25:34 2024 +0200
+++ b/docs/man/man8/fpkg.rst	Tue Oct 01 14:49:40 2024 +0200
@@ -58,6 +58,11 @@
     option on the local host and all running visible and
     compatible jails (:command:`pkg config`).
 
+:manpage:`fpkg-etcupdate-status(8)`
+
+    Call :command:`etcupdate status` on the local host and all running
+    visible jails.
+
 :manpage:`fpkg-update(8)`
 
     Call :command:`pkg update` on the local host and all running
--- a/sbin/fpkg	Tue Oct 01 14:25:34 2024 +0200
+++ b/sbin/fpkg	Tue Oct 01 14:49:40 2024 +0200
@@ -34,6 +34,11 @@
     `pkg audit` on the local host and all running visible and
     compatible jails
 
+  etcupdate-status
+
+    Call `etcupdate status` on the local host and in all running visible
+    jails
+
   update
 
     `pkg update` on the local host and all running visible and
@@ -320,6 +325,24 @@
 }
 
 
+command_etcupdate_status() {
+    : 'Call `etcupdate status` on the host and all running jails
+
+    '
+    local _j _OLDIFS
+    
+    printf '%sLOCALHOST\n' "${FPKG_SIGN}"
+    /usr/sbin/etcupdate status
+    _OLDIFS="${IFS}"
+    IFS=$'\n'
+    for _j in $(/usr/sbin/jls name | /usr/bin/sort); do
+        printf '\n%sJAIL: %s\n' "${FPKG_SIGN}" "${_j}"
+        LC_ALL=C.UTF-8 /usr/sbin/jexec -- "${_j}" /usr/sbin/etcupdate status
+    done
+    IFS="${_OLDIFS}"
+}
+
+
 #
 # Global option handling
 #
@@ -359,6 +382,9 @@
     audit)
         command_audit "$@"
         ;;
+    etcupdate-status|etcupdate_status|status-etcupdate|status_etcupdate)
+        command_etcupdate_status "$@"
+        ;;
     update)
         command_update "$@"
         ;;