changeset 146:0e140f349924

- Provide a "vv" command on the host and in all running compatible jails: pkg -vv - Provide a "config <name>" command on the host and in all running compatible jails: pkg -vv
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 31 Oct 2019 09:02:30 +0100
parents c4e9099a3d3e
children 41fe82b4a5b0
files sbin/fpkg
diffstat 1 files changed, 65 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sbin/fpkg	Wed Oct 30 21:13:00 2019 +0100
+++ b/sbin/fpkg	Thu Oct 31 09:02:30 2019 +0100
@@ -49,6 +49,15 @@
     the repositories `FreeBSD` and `LocalBSDPorts` on the local host
     and all visible jails
 
+  config <name>
+
+    Retrieve the valud of a given configuration opeion on the local host
+    and all running visible jails
+
+  vv
+
+   `pkg -vv` on the local host and all running visible jails
+
 ENVIRONMENT:
 
   FPKG_AUDIT_FLAGS
@@ -235,6 +244,56 @@
 }
 
 
+command_config() {
+    : 'The `pkg config name` command on the host and all running
+    compatible jails
+
+    Args:
+        _name: the configuration option to retrieve to
+
+    '
+    local _name
+
+    _name="$1"
+
+    if [ -z "${_name}" ]; then
+        echo "Usage: fpkg config <name>" >&2
+        return 1
+    fi
+    echo "${FPKG_SIGN}LOCALHOST"
+    pkg config "${_name}"
+    for _j in $(jls -N | awk '{if(NR>1)print $1}' | sort); do
+        echo ""
+        echo "${FPKG_SIGN}JAIL: ${_j}"
+        if has_same_userland_version "${_j}"; then
+            # This prints the value on the *host* also
+            #pkg -j "${_j}" config "${_name}"
+            jexec "${_j}" pkg config "${_name}"
+        else
+            echo "${FPKG_SKIPSIGN}SKIPPED because of different userland"
+        fi
+    done
+}
+
+
+command_vv() {
+    : 'The `pkv -vv` command on the host and all running compatible jails
+
+    '
+    echo "${FPKG_SIGN}LOCALHOST"
+    pkg -vv
+    for _j in $(jls -N | awk '{if(NR>1)print $1}' | sort); do
+        echo ""
+        echo "${FPKG_SIGN}JAIL: ${_j}"
+        if has_same_userland_version "${_j}"; then
+            pkg -j "${_j}" -vv
+        else
+            echo "${FPKG_SKIPSIGN}SKIPPED because of different userland"
+        fi
+    done
+}
+
+
 #
 # Global option handling
 #
@@ -286,6 +345,12 @@
     check-fast-track|check-fasttrack|check_fast_track|check_fasttrack)
         command_check_fasttrack "$@"
         ;;
+    config)
+        command_config "$@"
+        ;;
+    vv)
+        command_vv "$@"
+        ;;
     *)
         echo "ERROR: unknown command \`${command}'" >&2
         exit 2;