From dcaf20173c0fd4c0fe177d5b62045b1e0326cfe7 Mon Sep 17 00:00:00 2001 From: Simon Cornet Date: Tue, 1 Feb 2022 20:20:40 +0100 Subject: [PATCH] [Jail Update] Use jls now for finding jails --- FreeBSD/jail/jail-update.csh | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/FreeBSD/jail/jail-update.csh b/FreeBSD/jail/jail-update.csh index 7a978ed..828b640 100644 --- a/FreeBSD/jail/jail-update.csh +++ b/FreeBSD/jail/jail-update.csh @@ -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 "" \ No newline at end of file