comparison sbin/fpkg @ 452:d5591ebc303d

Use "--" for jexec and chroot to accept more unconvenient jail names and/or directories
author Franz Glasner <fzglas.hg@dom66.de>
date Fri, 10 May 2024 13:42:10 +0200
parents e7eba671bd74
children 847ae246f3cc
comparison
equal deleted inserted replaced
451:e7eba671bd74 452:d5591ebc303d
135 local _jail _host_version _jail_version 135 local _jail _host_version _jail_version
136 136
137 _jail="$1" 137 _jail="$1"
138 138
139 _host_version=$(/bin/freebsd-version -u) || exit 1 139 _host_version=$(/bin/freebsd-version -u) || exit 1
140 _jail_version=$(jexec -l "${_jail}" /bin/freebsd-version -u) || exit 1 140 _jail_version=$(jexec -l -- "${_jail}" /bin/freebsd-version -u) || exit 1
141 if [ "${_host_version%%-*}" = "${_jail_version%%-*}" ]; then 141 if [ "${_host_version%%-*}" = "${_jail_version%%-*}" ]; then
142 return 0 142 return 0
143 fi 143 fi
144 return 1 144 return 1
145 } 145 }
149 : ' Do a local `freebsd-version -u` and also for all running jails 149 : ' Do a local `freebsd-version -u` and also for all running jails
150 150
151 ' 151 '
152 echo "LOCALHOST: $(/bin/freebsd-version -u)" 152 echo "LOCALHOST: $(/bin/freebsd-version -u)"
153 for _jail in $(jls -N | awk '{if(NR>1)print $1}' | sort); do 153 for _jail in $(jls -N | awk '{if(NR>1)print $1}' | sort); do
154 echo "${_jail}: $(jexec -l "${_jail}" /bin/freebsd-version -u)" 154 echo "${_jail}: $(jexec -l -- "${_jail}" /bin/freebsd-version -u)"
155 done 155 done
156 } 156 }
157 157
158 158
159 command_audit() { 159 command_audit() {
289 echo "" 289 echo ""
290 echo "${FPKG_SIGN}JAIL: ${_j}" 290 echo "${FPKG_SIGN}JAIL: ${_j}"
291 if has_same_userland_version "${_j}"; then 291 if has_same_userland_version "${_j}"; then
292 # This prints the value on the *host* also 292 # This prints the value on the *host* also
293 #pkg -j "${_j}" config "${_name}" 293 #pkg -j "${_j}" config "${_name}"
294 jexec "${_j}" pkg config "${_name}" 294 jexec -- "${_j}" pkg config "${_name}"
295 else 295 else
296 echo "${FPKG_SKIPSIGN}SKIPPED because of different userland" 296 echo "${FPKG_SKIPSIGN}SKIPPED because of different userland"
297 fi 297 fi
298 done 298 done
299 } 299 }