Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
annotate sbin/fpkg @ 693:3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
While there: fix some documented behaviour: some command run in all
running jails (not only in compatible jails).
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Tue, 01 Oct 2024 16:16:28 +0200 |
| parents | d1cb22ba641d |
| children | 5931f16f098f |
| 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 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
106 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
107 #: Configuration directory |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
108 #: |
|
685
918932936c68
fpkg: handle some shellcheck issues
Franz Glasner <fzglas.hg@dom66.de>
parents:
684
diff
changeset
|
109 : ${CONFIGDIR:="@@ETCDIR@@"} |
|
109
0bd594fb56f8
Read the tools.conf configuration file where appropriate
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
110 |
|
685
918932936c68
fpkg: handle some shellcheck issues
Franz Glasner <fzglas.hg@dom66.de>
parents:
684
diff
changeset
|
111 # shellcheck disable=SC1091 # not following... |
|
918932936c68
fpkg: handle some shellcheck issues
Franz Glasner <fzglas.hg@dom66.de>
parents:
684
diff
changeset
|
112 [ -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
|
113 |
|
680
a63e689d0529
fpkg: For default variable values: use "=" instead of ":="
Franz Glasner <fzglas.hg@dom66.de>
parents:
643
diff
changeset
|
114 : ${FPKG_AUDIT_FLAGS="-Fr"} |
|
a63e689d0529
fpkg: For default variable values: use "=" instead of ":="
Franz Glasner <fzglas.hg@dom66.de>
parents:
643
diff
changeset
|
115 : ${FPKG_UPDATE_FLAGS=} |
|
a63e689d0529
fpkg: For default variable values: use "=" instead of ":="
Franz Glasner <fzglas.hg@dom66.de>
parents:
643
diff
changeset
|
116 : ${FPKG_UPGRADE_FLAGS=} |
|
107
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
117 : ${FPKG_SIGN:='===> '} |
|
f8642efe05a1
Renamed (environment/configuration) variables to have a FPKG_ prefix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
99
diff
changeset
|
118 : ${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
|
119 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
120 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
121 #: The official FreeBSD binary repository |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
122 #: |
|
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
|
123 : ${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
|
124 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
125 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
126 #: 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
|
127 #: 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
|
128 #: Some sort of a fast-track repository. |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
129 #: |
|
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
|
130 : ${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
|
131 |
|
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
|
132 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
133 #: 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
|
134 #: 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
|
135 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
136 #: Args: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
137 #: $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
|
138 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
139 #: Returns: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
140 #: 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
|
141 #: |
|
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
|
142 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
|
143 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
|
144 |
|
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
|
145 _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
|
146 |
|
690
b9194bec5504
fpkg: FIX: quoting in "has_same_userland_version()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
688
diff
changeset
|
147 _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
|
148 _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
|
149 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
|
150 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
|
151 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
|
152 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
|
153 } |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
154 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
155 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
156 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
157 #: 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
|
158 #: |
|
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
|
159 command_uversion() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
160 local _jail _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
161 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
162 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
|
163 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
164 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
165 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
|
166 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
|
167 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
168 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
|
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
|
170 |
|
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
|
171 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
172 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
173 #: 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
|
174 #: |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
175 command_audit() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
176 local _j _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
177 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
178 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
|
179 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
|
180 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
181 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
182 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
|
183 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
|
184 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
|
185 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
|
186 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
187 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
|
188 fi |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
189 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
190 IFS="$_OLDIFS" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
191 } |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
192 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
193 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
194 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
195 #: 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
|
196 #: |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
197 command_update() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
198 local _j _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
199 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
200 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
|
201 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
|
202 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
203 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
204 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
|
205 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
|
206 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
|
207 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
|
208 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
209 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
|
210 fi |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
211 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
212 IFS="$_OLDIFS" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
213 } |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
214 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
215 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
216 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
217 #: 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
|
218 #: |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
219 command_upgrade() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
220 local _j _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
221 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
222 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
|
223 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
|
224 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
225 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
226 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
|
227 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
|
228 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
|
229 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
|
230 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
231 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
|
232 fi |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
233 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
234 IFS="$_OLDIFS" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
235 } |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
236 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
237 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
238 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
239 #: 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
|
240 #: |
|
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
|
241 command_check_upgrade() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
242 local _j _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
243 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
244 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
|
245 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
|
246 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
247 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
248 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
|
249 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
|
250 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
|
251 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
|
252 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
253 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
|
254 fi |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
255 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
256 IFS="$_OLDIFS" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
257 } |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
258 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
259 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
260 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
261 #: 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
|
262 #: FreeBSD repository versions. |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
263 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
264 #: Input (Globals): |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
265 #: FREEBSD_REPO: the (canonical) FreeBSD repository name |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
266 #: LOCALBSDPORTS_REPO: the fast-track repository name |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
267 #: |
|
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
|
268 command_check_fasttrack() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
269 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
|
270 |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
271 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
|
272 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
|
273 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
|
274 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
|
275 printf ' %s\n' "${_name}" |
|
684
205f88bcedc1
fpkg: FIX: Quoting in $(...) constructs
Franz Glasner <fzglas.hg@dom66.de>
parents:
683
diff
changeset
|
276 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
|
277 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
|
278 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
|
279 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
280 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
281 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
282 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
|
283 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
|
284 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
|
285 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
|
286 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
|
287 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
|
288 printf ' %s\n' "${_name}" |
|
684
205f88bcedc1
fpkg: FIX: Quoting in $(...) constructs
Franz Glasner <fzglas.hg@dom66.de>
parents:
683
diff
changeset
|
289 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
|
290 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
|
291 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
|
292 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
|
293 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
294 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
|
295 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
|
296 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
297 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
|
298 } |
|
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 |
|
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 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
301 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
302 #: The `pkg config name` command on the host and all running jails |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
303 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
304 #: Args: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
305 #: $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
|
306 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
307 #: Output (stdout): |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
308 #: The value of the configuration option |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
309 #: |
|
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
|
310 command_config() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
311 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
|
312 |
|
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
|
313 _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
|
314 |
|
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
|
315 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
|
316 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
|
317 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
|
318 fi |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
319 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
|
320 pkg config "${_name}" |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
321 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
322 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
323 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
|
324 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
|
325 # 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
|
326 #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
|
327 # 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
|
328 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
|
329 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
330 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
|
331 } |
|
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
|
332 |
|
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
|
333 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
334 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
335 #: The `pkg -vv` command on the host and all running compatible jails |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
336 #: |
|
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 command_vv() { |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
338 local _j _OLDIFS |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
339 |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
340 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
|
341 pkg -vv |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
342 _OLDIFS="$IFS" |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
343 IFS=$'\n' |
|
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
344 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
|
345 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
|
346 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
|
347 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
|
348 else |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
349 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
|
350 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
|
351 done |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
352 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
|
353 } |
|
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 |
|
693
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
355 #: |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
356 #: Call `etcupdate status` on the host and all running jails |
|
3633a41b862b
fpkg: Use modern documentation: "#:" instead of ': ...'.
Franz Glasner <fzglas.hg@dom66.de>
parents:
692
diff
changeset
|
357 #: |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
358 command_etcupdate_status() { |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
359 local _j _OLDIFS |
|
692
d1cb22ba641d
fpkg: Modernize fpkg: local variables, jail enumeration and sorting.
Franz Glasner <fzglas.hg@dom66.de>
parents:
690
diff
changeset
|
360 |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
361 printf '%sLOCALHOST\n' "${FPKG_SIGN}" |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
362 /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
|
363 _OLDIFS="$IFS" |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
364 IFS=$'\n' |
|
688
3e96fc952c45
fpkg: Allow spaces in jail names for "fpkg etcupdate-status"
Franz Glasner <fzglas.hg@dom66.de>
parents:
686
diff
changeset
|
365 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
|
366 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
|
367 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
|
368 done |
|
688
3e96fc952c45
fpkg: Allow spaces in jail names for "fpkg etcupdate-status"
Franz Glasner <fzglas.hg@dom66.de>
parents:
686
diff
changeset
|
369 IFS="$_OLDIFS" |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
370 } |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
371 |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
372 |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
373 # |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
374 # Global option handling |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
375 # |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
376 while getopts "Vh" _opt ; do |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
377 case ${_opt} in |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
378 V) |
|
386
84d2735fe7f6
Simplified version tagging a lot: it is also faster now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
320
diff
changeset
|
379 printf 'fpkg %s\n' '@@SIMPLEVERSIONSTR@@' |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
380 exit 0 |
|
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 h) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
383 echo "${USAGE}" |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
384 exit 0 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
385 ;; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
386 \?) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
387 exit 2; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
388 ;; |
|
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 echo "ERROR: option handling failed" >&2 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
391 exit 2 |
|
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 esac |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
394 done |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
395 |
|
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 # 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
|
398 # command-local options. |
|
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 shift $((OPTIND-1)) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
401 OPTIND=1 |
|
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 command="$1" |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
404 shift |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
405 |
|
90
aefad9391470
Extra error message if not command is given
Franz Glasner <fzglas.hg@dom66.de>
parents:
88
diff
changeset
|
406 test -n "$command" || { echo "ERROR: no command given" >&2; exit 2; } |
|
aefad9391470
Extra error message if not command is given
Franz Glasner <fzglas.hg@dom66.de>
parents:
88
diff
changeset
|
407 |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
408 case "${command}" in |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
409 audit) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
410 command_audit "$@" |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
411 ;; |
|
686
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
412 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
|
413 command_etcupdate_status "$@" |
|
bda643a6310e
fpkg: Implement the "etcupdate-status" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
685
diff
changeset
|
414 ;; |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
415 update) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
416 command_update "$@" |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
417 ;; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
418 upgrade) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
419 command_upgrade "$@" |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
420 ;; |
|
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
|
421 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
|
422 command_check_upgrade "$@" |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
423 ;; |
|
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
|
424 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
|
425 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
|
426 ;; |
|
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
|
427 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
|
428 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
|
429 ;; |
|
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
|
430 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
|
431 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
|
432 ;; |
|
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
|
433 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
|
434 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
|
435 ;; |
|
88
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
436 *) |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
437 echo "ERROR: unknown command \`${command}'" >&2 |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
438 exit 2; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
439 ;; |
|
76ddab9ab965
Add a tool for host and jail "pkg" management
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
440 esac |
