[PC-BSD Commits] r15711 - in pcbsd/current/src-qt4/warden: bin scripts/backend

svn at pcbsd.org svn at pcbsd.org
Tue Mar 6 07:19:11 PST 2012


Author: kris
Date: 2012-03-06 15:19:11 +0000 (Tue, 06 Mar 2012)
New Revision: 15711

Modified:
   pcbsd/current/src-qt4/warden/bin/warden
   pcbsd/current/src-qt4/warden/scripts/backend/checkstatus.sh
   pcbsd/current/src-qt4/warden/scripts/backend/createjail.sh
   pcbsd/current/src-qt4/warden/scripts/backend/functions.sh
Log:

Auto start jails when flag is set, also add some additional checks to ensure
we don't delete a jail with leftover mounts in it



Modified: pcbsd/current/src-qt4/warden/bin/warden
===================================================================
--- pcbsd/current/src-qt4/warden/bin/warden	2012-03-06 15:13:28 UTC (rev 15710)
+++ pcbsd/current/src-qt4/warden/bin/warden	2012-03-06 15:19:11 UTC (rev 15711)
@@ -714,11 +714,17 @@
 
           # Check if this jail is running
           ${PROGDIR}/scripts/backend/checkstatus.sh "${IP}"
-          if [ "$?" = "0" ]
-          then
+          if [ "$?" = "0" ] ; then
             ${PROGDIR}/scripts/backend/stopjail.sh "${IP}"
           fi
 
+          # Check if this jail is STILL running
+          ${PROGDIR}/scripts/backend/checkstatus.sh "${IP}"
+          if [ "$?" = "0" ] ; then
+	     echo "Error: Jail still is running or has leftovers.."
+	     exit 1
+          fi
+
           # Delete it now
           ${PROGDIR}/scripts/backend/deletejail.sh "${IP}"
         ;;

Modified: pcbsd/current/src-qt4/warden/scripts/backend/checkstatus.sh
===================================================================
--- pcbsd/current/src-qt4/warden/scripts/backend/checkstatus.sh	2012-03-06 15:13:28 UTC (rev 15710)
+++ pcbsd/current/src-qt4/warden/scripts/backend/checkstatus.sh	2012-03-06 15:19:11 UTC (rev 15711)
@@ -32,10 +32,15 @@
 # End of error checking, now see if the jail is active
 #####################################################################
 
+# Check if anything is still mounted in this jail
+hasmount="0"
+for mountpoint in $(mount | grep ${JDIR}/${IP} | cut -d" " -f3); do
+  hasmount="1"
+done
+
 # Check if the jail is active
 jls | grep ${IP} >/dev/null 2>/dev/null
-if [ "$?" = "0" ]
-then
+if [ "$?" = "0" -o "$hasmount" = "1" ]; then
   exit 0
 else
   exit 1

Modified: pcbsd/current/src-qt4/warden/scripts/backend/createjail.sh
===================================================================
--- pcbsd/current/src-qt4/warden/scripts/backend/createjail.sh	2012-03-06 15:13:28 UTC (rev 15710)
+++ pcbsd/current/src-qt4/warden/scripts/backend/createjail.sh	2012-03-06 15:19:11 UTC (rev 15711)
@@ -102,6 +102,9 @@
 # Check if making a portjail
 if [ "$PORTJAIL" = "YES" ] ; then mkportjail "${JDIR}/${IP}" ; fi
 
+# If we are auto-starting the jail, do it now
+if [ "$STARTUP" = "YES" ] ; then warden start ${IP} ; fi
+
 echo "Success! Jail created at ${JDIR}/${IP}"
 
 exit 0

Modified: pcbsd/current/src-qt4/warden/scripts/backend/functions.sh
===================================================================
--- pcbsd/current/src-qt4/warden/scripts/backend/functions.sh	2012-03-06 15:13:28 UTC (rev 15710)
+++ pcbsd/current/src-qt4/warden/scripts/backend/functions.sh	2012-03-06 15:19:11 UTC (rev 15711)
@@ -189,6 +189,15 @@
   mkdir -p ${1}/usr/local/etc/rc.d >/dev/null 2>/dev/null
   cp /usr/local/etc/rc.d/pbid ${1}/usr/local/etc/rc.d/
 
+  # Copy any PBI manpages
+  for man in `find /usr/local/man | grep pbi`
+  do
+    if [ ! -d "${1}`dirname $man`" ] ; then
+      mkdir -p "${1}`dirname $man`"
+    fi
+    cp "${man}" "${1}${man}"
+  done
+
   # Install repo in jail
   if [ ! -e "${1}/var/db/pbi-warden/keys" ] ; then
      cp ${PROGDIR}/repo/warden-repo.rpo ${1}/



More information about the Commits mailing list