comparison sbin/fpkg @ 169:cc4117f5f4bd

Implemented an "uversion" command: get the userspace FreeBSD-version of the host and all runnings jails
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 17 Dec 2020 08:43:41 +0100
parents c85245833476
children 58ad548487c4
comparison
equal deleted inserted replaced
168:c85245833476 169:cc4117f5f4bd
52 config <name> 52 config <name>
53 53
54 Retrieve the value of a given configuration opeion on the local host 54 Retrieve the value of a given configuration opeion on the local host
55 and all running visible jails 55 and all running visible jails
56 56
57 uversion
58
59 Call `freebsd-version -u` on the local host and all running visible
60 jails
61
57 vv 62 vv
58 63
59 `pkg -vv` on the local host and all running visible jails 64 `pkg -vv` on the local host and all running visible jails
60 65
61 ENVIRONMENT: 66 ENVIRONMENT:
128 _jail_version=$(jexec -l "${_jail}" /bin/freebsd-version -u) || exit 1 133 _jail_version=$(jexec -l "${_jail}" /bin/freebsd-version -u) || exit 1
129 if [ "${_host_version%%-*}" = "${_jail_version%%-*}" ]; then 134 if [ "${_host_version%%-*}" = "${_jail_version%%-*}" ]; then
130 return 0 135 return 0
131 fi 136 fi
132 return 1 137 return 1
138 }
139
140
141 command_uversion() {
142 : ' Do a local `freebsd-version -u` and also for all running jails
143
144 '
145 echo "LOCALHOST: $(/bin/freebsd-version -u)"
146 for _jail in $(jls -N | awk '{if(NR>1)print $1}' | sort); do
147 echo "${_jail}: $(jexec -l "${_jail}" /bin/freebsd-version -u)"
148 done
133 } 149 }
134 150
135 151
136 command_audit() { 152 command_audit() {
137 : 'Do a local `pkg audit -Fr` and also for all running jails 153 : 'Do a local `pkg audit -Fr` and also for all running jails
346 command_check_fasttrack "$@" 362 command_check_fasttrack "$@"
347 ;; 363 ;;
348 config) 364 config)
349 command_config "$@" 365 command_config "$@"
350 ;; 366 ;;
367 uversion)
368 command_uversion "$@"
369 ;;
351 vv) 370 vv)
352 command_vv "$@" 371 command_vv "$@"
353 ;; 372 ;;
354 *) 373 *)
355 echo "ERROR: unknown command \`${command}'" >&2 374 echo "ERROR: unknown command \`${command}'" >&2