Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Oct 2006 17:00:45 +0300
From:      Ivailo Tanusheff <i.tanusheff@procreditbank.bg>
To:        futhwo <futhwo@gmail.com>
Cc:        FreeBSD Questions <questions@freebsd.org>, owner-freebsd-questions@freebsd.org
Subject:   Re: Updating jails
Message-ID:  <OF208BD1CF.F6EE6FF6-ONC22571FD.004CA630-C22571FD.004D7A97@procreditbank.bg>
In-Reply-To: <7B0D645C-4EA3-4249-B7EB-5833F23824EF@gmail.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
I may give you a script how to update ports in the jails. You just need to 
have the same ports installed on your base system and build them with 
making a package ready for instalation. Personally I use: 
PACKAGES=/usr/ports/packages /usr/local/sbin/portupgrade -v -i -a -y -p

Then if you have made jails in /usr/local/jails use the following script:

#!/bin/sh

echo "***********************************"
echo "*                                 *"
echo "*    Preparing mount points       *"
echo "*                                 *"
echo "***********************************"

/sbin/mount_nullfs /usr/ports/ /usr/local/jails/<jail1>/usr/ports
/sbin/mount_nullfs /usr/ports/ /usr/local/jails/<jail2>/usr/ports
...
/sbin/mount_nullfs /usr/ports/ /usr/local/jails/<jailn>/usr/ports

echo ""
echo ""
echo "***********************************"
echo "*                                 *"
echo "*    Executing update script      *"
echo "*                                 *"
echo "***********************************"
echo ""
echo ""

for jid in `/usr/sbin/jls | /usr/bin/cut -c 1-6`; do
  if [ $jid != "JID" ]; then
    echo "Updating:"
    echo `/usr/sbin/jls | /usr/bin/grep JID`
    echo `/usr/sbin/jls | /usr/bin/grep " $jid "`
    echo -n "Continue with upgrade [y/n]: "
    read oks
    if [ "x$oks" = "xn" -o "x$oks" = "xN" ]; then
      echo "Skipping JID=$jid"
      echo ""
      echo ""
    else
      /usr/sbin/jexec $jid /usr/local/bin/updateports.sh
    fi
  fi
done


echo ""
echo ""
echo "***********************************"
echo "*                                 *"
echo "*    Removing mount points        *"
echo "*                                 *"
echo "***********************************"
echo ""
echo ""

/sbin/umount /usr/local/jails/<jail1>/usr/ports
/sbin/umount /usr/local/jails/<jail2>/usr/ports
....
/sbin/umount /usr/local/jails/<jailn>/usr/ports


This asks you for updating particular jail and executes 
/usr/local/bin/updateports.sh in each jail (you should copy it in every 
jail). You can use this:

#!/usr/local/bin/bash


echo "************************************************"
echo "*                                              *"
echo "*         Updating indexes                     *"
echo "*                                              *"
echo "************************************************"


/usr/local/sbin/portsdb -u


echo "************************************************"
echo "*                                              *"
echo "*         Fixing database                      *"
echo "*                                              *"
echo "************************************************"



/usr/local/sbin/pkgdb -Fv



echo "************************************************"
echo "*                                              *"
echo "*         Updating ports                       *"
echo "*                                              *"
echo "************************************************"



/usr/local/sbin/portupgrade -v -i -a -y -f -PP


That is what I use in my jails. Hope this will help you :)
Regards,

Ivailo Tanusheff
Deputy Head of IT Department
ProCredit Bank (Bulgaria) AD





futhwo <futhwo@gmail.com> 
Sent by: owner-freebsd-questions@freebsd.org
04.10.2006 16:24

To
FreeBSD Questions <questions@freebsd.org>
cc

Subject
Updating jails






Hi
We have an infrastructure composed by a few physical servers that 
contains some full jails (up to 10 jails per server). I am wondering 
what's the better and fastest way to bring the jails up-to-date when 
a new patchlevel or minor version is released and installed on the 
host system. This method would better be unattended, but it's not a 
requirement.

Hi
Ivan
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
"freebsd-questions-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?OF208BD1CF.F6EE6FF6-ONC22571FD.004CA630-C22571FD.004D7A97>