comparison bin/fpkg @ 112:0838fdca3a2b

Implemented the check-fast-track command to check installed packages that are installed from LocalBSDPorts against FreeBSD and LocalBSDPorts
author Franz Glasner <hg@dom66.de>
date Mon, 14 Oct 2019 16:52:34 +0200
parents 0bd594fb56f8
children 2d531cbd0feb
comparison
equal deleted inserted replaced
111:fa73423234bf 112:0838fdca3a2b
41 41
42 upgrade-check 42 upgrade-check
43 43
44 `pkg upgrade -n` on the local host and all running visible jails 44 `pkg upgrade -n` on the local host and all running visible jails
45 45
46 check-fast-track
47 Check packages installed from the LocalBSDPorts repository against
48 the repositories `FreeBSD` and `LocalBSDPorts` on the local host
49 and all visible jails
50
51
46 ENVIRONMENT: 52 ENVIRONMENT:
47 53
48 FPKG_AUDIT_FLAGS 54 FPKG_AUDIT_FLAGS
49 Additional flags given to `pkg audit` 55 Additional flags given to `pkg audit`
50 (Default: -Fr) 56 (Default: -Fr)
78 : ${FPKG_AUDIT_FLAGS:=-Fr} 84 : ${FPKG_AUDIT_FLAGS:=-Fr}
79 : ${FPKG_UPDATE_FLAGS:=} 85 : ${FPKG_UPDATE_FLAGS:=}
80 : ${FPKG_UPGRADE_FLAGS:=} 86 : ${FPKG_UPGRADE_FLAGS:=}
81 : ${FPKG_SIGN:='===> '} 87 : ${FPKG_SIGN:='===> '}
82 : ${FPKG_SKIPSIGN:='----> '} 88 : ${FPKG_SKIPSIGN:='----> '}
89
90 #
91 # The official FreeBSD binary repository
92 #
93 : ${FREEBSD_REPO:=FreeBSD}
94
95 #
96 # Local repository with ports with default OPTIONS (i.e. unchanged)
97 # but newer than the packages in the "FreeBSD" repository.
98 # Some sort of a fast-track repository.
99 #
100 : ${LOCALBSDPORTS_REPO:=LocalBSDPorts}
83 101
84 102
85 has_same_userland_version() { 103 has_same_userland_version() {
86 : 'Check whether the jail `_jail` has the same FreeBSD userland version 104 : 'Check whether the jail `_jail` has the same FreeBSD userland version
87 as the host the the current process runs. 105 as the host the the current process runs.
176 fi 194 fi
177 done 195 done
178 } 196 }
179 197
180 198
199 command_check_fasttrack() {
200 : 'Check the fast-track repository versions against the canonical
201 FreeBSD repository versions.
202
203 Input (Globals):
204 FREEBSD_REPO: the (canonical) FreeBSD repository name
205 LOCALBSDPORTS_REPO: the fast-track repository name
206
207 '
208 local _name local _repo _j
209
210 echo "${FPKG_SIGN}LOCALHOST"
211 pkg query '%n %R' |
212 while read _name _repo; do
213 if [ "${_repo}" = "${LOCALBSDPORTS_REPO}" ]; then
214 echo " ${_name}"
215 printf " %-15s : %s\n" "${LOCALBSDPORTS_REPO}" "$(pkg version -r ${LOCALBSDPORTS_REPO} -n ${_name} -v)"
216 printf " %-15s : %s\n" "${FREEBSD_REPO}" "$(pkg version -r ${FREEBSD_REPO} -n ${_name} -v)"
217 fi
218 done
219 for _j in $(jls -N | awk '{if(NR>1)print $1}' | sort); do
220 echo ""
221 echo "${FPKG_SIGN}JAIL: ${_j}"
222 if has_same_userland_version "${_j}"; then
223 pkg -j "${_j}" query '%n %R' |
224 while read _name _repo; do
225 if [ "${_repo}" = "${LOCALBSDPORTS_REPO}" ]; then
226 echo " ${_name}"
227 printf " %s-15s : %s\n" "${LOCALBSDPORTS_REPO}" "$(pkg -j ${_j} version -r ${LOCALBSDPORTS_REPO} -n ${_name} -v)"
228 printf " %-15s : %s\n" "${FREEBSD_REPO}" "$(pkg -j ${_j} version -r ${FREEBSD_REPO} -n ${_name} -v)"
229 fi
230 done
231 else
232 echo "${FPKG_SKIPSIGN}SKIPPED because of different userland"
233 fi
234 done
235 }
236
237
181 # 238 #
182 # Global option handling 239 # Global option handling
183 # 240 #
184 while getopts "Vh" _opt ; do 241 while getopts "Vh" _opt ; do
185 case ${_opt} in 242 case ${_opt} in
224 command_upgrade "$@" 281 command_upgrade "$@"
225 ;; 282 ;;
226 upgrade-check|upgrade_check) 283 upgrade-check|upgrade_check)
227 command_upgrade_check "$@" 284 command_upgrade_check "$@"
228 ;; 285 ;;
286 check-fast-track|check-fasttrack|check_fast_track|check_fasttrack)
287 command_check_fasttrack "$@"
288 ;;
229 *) 289 *)
230 echo "ERROR: unknown command \`${command}'" >&2 290 echo "ERROR: unknown command \`${command}'" >&2
231 exit 2; 291 exit 2;
232 ;; 292 ;;
233 esac 293 esac