[Jail Update] Use jls now for finding jails

This commit is contained in:
Simon Cornet 2022-02-01 20:20:40 +01:00
parent a330e46647
commit dcaf20173c

View File

@ -1,32 +1,33 @@
#!/bin/csh
# Upgrade host packages
# upgrade host packages
echo ""
echo "############ UPGRADE HOST PACKAGES ############"
echo ""
pkg update && \
pkg upgrade -y && \
pkg update
pkg upgrade -y
pkg clean -ya
# Upgrade jail packages
# upgrade jail packages
echo ""
echo "############ UPGRADE JAIL PACKAGES ############"
foreach jail (`ls /usr/jails | \
grep -v basejail | \
grep -v ezjail_archives | \
grep -v flavours | \
grep -v newjail | \
grep -v fulljail`)
foreach jailid (`/usr/sbin/jls jid`)
# get the jailname from the jailid
set jailname = `/usr/sbin/jls jid host.hostname |\
grep $jailid |\
cut -d' ' -f2`
# update the jail packages using jailid but reporitng jailname
echo ""
echo "Updating $jail"
pkg -j $jail update && \
pkg -j $jail upgrade -y && \
pkg -j $jail clean -ay
echo "Updating $jailname"
pkg -j $jailid update
pkg -j $jailid upgrade -y
pkg -j $jailid clean -ay
end
# Report done
# report done
echo ""
echo "############### ALL DONE THANKS ###############"
echo ""
echo ""