Excluding some jails from upgrade

I have some jails already updated to FreeBSD 14 – let’s get a list of what needs to be updated.

This cold just as easily be used to get a list of what not to upgrade, if you didn’t want to update all jails right now.

These jails are already updated:

[15:30 r730-01 dvl ~] % file /jails/*/bin/sh | grep 14                         
/jails/bacula/bin/sh:            ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 14.0 (1400097), FreeBSD-style, stripped
/jails/certs/bin/sh:             ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 14.0 (1400097), FreeBSD-style, stripped
/jails/cliff2/bin/sh:            ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 14.0 (1400097), FreeBSD-style, stripped
/jails/dns1/bin/sh:              ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 14.0 (1400097), FreeBSD-style, stripped
/jails/git/bin/sh:               ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 14.0 (1400097), FreeBSD-style, stripped
/jails/pkg01/bin/sh:             ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 14.0 (1400097), FreeBSD-style, stripped

Let’s get the list which excludes the above. I added the names manually, but you could script them.

[15:30 r730-01 dvl ~] % jls name | egrep -v 'bacula|certs|cliff2|dns1|git|pkg01'
mysql01
pg01
pg02
pg03
dev-ingress01
dev-nginx01
test-ingress01
test-nginx01
stage-ingress01
stage-nginx01
besser
svn
webserver
dev-pgeu
mqtt01
jail-testing
talos
samdrucker
fileserver
mydev
jail_within_jail
serpico
dns-hidden-master
nsnotify
unifi01

Now sort and get one line:

[15:31 r730-01 dvl ~] % jls name | egrep -v 'bacula|certs|cliff2|dns1|git|pkg01' | sort | xargs
besser dev-ingress01 dev-nginx01 dev-pgeu dns-hidden-master fileserver jail-testing jail_within_jail mqtt01 mydev mysql01 nsnotify pg01 pg02 pg03 samdrucker serpico stage-ingress01 stage-nginx01 svn talos test-ingress01 test-nginx01 unifi01 webserver

I created this script:

[15:35 r730-01 dvl ~] % cat ~/tmp/mkjail-some.sh
#!/bin/sh

JAILS="besser dev-ingress01 dev-nginx01 dev-pgeu dns-hidden-master fileserver jail-testing jail_within_jail mqtt01 mydev mysql01 nsnotify pg01 pg02 pg03 samdrucker serpico stage-ingress01 stage-nginx01 svn talos test-ingress01 test-nginx01 unifi01 webserver"

for jail in ${JAILS}
do
  sudo mkjail upgrade -v 14.0-RELEASE -j ${jail}
done

And ran it:

[15:35 r730-01 dvl ~] % chmod +x ~/tmp/mkjail-some.sh
[15:35 r730-01 dvl ~] % ~/tmp/mkjail-some.sh 
Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top