scripts/FreeBSD/jail/jail-update.csh

33 lines
703 B
Tcsh
Raw Permalink Normal View History

#!/bin/csh
# upgrade host packages
echo ""
echo "############ UPGRADE HOST PACKAGES ############"
echo ""
pkg update
pkg upgrade -y
pkg clean -ya
# upgrade jail packages
echo ""
echo "############ UPGRADE JAIL PACKAGES ############"
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 $jailname"
pkg -j $jailid update
pkg -j $jailid upgrade -y
pkg -j $jailid clean -ay
end
# report done
echo ""
echo "############### ALL DONE THANKS ###############"
echo ""