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

svn at pcbsd.org svn at pcbsd.org
Tue Mar 6 06:57:58 PST 2012


Author: kris
Date: 2012-03-06 14:57:58 +0000 (Tue, 06 Mar 2012)
New Revision: 15707

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

Let us create a jail as a portjail initially



Modified: pcbsd/current/src-qt4/warden/bin/warden
===================================================================
--- pcbsd/current/src-qt4/warden/bin/warden	2012-03-06 14:39:13 UTC (rev 15706)
+++ pcbsd/current/src-qt4/warden/bin/warden	2012-03-06 14:57:58 UTC (rev 15707)
@@ -318,6 +318,7 @@
   --src       (Includes /usr/src system source)
   --ports     (Includes the ports tree)
   --startauto (Start this jail at system boot)
+  --portjail  (Make this a portjail)
 
 Usage:
 
@@ -385,16 +386,7 @@
          fi
 
 	 case $TYPE in
-	   portjail) ETCFILES="resolv.conf passwd master.passwd spwd.db pwd.db group localtime"
-		     for file in ${ETCFILES}; do
-    		       rm ${JDIR}/${IP}/etc/${file} >/dev/null 2>&1
-                       cp /etc/${file} ${JDIR}/${IP}/etc/${file}
-                     done
-		     # Make sure we remove our cleartmp rc.d script, causes issues
-                     [ -e "${JDIR}/${IP}/etc/rc.d/cleartmp" ] && rm ${JDIR}/${IP}/etc/rc.d/cleartmp
-		     # Flag this type
-		     touch ${JDIR}/${IP}/etc/.wardenxjail
-                     ;;
+	   portjail) mkportjail "${JDIR}/${IP}" ;;
 	   standard) rm ${JDIR}/${IP}/etc/.wardenxjail >/dev/null 2>/dev/null ;;
 	   *) echo "Invalid TYPE" ; exit 1 ;;
          esac
@@ -670,12 +662,14 @@
          SRC="NO"
          PORTS="NO"
          AUTO="NO"
+         PORTJAIL="NO"
          for i in "$@"
          do
            case $i in
              --src) SRC="YES" ;;
              --ports) PORTS="YES" ;;
              --startauto) AUTO="YES" ;;
+             --portjail) PORTJAIL="YES" ;;
            esac
          done
 
@@ -687,7 +681,7 @@
          fi  
 
           # Passed all tests, create the jail now
-          ${PROGDIR}/scripts/backend/createjail.sh "${IP}" "${HOST}" "${SRC}" "${PORTS}" "${AUTO}"
+          ${PROGDIR}/scripts/backend/createjail.sh "${IP}" "${HOST}" "${SRC}" "${PORTS}" "${AUTO}" "${PORTJAIL}"
 
         ;;
   delete) require_root

Modified: pcbsd/current/src-qt4/warden/scripts/backend/createjail.sh
===================================================================
--- pcbsd/current/src-qt4/warden/scripts/backend/createjail.sh	2012-03-06 14:39:13 UTC (rev 15706)
+++ pcbsd/current/src-qt4/warden/scripts/backend/createjail.sh	2012-03-06 14:57:58 UTC (rev 15707)
@@ -14,6 +14,7 @@
 SOURCE="${3}"
 PORTS="${4}"
 STARTUP="${5}"
+PORTJAIL="${6}"
 
 if [ -z "$IP" -o -z "${HOST}" -o -z "$SOURCE" -o -z "${PORTS}" -o -z "${STARTUP}" ] 
 then
@@ -98,6 +99,9 @@
 # Copy over the pbid scripts
 checkpbiscripts "${JDIR}/${IP}"
 
+# Check if making a portjail
+if [ "$PORTJAIL" = "YES" ] ; then mkportjail "${JDIR}/${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 14:39:13 UTC (rev 15706)
+++ pcbsd/current/src-qt4/warden/scripts/backend/functions.sh	2012-03-06 14:57:58 UTC (rev 15707)
@@ -197,3 +197,16 @@
      rm ${1}/warden-repo.rpo
   fi
 }
+
+mkportjail() {
+  if [ -z "${1}" ] ; then return ; fi
+  ETCFILES="resolv.conf passwd master.passwd spwd.db pwd.db group localtime"
+  for file in ${ETCFILES}; do
+    rm ${1}/etc/${file} >/dev/null 2>&1
+    cp /etc/${file} ${1}/etc/${file}
+  done
+  # Make sure we remove our cleartmp rc.d script, causes issues
+  [ -e "${1}/etc/rc.d/cleartmp" ] && rm ${1}/etc/rc.d/cleartmp
+  # Flag this type
+  touch ${1}/etc/.wardenxjail
+}



More information about the Commits mailing list