Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
annotate sbin/fpkg @ 696:44a702b32c01
fpkg: include common.subr and use modernized error reporting
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Tue, 01 Oct 2024 19:28:57 +0200 |
| parents | 5931f16f098f |
| children | 7126823e4d70 |
| 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 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
17 |
|
643
4f2257ea7d0a
shellcheck: disable SC2034: VERSION appears unused...
Franz Glasner <fzglas.hg@dom66.de>
parents:
550
diff
changeset
|
18 # 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
|
19 VERSION='@@VERSION@@' |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
20 |
|
685
918932936c68
fpkg: handle some shellcheck issues
Franz Glasner <fzglas.hg@dom66.de>
parents:
684
diff
changeset
|
21 # shellcheck disable=SC2016 # no expansion |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
22 USAGE=' |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
23 USAGE: fpkg [ OPTIONS] COMMAND [ COMMAND-OPTIONS ] |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
24 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
25 OPTIONS: |
|
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 -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
|
28 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
29 -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
|
30 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
31 COMMANDS: |
|
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 audit |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
34 |
|
319
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
35 `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
|
36 compatible jails |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
37 |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
38 etcupdate-status |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
39 |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
40 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
|
41 jails |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
42 |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
43 update |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
44 |
|
319
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
45 `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
|
46 compatible jails |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
47 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
48 upgrade |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
49 |
|
319
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
50 `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
|
51 compatible jails |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
52 |
|
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
|
53 check-upgrade |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
54 upgrade-check |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
55 |
|
319
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
56 `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
|
57 compatible jails |
|
91
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
58 |
|
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
|
59 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
|
60 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
|
61 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
|
62 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
|
63 |
|
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
|
64 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
|
65 |
| 320 | 66 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
|
67 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
|
68 |
|
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
|
69 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
|
70 |
|
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 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
|
72 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
|
73 |
|
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
|
74 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
|
75 |
|
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 `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
|
77 |
|
91
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
78 ENVIRONMENT: |
|
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
79 |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
80 FPKG_AUDIT_FLAGS |
|
91
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
81 Additional flags given to `pkg audit` |
|
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
82 (Default: -Fr) |
|
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
83 |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
84 FPKG_UPDATE_FLAGS |
|
91
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
85 Additional flags given to `pkg update` |
|
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
86 (Default: empty) |
|
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
87 |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
88 FPKG_UPGRADE_FLAGS |
|
91
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
89 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
|
90 (Default: empty) |
|
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
91 |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
92 FPKG_SIGN |
|
91
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
93 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
|
94 (Default: "===> ") |
|
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
95 |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
96 FPKG_SKIPSIGN |
| 98 | 97 Marker for the begin of a skipped output group |
| 98 (Default: "----> ") | |
| 99 | |
|
91
fffee187f1f7
Docu: effective environment variables
Franz Glasner <fzglas.hg@dom66.de>
parents:
90
diff
changeset
|
100 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
|
101 |
|
2ba574bd8ded
fpkg: Enhance fpkg's help message
Franz Glasner <fzglas.hg@dom66.de>
parents:
318
diff
changeset
|
102 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
|
103 as the host'"'"'s. |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
104 ' |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
105 |
|
696
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
106 |
|
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
107 _p_datadir='@@DATADIR@@' |
|
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
108 [ "${_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
|
109 . "${_p_datadir}/common.subr" |
|
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
110 |
|
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
111 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
112 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
113 #: Configuration directory |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
114 #: |
|
685
918932936c68
fpkg: handle some shellcheck issues
Franz Glasner <fzglas.hg@dom66.de>
parents:
684
diff
changeset
|
115 : ${CONFIGDIR:="@@ETCDIR@@"} |
|
109
0bd594fb56f8
Read the tools.conf configuration file where appropriate
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
116 |
|
685
918932936c68
fpkg: handle some shellcheck issues
Franz Glasner <fzglas.hg@dom66.de>
parents:
684
diff
changeset
|
117 # shellcheck disable=SC1091 # not following... |
|
918932936c68
fpkg: handle some shellcheck issues
Franz Glasner <fzglas.hg@dom66.de>
parents:
684
diff
changeset
|
118 [ -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
|
119 |
|
680
a63e689d0529
fpkg: For default variable values: use "=" instead of ":="
Franz Glasner <fzglas.hg@dom66.de>
parents:
643
diff
changeset
|
120 : ${FPKG_AUDIT_FLAGS="-Fr"} |
|
a63e689d0529
fpkg: For default variable values: use "=" instead of ":="
Franz Glasner <fzglas.hg@dom66.de>
parents:
643
diff
changeset
|
121 : ${FPKG_UPDATE_FLAGS=} |
|
a63e689d0529
fpkg: For default variable values: use "=" instead of ":="
Franz Glasner <fzglas.hg@dom66.de>
parents:
643
diff
changeset
|
122 : ${FPKG_UPGRADE_FLAGS=} |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
123 : ${FPKG_SIGN:='===> '} |
|
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
124 : ${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
|
125 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
126 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
127 #: The official FreeBSD binary repository |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
128 #: |
|
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
|
129 : ${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
|
130 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
131 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
132 #: 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
|
133 #: 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
|
134 #: Some sort of a fast-track repository. |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
135 #: |
|
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
|
136 : ${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
|
137 |
|
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
|
138 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
139 #: 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
|
140 #: 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
|
141 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
142 #: Args: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
143 #: $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
|
144 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
145 #: Returns: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
146 #: 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
|
147 #: |
|
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
|
148 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
|
149 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
|
150 |
|
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 _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
|
152 |
|
690
b9194bec5504
fpkg: FIX: quoting in "has_same_userland_version()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
688
diff
changeset
|
153 _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
|
154 _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
|
155 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
|
156 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
|
157 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
|
158 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
|
159 } |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
160 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
161 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
162 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
163 #: 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
|
164 #: |
|
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
|
165 command_uversion() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
166 local _jail _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
167 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
168 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
|
169 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
170 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
171 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
|
172 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
|
173 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
174 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
|
175 } |
|
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
|
176 |
|
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 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
178 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
179 #: 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
|
180 #: |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
181 command_audit() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
182 local _j _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
183 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
184 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
|
185 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
|
186 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
187 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
188 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
|
189 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
|
190 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
|
191 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
|
192 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
193 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
|
194 fi |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
195 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
196 IFS="$_OLDIFS" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
197 } |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
198 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
199 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
200 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
201 #: 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
|
202 #: |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
203 command_update() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
204 local _j _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
205 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
206 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
|
207 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
|
208 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
209 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
210 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
|
211 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
|
212 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
|
213 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
|
214 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
215 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
|
216 fi |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
217 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
218 IFS="$_OLDIFS" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
219 } |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
220 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
221 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
222 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
223 #: 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
|
224 #: |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
225 command_upgrade() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
226 local _j _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
227 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
228 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
|
229 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
|
230 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
231 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
232 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
|
233 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
|
234 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
|
235 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
|
236 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
237 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
|
238 fi |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
239 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
240 IFS="$_OLDIFS" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
241 } |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
242 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
243 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
244 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
245 #: 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
|
246 #: |
|
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
|
247 command_check_upgrade() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
248 local _j _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
249 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
250 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
|
251 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
|
252 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
253 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
254 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
|
255 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
|
256 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
|
257 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
|
258 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
259 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
|
260 fi |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
261 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
262 IFS="$_OLDIFS" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
263 } |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
264 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
265 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
266 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
267 #: 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
|
268 #: FreeBSD repository versions. |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
269 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
270 #: Input (Globals): |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
271 #: FREEBSD_REPO: the (canonical) FreeBSD repository name |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
272 #: LOCALBSDPORTS_REPO: the fast-track repository name |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
273 #: |
|
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
|
274 command_check_fasttrack() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
275 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
|
276 |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
277 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
|
278 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
|
279 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
|
280 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
|
281 printf ' %s\n' "${_name}" |
|
684
205f88bcedc1
fpkg: FIX: Quoting in $(...) constructs
Franz Glasner <fzglas.hg@dom66.de>
parents:
683
diff
changeset
|
282 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
|
283 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
|
284 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
|
285 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
286 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
287 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
288 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
|
289 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
|
290 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
|
291 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
|
292 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
|
293 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
|
294 printf ' %s\n' "${_name}" |
|
684
205f88bcedc1
fpkg: FIX: Quoting in $(...) constructs
Franz Glasner <fzglas.hg@dom66.de>
parents:
683
diff
changeset
|
295 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
|
296 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
|
297 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
|
298 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
|
299 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
300 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
|
301 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
|
302 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
303 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
|
304 } |
|
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
|
305 |
|
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 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
307 #: |
| 695 | 308 #: 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
|
309 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
310 #: Args: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
311 #: $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
|
312 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
313 #: Output (stdout): |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
314 #: The value of the configuration option |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
315 #: |
|
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
|
316 command_config() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
317 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
|
318 |
|
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
|
319 _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
|
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 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
|
322 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
|
323 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
|
324 fi |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
325 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
|
326 pkg config "${_name}" |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
327 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
328 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
329 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
|
330 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
|
331 # 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
|
332 #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
|
333 # 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
|
334 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
|
335 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
336 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
|
337 } |
|
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
|
338 |
|
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 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
340 #: |
| 695 | 341 #: 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
|
342 #: |
|
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
|
343 command_vv() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
344 local _j _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
345 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
346 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
|
347 pkg -vv |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
348 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
349 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
350 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
|
351 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
|
352 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
|
353 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
|
354 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
355 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
|
356 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
|
357 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
358 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
|
359 } |
|
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
|
360 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
361 #: |
| 695 | 362 #: 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
|
363 #: |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
364 command_etcupdate_status() { |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
365 local _j _OLDIFS |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
366 |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
367 printf '%sLOCALHOST\n' "${FPKG_SIGN}" |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
368 /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
|
369 _OLDIFS="$IFS" |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
370 IFS=$'\n' |
|
688
3e96fc952c45
fpkg: Allow spaces in jail names for "fpkg etcupdate-status"
Franz Glasner <fzglas.hg@dom66.de>
parents:
686
diff
changeset
|
371 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
|
372 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
|
373 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
|
374 done |
|
688
3e96fc952c45
fpkg: Allow spaces in jail names for "fpkg etcupdate-status"
Franz Glasner <fzglas.hg@dom66.de>
parents:
686
diff
changeset
|
375 IFS="$_OLDIFS" |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
376 } |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
377 |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
378 |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
379 # |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
380 # Global option handling |
|
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 while getopts "Vh" _opt ; do |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
383 case ${_opt} in |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
384 V) |
|
386
84d2735fe7f6
Simplified version tagging a lot: it is also faster now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
320
diff
changeset
|
385 printf 'fpkg %s\n' '@@SIMPLEVERSIONSTR@@' |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
386 exit 0 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
387 ;; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
388 h) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
389 echo "${USAGE}" |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
390 exit 0 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
391 ;; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
392 \?) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
393 exit 2; |
|
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 *) |
|
696
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
396 fatal 2 "option handling failed" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
397 ;; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
398 esac |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
399 done |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
400 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
401 # |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
402 # 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
|
403 # command-local options. |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
404 # |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
405 shift $((OPTIND-1)) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
406 OPTIND=1 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
407 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
408 command="$1" |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
409 shift |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
410 |
|
696
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
411 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
|
412 |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
413 case "${command}" in |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
414 audit) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
415 command_audit "$@" |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
416 ;; |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
417 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
|
418 command_etcupdate_status "$@" |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
419 ;; |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
420 update) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
421 command_update "$@" |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
422 ;; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
423 upgrade) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
424 command_upgrade "$@" |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
425 ;; |
|
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
|
426 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
|
427 command_check_upgrade "$@" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
428 ;; |
|
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
|
429 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
|
430 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
|
431 ;; |
|
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
|
432 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
|
433 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
|
434 ;; |
|
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
|
435 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
|
436 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
|
437 ;; |
|
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
|
438 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
|
439 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
|
440 ;; |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
441 *) |
|
696
44a702b32c01
fpkg: include common.subr and use modernized error reporting
Franz Glasner <fzglas.hg@dom66.de>
parents:
695
diff
changeset
|
442 fatal 2 "unknown command \`${command}'" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
443 ;; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
444 esac |
