Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
annotate sbin/fpkg @ 795:77da00746485
common.subr: Implement checkyesnovalue() and checkyesvalue() to check values instead of variables.
These are variants of checkyes() and checkyesno().
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 30 Oct 2024 15:29:54 +0100 |
| parents | 53d05f470f4a |
| children | e2f262ec2bf4 |
| rev | line source |
|---|---|
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
1 #!/bin/sh |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
2 # -*- indent-tabs-mode: nil; -*- |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
3 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
4 #: A pkg frontend for common operations that also operates in all |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
5 #: running jails. |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
6 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
7 #: :Author: Franz Glasner |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
8 #: :Copyright: (c) 2019-2024 Franz Glasner. |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
9 #: All rights reserved. |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
10 #: :License: BSD 3-Clause "New" or "Revised" License. |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
11 #: See LICENSE for details. |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
12 #: If you cannot find LICENSE see |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
13 #: <https://opensource.org/licenses/BSD-3-Clause> |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
14 #: :ID: @(#)@@SIMPLEVERSIONTAG@@ |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
15 #: |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
16 |
|
703
7126823e4d70
fpkg: FIX: The first shellcheck directive is not a module-level directive; place a dummy command before (":")
Franz Glasner <fzglas.hg@dom66.de>
parents:
696
diff
changeset
|
17 : # separator for shellcheck: no module-level directives below |
|
7126823e4d70
fpkg: FIX: The first shellcheck directive is not a module-level directive; place a dummy command before (":")
Franz Glasner <fzglas.hg@dom66.de>
parents:
696
diff
changeset
|
18 |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
19 |
|
643
4f2257ea7d0a
shellcheck: disable SC2034: VERSION appears unused...
Franz Glasner <fzglas.hg@dom66.de>
parents:
550
diff
changeset
|
20 # shellcheck disable=SC2034 # VERSION appears unused |
|
550
847ae246f3cc
Make the port really DATADIR and EXAMPLESDIR safe because the user may redefine DATADIR and EXAMPLESDIR.
Franz Glasner <fzglas.hg@dom66.de>
parents:
452
diff
changeset
|
21 VERSION='@@VERSION@@' |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
22 |
|
685
918932936c68
fpkg: handle some shellcheck issues
Franz Glasner <fzglas.hg@dom66.de>
parents:
684
diff
changeset
|
23 # shellcheck disable=SC2016 # no expansion |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
24 USAGE=' |
| 768 | 25 USAGE: fpkg [ OPTIONS ] COMMAND [ COMMAND-OPTIONS ] |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
26 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
27 OPTIONS: |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
28 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
29 -V Print the program name and version number to stdout and exit |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
30 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
31 -h Print this help message to stdout and exit |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
32 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
33 COMMANDS: |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
34 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
35 audit |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
36 |
|
319
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
37 `pkg audit` on the local host and all running visible and |
|
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
38 compatible jails |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
39 |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
40 etcupdate-status |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
41 |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
42 Call `etcupdate status` on the local host and in all running visible |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
43 jails |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
44 |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
45 update |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
46 |
|
319
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
47 `pkg update` on the local host and all running visible and |
|
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
48 compatible jails |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
49 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
50 upgrade |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
51 |
|
319
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
52 `pkg upgrade` on the local host and all running visible and |
|
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
53 compatible jails |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
54 |
|
129
4aeff9d5275d
The command upgrade-check ist now check-upgrade and aliased to the old spelling also
Franz Glasner <fzglas.hg@dom66.de>
parents:
128
diff
changeset
|
55 check-upgrade |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
56 upgrade-check |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
57 |
|
319
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
58 `pkg upgrade -n` on the local host and all running visible and |
|
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
59 compatible jails |
|
91
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
60 |
|
112
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
61 check-fast-track |
|
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
62 Check packages installed from the LocalBSDPorts repository against |
|
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
63 the repositories `FreeBSD` and `LocalBSDPorts` on the local host |
|
319
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
64 and all visible and compatible jails |
|
112
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
65 |
|
146
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
66 config <name> |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
67 |
| 320 | 68 Retrieve the value of a given configuration option on the local host |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
69 and all running visible jails |
|
146
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
70 |
|
169
cc4117f5f4bd
Implemented an "uversion" command: get the userspace FreeBSD-version of the host and all runnings jails
Franz Glasner <fzglas.hg@dom66.de>
parents:
168
diff
changeset
|
71 uversion |
|
cc4117f5f4bd
Implemented an "uversion" command: get the userspace FreeBSD-version of the host and all runnings jails
Franz Glasner <fzglas.hg@dom66.de>
parents:
168
diff
changeset
|
72 |
|
cc4117f5f4bd
Implemented an "uversion" command: get the userspace FreeBSD-version of the host and all runnings jails
Franz Glasner <fzglas.hg@dom66.de>
parents:
168
diff
changeset
|
73 Call `freebsd-version -u` on the local host and all running visible |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
74 jails |
|
169
cc4117f5f4bd
Implemented an "uversion" command: get the userspace FreeBSD-version of the host and all runnings jails
Franz Glasner <fzglas.hg@dom66.de>
parents:
168
diff
changeset
|
75 |
|
146
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
76 vv |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
77 |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
78 `pkg -vv` on the local host and all running visible jails |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
79 |
|
91
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
80 ENVIRONMENT: |
|
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
81 |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
82 FPKG_AUDIT_FLAGS |
|
91
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
83 Additional flags given to `pkg audit` |
|
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
84 (Default: -Fr) |
|
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
85 |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
86 FPKG_UPDATE_FLAGS |
|
91
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
87 Additional flags given to `pkg update` |
|
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
88 (Default: empty) |
|
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
89 |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
90 FPKG_UPGRADE_FLAGS |
|
91
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
91 Additional flags given to `pkg upgrade` and `pkg upgrade -n` |
|
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
92 (Default: empty) |
|
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
93 |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
94 FPKG_SIGN |
|
91
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
95 Marker for the begin of an output group (local host or jail) |
|
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
96 (Default: "===> ") |
|
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
97 |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
98 FPKG_SKIPSIGN |
| 98 | 99 Marker for the begin of a skipped output group |
| 100 (Default: "----> ") | |
| 101 | |
|
91
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
102 All other environment variables that affect `pkg` are effective also. |
|
319
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
103 |
|
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
104 A "compatible jail" is a jail that'"'"'s "freebsd-version -u" is the same |
|
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
105 as the host'"'"'s. |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
106 ' |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
107 |
|
696
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
108 |
|
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
109 _p_datadir='@@DATADIR@@' |
|
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
110 [ "${_p_datadir#@@DATADIR}" = '@@' ] && _p_datadir="$(dirname "$0")"/../share/local-bsdtools |
|
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
111 . "${_p_datadir}/common.subr" |
|
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
112 |
|
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
113 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
114 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
115 #: Configuration directory |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
116 #: |
|
685
918932936c68
fpkg: handle some shellcheck issues
Franz Glasner <fzglas.hg@dom66.de>
parents:
684
diff
changeset
|
117 : ${CONFIGDIR:="@@ETCDIR@@"} |
|
109
0bd594fb56f8
Read the tools.conf configuration file where appropriate
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
118 |
|
685
918932936c68
fpkg: handle some shellcheck issues
Franz Glasner <fzglas.hg@dom66.de>
parents:
684
diff
changeset
|
119 # shellcheck disable=SC1091 # not following... |
|
918932936c68
fpkg: handle some shellcheck issues
Franz Glasner <fzglas.hg@dom66.de>
parents:
684
diff
changeset
|
120 [ -r "${CONFIGDIR}/pkgtools.conf" ] && . "${CONFIGDIR}/pkgtools.conf" |
|
109
0bd594fb56f8
Read the tools.conf configuration file where appropriate
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
121 |
|
680
a63e689d0529
fpkg: For default variable values: use "=" instead of ":="
Franz Glasner <fzglas.hg@dom66.de>
parents:
643
diff
changeset
|
122 : ${FPKG_AUDIT_FLAGS="-Fr"} |
|
a63e689d0529
fpkg: For default variable values: use "=" instead of ":="
Franz Glasner <fzglas.hg@dom66.de>
parents:
643
diff
changeset
|
123 : ${FPKG_UPDATE_FLAGS=} |
|
a63e689d0529
fpkg: For default variable values: use "=" instead of ":="
Franz Glasner <fzglas.hg@dom66.de>
parents:
643
diff
changeset
|
124 : ${FPKG_UPGRADE_FLAGS=} |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
125 : ${FPKG_SIGN:='===> '} |
|
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
126 : ${FPKG_SKIPSIGN:='----> '} |
|
95
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
127 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
128 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
129 #: The official FreeBSD binary repository |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
130 #: |
|
112
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
131 : ${FREEBSD_REPO:=FreeBSD} |
|
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
132 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
133 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
134 #: Local repository with ports with default OPTIONS (i.e. unchanged) |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
135 #: but newer than the packages in the "FreeBSD" repository. |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
136 #: Some sort of a fast-track repository. |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
137 #: |
|
112
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
138 : ${LOCALBSDPORTS_REPO:=LocalBSDPorts} |
|
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
139 |
|
95
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
140 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
141 #: Check whether the jail `_jail` has the same FreeBSD userland version |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
142 #: as the host the the current process runs. |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
143 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
144 #: Args: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
145 #: $1 (str): the running jail (name or jail id) to check for |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
146 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
147 #: Returns: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
148 #: int: 0 (truthy) if the userland versions match, 1 (falsy) otherwise |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
149 #: |
|
95
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
150 has_same_userland_version() { |
|
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
151 local _jail _host_version _jail_version |
|
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
152 |
|
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
153 _jail="$1" |
|
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
154 |
|
690
b9194bec5504
fpkg: FIX: quoting in "has_same_userland_version()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
688
diff
changeset
|
155 _host_version="$(/bin/freebsd-version -u)" || exit 1 |
|
b9194bec5504
fpkg: FIX: quoting in "has_same_userland_version()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
688
diff
changeset
|
156 _jail_version="$(jexec -l -- "${_jail}" /bin/freebsd-version -u)" || exit 1 |
|
95
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
157 if [ "${_host_version%%-*}" = "${_jail_version%%-*}" ]; then |
|
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
158 return 0 |
|
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
159 fi |
|
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
160 return 1 |
|
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
161 } |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
162 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
163 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
164 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
165 #: Do a local `freebsd-version -u` and also for all running jails |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
166 #: |
|
169
cc4117f5f4bd
Implemented an "uversion" command: get the userspace FreeBSD-version of the host and all runnings jails
Franz Glasner <fzglas.hg@dom66.de>
parents:
168
diff
changeset
|
167 command_uversion() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
168 local _jail _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
169 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
170 printf 'LOCALHOST: %s\n' "$(/bin/freebsd-version -u)" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
171 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
172 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
173 for _jail in $(/usr/sbin/jls name | LC_ALL=C.UTF-8 /usr/bin/sort); do |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
174 printf '%s: %s\n' "${_jail}" "$(jexec -l -- "${_jail}" /bin/freebsd-version -u)" |
|
169
cc4117f5f4bd
Implemented an "uversion" command: get the userspace FreeBSD-version of the host and all runnings jails
Franz Glasner <fzglas.hg@dom66.de>
parents:
168
diff
changeset
|
175 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
176 IFS="$_OLDIFS" |
|
169
cc4117f5f4bd
Implemented an "uversion" command: get the userspace FreeBSD-version of the host and all runnings jails
Franz Glasner <fzglas.hg@dom66.de>
parents:
168
diff
changeset
|
177 } |
|
cc4117f5f4bd
Implemented an "uversion" command: get the userspace FreeBSD-version of the host and all runnings jails
Franz Glasner <fzglas.hg@dom66.de>
parents:
168
diff
changeset
|
178 |
|
cc4117f5f4bd
Implemented an "uversion" command: get the userspace FreeBSD-version of the host and all runnings jails
Franz Glasner <fzglas.hg@dom66.de>
parents:
168
diff
changeset
|
179 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
180 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
181 #: Do a local `pkg audit -Fr` and also for all running jails |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
182 #: |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
183 command_audit() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
184 local _j _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
185 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
186 printf '%sLOCALHOST\n' "${FPKG_SIGN}" |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
187 pkg audit ${FPKG_AUDIT_FLAGS} |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
188 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
189 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
190 for _j in $(/usr/sbin/jls name | LC_ALL=C.UTF-8 /usr/bin/sort); do |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
191 printf '\n%sJAIL: %s\n' "${FPKG_SIGN}" "${_j}" |
|
95
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
192 if has_same_userland_version "${_j}"; then |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
193 pkg -j "${_j}" audit ${FPKG_AUDIT_FLAGS} |
|
95
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
194 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
195 printf '%s%s\n' "${FPKG_SKIPSIGN}" "SKIPPED because of different userland" |
|
95
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
196 fi |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
197 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
198 IFS="$_OLDIFS" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
199 } |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
200 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
201 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
202 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
203 #: Do a local `pkg update` and also for all running jails |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
204 #: |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
205 command_update() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
206 local _j _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
207 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
208 printf '%sLOCALHOST\n' "${FPKG_SIGN}" |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
209 pkg update ${FPKG_UPDATE_FLAGS} |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
210 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
211 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
212 for _j in $(/usr/sbin/jls name | LC_ALL=C.UTF-8 /usr/bin/sort); do |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
213 printf '\n%sJAIL: %s\n' "${FPKG_SIGN}" "${_j}" |
|
95
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
214 if has_same_userland_version "${_j}"; then |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
215 pkg -j "${_j}" update ${FPKG_UPDATE_FLAGS} |
|
95
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
216 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
217 printf '%s%s\n' "${FPKG_SKIPSIGN}" "SKIPPED because of different userland" |
|
95
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
218 fi |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
219 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
220 IFS="$_OLDIFS" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
221 } |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
222 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
223 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
224 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
225 #: Do a local `pkg upgrade` and also for all running jails |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
226 #: |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
227 command_upgrade() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
228 local _j _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
229 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
230 printf '%sLOCALHOST\n' "${FPKG_SIGN}" |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
231 pkg upgrade ${FPKG_UPGRADE_FLAGS} |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
232 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
233 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
234 for _j in $(/usr/sbin/jls name | LC_ALL=C.UTF-8 /usr/bin/sort); do |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
235 printf '\n%sJAIL: %s\n' "${FPKG_SIGN}" "${_j}" |
|
95
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
236 if has_same_userland_version "${_j}"; then |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
237 pkg -j "${_j}" upgrade ${FPKG_UPGRADE_FLAGS} |
|
95
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
238 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
239 printf '%s%s\n' "${FPKG_SKIPSIGN}" "SKIPPED because of different userland" |
|
95
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
240 fi |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
241 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
242 IFS="$_OLDIFS" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
243 } |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
244 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
245 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
246 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
247 #: Do a local `pkg upgrade -n` and also for all running jails |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
248 #: |
|
129
4aeff9d5275d
The command upgrade-check ist now check-upgrade and aliased to the old spelling also
Franz Glasner <fzglas.hg@dom66.de>
parents:
128
diff
changeset
|
249 command_check_upgrade() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
250 local _j _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
251 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
252 printf '%sLOCALHOST\n' "${FPKG_SIGN}" |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
253 pkg upgrade -n ${FPKG_UPGRADE_FLAGS} |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
254 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
255 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
256 for _j in $(/usr/sbin/jls name | LC_ALL=C.UTF-8 /usr/bin/sort); do |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
257 printf '\n%sJAIL: %s\n' "${FPKG_SIGN}" "${_j}" |
|
95
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
258 if has_same_userland_version "${_j}"; then |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
259 pkg -j "${_j}" upgrade -n ${FPKG_UPGRADE_FLAGS} |
|
95
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
260 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
261 printf '%s%s\n' "${FPKG_SKIPSIGN}" "SKIPPED because of different userland" |
|
95
e8c422379abb
Do package checks only for jails with compatible (i.e. "equal") userland versions with the host
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
262 fi |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
263 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
264 IFS="$_OLDIFS" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
265 } |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
266 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
267 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
268 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
269 #: Check the fast-track repository versions against the canonical |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
270 #: FreeBSD repository versions. |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
271 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
272 #: Input (Globals): |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
273 #: FREEBSD_REPO: the (canonical) FreeBSD repository name |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
274 #: LOCALBSDPORTS_REPO: the fast-track repository name |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
275 #: |
|
112
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
276 command_check_fasttrack() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
277 local _name _repo _j _OLDIFS |
|
112
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
278 |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
279 printf '%sLOCALHOST\n' "${FPKG_SIGN}" |
|
112
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
280 pkg query '%n %R' | |
|
683
cb9f2d675cf8
fpkg: FIX: Use "read -r" instead of a plain "read"
Franz Glasner <fzglas.hg@dom66.de>
parents:
682
diff
changeset
|
281 while read -r _name _repo; do |
|
112
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
282 if [ "${_repo}" = "${LOCALBSDPORTS_REPO}" ]; then |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
283 printf ' %s\n' "${_name}" |
|
684
205f88bcedc1
fpkg: FIX: Quoting in $(...) constructs
Franz Glasner <fzglas.hg@dom66.de>
parents:
683
diff
changeset
|
284 printf ' %-15s : %s\n' "${LOCALBSDPORTS_REPO}" "$(pkg version -U -r "${LOCALBSDPORTS_REPO}" -n "${_name}" -v)" |
|
205f88bcedc1
fpkg: FIX: Quoting in $(...) constructs
Franz Glasner <fzglas.hg@dom66.de>
parents:
683
diff
changeset
|
285 printf ' %-15s : %s\n' "${FREEBSD_REPO}" "$(pkg version -U -r "${FREEBSD_REPO}" -n "${_name}" -v)" |
|
112
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
286 fi |
|
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
287 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
288 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
289 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
290 for _j in $(/usr/sbin/jls name | LC_ALL=C.UTF-8 /usr/bin/sort); do |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
291 printf '\n%sJAIL: %s\n' "${FPKG_SIGN}" "${_j}" |
|
112
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
292 if has_same_userland_version "${_j}"; then |
|
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
293 pkg -j "${_j}" query '%n %R' | |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
294 while IFS="$_OLDIFS" read -r _name _repo; do |
|
112
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
295 if [ "${_repo}" = "${LOCALBSDPORTS_REPO}" ]; then |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
296 printf ' %s\n' "${_name}" |
|
684
205f88bcedc1
fpkg: FIX: Quoting in $(...) constructs
Franz Glasner <fzglas.hg@dom66.de>
parents:
683
diff
changeset
|
297 printf ' %s-15s : %s\n' "${LOCALBSDPORTS_REPO}" "$(pkg -j "${_j}" version -U -r "${LOCALBSDPORTS_REPO}" -n "${_name}" -v)" |
|
205f88bcedc1
fpkg: FIX: Quoting in $(...) constructs
Franz Glasner <fzglas.hg@dom66.de>
parents:
683
diff
changeset
|
298 printf ' %-15s : %s\n' "${FREEBSD_REPO}" "$(pkg -j "${_j}" version -U -r "${FREEBSD_REPO}" -n "${_name}" -v)" |
|
112
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
299 fi |
|
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
300 done |
|
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
301 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
302 printf '%s%s\n' "${FPKG_SKIPSIGN}" "SKIPPED because of different userland" |
|
112
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
303 fi |
|
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
304 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
305 IFS="$_OLDIFS" |
|
112
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
306 } |
|
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
307 |
|
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
308 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
309 #: |
| 695 | 310 #: The `pkg config name` command for the host and all running jails |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
311 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
312 #: Args: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
313 #: $1 (str): the configuration option to retrieve to |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
314 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
315 #: Output (stdout): |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
316 #: The value of the configuration option |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
317 #: |
|
146
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
318 command_config() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
319 local _name _j _OLDIFS |
|
146
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
320 |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
321 _name="$1" |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
322 |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
323 if [ -z "${_name}" ]; then |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
324 echo "Usage: fpkg config <name>" >&2 |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
325 return 1 |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
326 fi |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
327 printf '%sLOCALHOST\n' "${FPKG_SIGN}" |
|
146
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
328 pkg config "${_name}" |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
329 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
330 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
331 for _j in $(/usr/sbin/jls name | LC_ALL=C.UTF-8 /usr/bin/sort); do |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
332 printf '\n%sJAIL: %s\n' "${FPKG_SIGN}" "${_j}" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
333 # This prints the value on the *host* also |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
334 #pkg -j "${_j}" config "${_name}" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
335 # with jexec it can be run on all jails |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
336 LC_ALL=C.UTF-8 /usr/sbin/jexec -- "${_j}" pkg config "${_name}" |
|
146
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
337 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
338 IFS="$_OLDIFS" |
|
146
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
339 } |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
340 |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
341 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
342 #: |
| 695 | 343 #: The `pkg -vv` command for the host and all running compatible jails |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
344 #: |
|
146
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
345 command_vv() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
346 local _j _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
347 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
348 printf '%sLOCALHOST\n' "${FPKG_SIGN}" |
|
146
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
349 pkg -vv |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
350 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
351 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
352 for _j in $(/usr/sbin/jls name | LC_ALL=C.UTF-8 /usr/bin/sort); do |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
353 printf '\n%sJAIL: %s\n' "${FPKG_SIGN}" "${_j}" |
|
146
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
354 if has_same_userland_version "${_j}"; then |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
355 pkg -j "${_j}" -vv |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
356 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
357 printf '%s%s\n' "${FPKG_SKIPSIGN}" "SKIPPED because of different userland" |
|
146
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
358 fi |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
359 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
360 IFS="$_OLDIFS" |
|
146
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
361 } |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
362 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
363 #: |
| 695 | 364 #: Call `etcupdate status` for the host and all running jails |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
365 #: |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
366 command_etcupdate_status() { |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
367 local _j _OLDIFS |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
368 |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
369 printf '%sLOCALHOST\n' "${FPKG_SIGN}" |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
370 /usr/sbin/etcupdate status |
|
688
3e96fc952c45
fpkg: Allow spaces in jail names for "fpkg etcupdate-status"
Franz Glasner <fzglas.hg@dom66.de>
parents:
686
diff
changeset
|
371 _OLDIFS="$IFS" |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
372 IFS=$'\n' |
|
688
3e96fc952c45
fpkg: Allow spaces in jail names for "fpkg etcupdate-status"
Franz Glasner <fzglas.hg@dom66.de>
parents:
686
diff
changeset
|
373 for _j in $(/usr/sbin/jls name | LC_ALL=C.UTF-8 /usr/bin/sort); do |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
374 printf '\n%sJAIL: %s\n' "${FPKG_SIGN}" "${_j}" |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
375 LC_ALL=C.UTF-8 /usr/sbin/jexec -- "${_j}" /usr/sbin/etcupdate status |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
376 done |
|
688
3e96fc952c45
fpkg: Allow spaces in jail names for "fpkg etcupdate-status"
Franz Glasner <fzglas.hg@dom66.de>
parents:
686
diff
changeset
|
377 IFS="$_OLDIFS" |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
378 } |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
379 |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
380 |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
381 # |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
382 # Global option handling |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
383 # |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
384 while getopts "Vh" _opt ; do |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
385 case ${_opt} in |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
386 V) |
|
386
84d2735fe7f6
Simplified version tagging a lot: it is also faster now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
320
diff
changeset
|
387 printf 'fpkg %s\n' '@@SIMPLEVERSIONSTR@@' |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
388 exit 0 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
389 ;; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
390 h) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
391 echo "${USAGE}" |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
392 exit 0 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
393 ;; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
394 \?) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
395 exit 2; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
396 ;; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
397 *) |
|
696
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
398 fatal 2 "option handling failed" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
399 ;; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
400 esac |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
401 done |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
402 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
403 # |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
404 # Reset the Shell's option handling system to prepare for handling |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
405 # command-local options. |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
406 # |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
407 shift $((OPTIND-1)) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
408 OPTIND=1 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
409 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
410 command="$1" |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
411 shift |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
412 |
|
696
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
413 test -n "$command" || fatal 2 "no command given" |
|
90
aefad9391470
Extra error message if not command is given
Franz Glasner <fzglas.hg@dom66.de>
parents:
88
diff
changeset
|
414 |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
415 case "${command}" in |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
416 audit) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
417 command_audit "$@" |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
418 ;; |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
419 etcupdate-status|etcupdate_status|status-etcupdate|status_etcupdate) |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
420 command_etcupdate_status "$@" |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
421 ;; |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
422 update) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
423 command_update "$@" |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
424 ;; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
425 upgrade) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
426 command_upgrade "$@" |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
427 ;; |
|
129
4aeff9d5275d
The command upgrade-check ist now check-upgrade and aliased to the old spelling also
Franz Glasner <fzglas.hg@dom66.de>
parents:
128
diff
changeset
|
428 check-upgrade|check_upgrade|upgrade-check|upgrade_check) |
|
4aeff9d5275d
The command upgrade-check ist now check-upgrade and aliased to the old spelling also
Franz Glasner <fzglas.hg@dom66.de>
parents:
128
diff
changeset
|
429 command_check_upgrade "$@" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
430 ;; |
|
112
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
431 check-fast-track|check-fasttrack|check_fast_track|check_fasttrack) |
|
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
432 command_check_fasttrack "$@" |
|
0838fdca3a2b
Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
109
diff
changeset
|
433 ;; |
|
146
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
434 config) |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
435 command_config "$@" |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
436 ;; |
|
169
cc4117f5f4bd
Implemented an "uversion" command: get the userspace FreeBSD-version of the host and all runnings jails
Franz Glasner <fzglas.hg@dom66.de>
parents:
168
diff
changeset
|
437 uversion) |
|
cc4117f5f4bd
Implemented an "uversion" command: get the userspace FreeBSD-version of the host and all runnings jails
Franz Glasner <fzglas.hg@dom66.de>
parents:
168
diff
changeset
|
438 command_uversion "$@" |
|
cc4117f5f4bd
Implemented an "uversion" command: get the userspace FreeBSD-version of the host and all runnings jails
Franz Glasner <fzglas.hg@dom66.de>
parents:
168
diff
changeset
|
439 ;; |
|
146
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
440 vv) |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
441 command_vv "$@" |
|
0e140f349924
- Provide a "vv" command on the host and in all running compatible jails: pkg -vv
Franz Glasner <fzglas.hg@dom66.de>
parents:
144
diff
changeset
|
442 ;; |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
443 *) |
|
696
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
444 fatal 2 "unknown command \`${command}'" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
445 ;; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
446 esac |
