[PC-BSD Commits] r19821 - in pcbsd/branches/9.1/src-sh/warden: bin scripts/backend

svn at pcbsd.org svn at pcbsd.org
Fri Oct 19 14:56:27 PDT 2012


Author: kris
Date: 2012-10-19 21:56:27 +0000 (Fri, 19 Oct 2012)
New Revision: 19821

Modified:
   pcbsd/branches/9.1/src-sh/warden/bin/warden
   pcbsd/branches/9.1/src-sh/warden/scripts/backend/checkupdates.sh
   pcbsd/branches/9.1/src-sh/warden/scripts/backend/chrootjail.sh
   pcbsd/branches/9.1/src-sh/warden/scripts/backend/createjail.sh
   pcbsd/branches/9.1/src-sh/warden/scripts/backend/exportjail.sh
   pcbsd/branches/9.1/src-sh/warden/scripts/backend/functions.sh
   pcbsd/branches/9.1/src-sh/warden/scripts/backend/importjail.sh
   pcbsd/branches/9.1/src-sh/warden/scripts/backend/listjails.sh
   pcbsd/branches/9.1/src-sh/warden/scripts/backend/setupusers.sh
   pcbsd/branches/9.1/src-sh/warden/scripts/backend/startjail.sh
   pcbsd/branches/9.1/src-sh/warden/scripts/backend/stopjail.sh
Log:

MFC fix for meta-data getting exported properly



Modified: pcbsd/branches/9.1/src-sh/warden/bin/warden
===================================================================
--- pcbsd/branches/9.1/src-sh/warden/bin/warden	2012-10-19 21:54:31 UTC (rev 19820)
+++ pcbsd/branches/9.1/src-sh/warden/bin/warden	2012-10-19 21:56:27 UTC (rev 19821)
@@ -618,11 +618,11 @@
          if [ ! -e "${JDIR}/${IP}" ] ; then exit_err "No such jail!"; fi
 
 	 set_warden_metadir
-	 if [ -e "${JMETADIR}/linuxjail" ] ; then exit_err "Cannot change type on Linux jail!"; fi
+	 if [ -e "${JMETADIR}/jail-linux" ] ; then exit_err "Cannot change type on Linux jail!"; fi
 
 	 case $TYPE in
 	   portjail) mkportjail "${JDIR}/${IP}" ;;
-	   standard) rm ${JMETADIR}/xjail >/dev/null 2>/dev/null ;;
+	   standard) rm ${JMETADIR}/jail-portjail >/dev/null 2>/dev/null ;;
 	   *) exit_err "Invalid TYPE" ;;
          esac
          ;;

Modified: pcbsd/branches/9.1/src-sh/warden/scripts/backend/checkupdates.sh
===================================================================
--- pcbsd/branches/9.1/src-sh/warden/scripts/backend/checkupdates.sh	2012-10-19 21:54:31 UTC (rev 19820)
+++ pcbsd/branches/9.1/src-sh/warden/scripts/backend/checkupdates.sh	2012-10-19 21:56:27 UTC (rev 19821)
@@ -41,7 +41,7 @@
     if [ ! -e "${i}/ip" ] ; then continue ; fi
     IP="`cat ${i}/ip`"
     set_warden_metadir
-    if [ -e "${JMETADIR}/linuxjail" ] ; then continue; fi
+    if [ -e "${JMETADIR}/jail-linux" ] ; then continue; fi
 
     echo "Checking for jail updates to ${IP}"
     echo "################################################"
@@ -55,7 +55,7 @@
 else
   set_warden_metadir
   
-  if [ -e "${JMETADIR}/linuxjail" ] ; then
+  if [ -e "${JMETADIR}/jail-linux" ] ; then
     echo "ERROR: Cannot check for updates to Linux Jails.. Please use any included Linux utilities for your disto."
     exit 5
   fi

Modified: pcbsd/branches/9.1/src-sh/warden/scripts/backend/chrootjail.sh
===================================================================
--- pcbsd/branches/9.1/src-sh/warden/scripts/backend/chrootjail.sh	2012-10-19 21:54:31 UTC (rev 19820)
+++ pcbsd/branches/9.1/src-sh/warden/scripts/backend/chrootjail.sh	2012-10-19 21:56:27 UTC (rev 19821)
@@ -42,8 +42,8 @@
 # Get the JailID for this jail
 JID="`jls | grep ${JDIR}/${IP} | tr -s " " | cut -d " " -f 2`"
 
-# If on an xjail, make display available
-if [ -e "${JMETADIR}/xjail" ] ; then
+# If on an portjail, make display available
+if [ -e "${JMETADIR}/jail-portjail" ] ; then
   HOST="`cat ${JMETADIR}/host`"
   xhost + 2>/dev/null >/dev/null
 else
@@ -58,7 +58,7 @@
 
 if [ -z "$2" ] ; then
   echo "Started shell session on ${IP}. Type exit when finished."
-  if [ -e "${JMETADIR}/linuxjail" ] ; then
+  if [ -e "${JMETADIR}/jail-linux" ] ; then
     jailme ${JID} /bin/bash
   else
     jailme ${JID} /bin/csh

Modified: pcbsd/branches/9.1/src-sh/warden/scripts/backend/createjail.sh
===================================================================
--- pcbsd/branches/9.1/src-sh/warden/scripts/backend/createjail.sh	2012-10-19 21:54:31 UTC (rev 19820)
+++ pcbsd/branches/9.1/src-sh/warden/scripts/backend/createjail.sh	2012-10-19 21:56:27 UTC (rev 19821)
@@ -12,7 +12,7 @@
   if [ "$STARTUP" = "YES" ] ; then
     touch "${JMETADIR}/autostart"
   fi
-  touch "${JMETADIR}/linuxjail"
+  touch "${JMETADIR}/jail-linux"
 
   sh ${LINUX_JAIL_SCRIPT} "${JDIR}/${IP}" "${IP}" "${JMETADIR}"
   if [ $? -ne 0 ] ; then
@@ -193,9 +193,6 @@
   touch "${JMETADIR}/autostart"
 fi
 
-# Set some default flags for the jail
-echo "allow.raw_sockets=true" > ${JMETADIR}/jail-flags
-
 # Set the default meta-pkg set
 mkdir -p ${JDIR}/${IP}/usr/local/etc >/dev/null 2>/dev/null
 echo "PCBSD_METAPKGSET: warden" > ${JDIR}/${IP}/usr/local/etc/pcbsd.conf

Modified: pcbsd/branches/9.1/src-sh/warden/scripts/backend/exportjail.sh
===================================================================
--- pcbsd/branches/9.1/src-sh/warden/scripts/backend/exportjail.sh	2012-10-19 21:54:31 UTC (rev 19820)
+++ pcbsd/branches/9.1/src-sh/warden/scripts/backend/exportjail.sh	2012-10-19 21:56:27 UTC (rev 19821)
@@ -52,12 +52,6 @@
 
 LINES="`wc -l ${IP}.files | sed -e 's, ,,g' | cut -d '.' -f 1`"
 
-# Save any optional jail flags
-if [ -e "${JMETADIR}/jail-flags" ] ; then
-  JFLAGS="`cat ${JMETADIR}/jail-flags`"
-else
-  JFLAGS=""
-fi
 
 # Finished, now make the header info
 cd ${WTMP}
@@ -67,11 +61,13 @@
 Files: $LINES
 IP: ${IP}
 HOST: ${HOST}
-JFLAGS: ${JFLAGS}
 " >${WTMP}/${IP}.header
 
+# Copy over jail extra meta-data
+cp ${JMETADIR}/jail-* ${WTMP}/ 2>/dev/null
+
 # Compress the header file
-tar cvzf ${IP}.header.tgz ${IP}.header 2>/dev/null
+tar cvzf ${IP}.header.tgz ${IP}.header jail-* 2>/dev/null
 
 # Create our spacer
 echo "

Modified: pcbsd/branches/9.1/src-sh/warden/scripts/backend/functions.sh
===================================================================
--- pcbsd/branches/9.1/src-sh/warden/scripts/backend/functions.sh	2012-10-19 21:54:31 UTC (rev 19820)
+++ pcbsd/branches/9.1/src-sh/warden/scripts/backend/functions.sh	2012-10-19 21:56:27 UTC (rev 19821)
@@ -167,7 +167,7 @@
   # 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 ${JMETADIR}/xjail
+  touch ${JMETADIR}/jail-portjail
 }
 
 mkZFSSnap() {

Modified: pcbsd/branches/9.1/src-sh/warden/scripts/backend/importjail.sh
===================================================================
--- pcbsd/branches/9.1/src-sh/warden/scripts/backend/importjail.sh	2012-10-19 21:54:31 UTC (rev 19820)
+++ pcbsd/branches/9.1/src-sh/warden/scripts/backend/importjail.sh	2012-10-19 21:56:27 UTC (rev 19821)
@@ -102,21 +102,14 @@
     FHOST="`echo $line | cut -d ' ' -f 2-10`"
   fi
 
-  # Check for jail flags
-  echo "$line" | grep -q "JFLAGS:"
-  if [ $? -eq 0 ]; then
-    JFLAGS="`echo $line | sed 's|JFLAGS: ||g'`"
-  fi
-  
 done < $HEADER 
 
 cd ..
-rm -rf tmp.$$ 2>/dev/null
 
 # Make sure this is a file version we understand
-if [ "${VER}" != "1.0" ]
-then
+if [ "${VER}" != "1.0" ]; then
     echo "ERROR: Specified file is a incompatiable .wdn file!"
+    rm -rf tmp.$$ 2>/dev/null
     exit 7
 fi
 
@@ -134,6 +127,7 @@
   if [ -e "${JDIR}/${FIP}" ]
   then
     echo "ERROR: A Jail already exists with IP: $FIP"
+    rm -rf tmp.$$ 2>/dev/null
     exit 7
   fi
  
@@ -159,6 +153,12 @@
 set_warden_metadir
 mkdir ${JMETADIR}
 
+# Copy over extra jail flags
+cp tmp.$$/jail-* ${JMETADIR}/ 2>/dev/null
+
+# Cleanup tmp meta-dir
+rm -rf tmp.$$ 2>/dev/null
+
 # Extract the jail contents
 tail +${SKIP} ${IFILE} | tar xpf - -C "${JDIR}/${IP}" 2>/dev/null
 

Modified: pcbsd/branches/9.1/src-sh/warden/scripts/backend/listjails.sh
===================================================================
--- pcbsd/branches/9.1/src-sh/warden/scripts/backend/listjails.sh	2012-10-19 21:54:31 UTC (rev 19820)
+++ pcbsd/branches/9.1/src-sh/warden/scripts/backend/listjails.sh	2012-10-19 21:56:27 UTC (rev 19821)
@@ -42,9 +42,9 @@
   fi
  
   # Figure out the type of jail
-  if [ -e "${i}/xjail" ] ; then
+  if [ -e "${i}/jail-portjail" ] ; then
     TYPE="portjail"
-  elif [ -e "${i}/linuxjail" ] ; then
+  elif [ -e "${i}/jail-linux" ] ; then
     TYPE="linuxjail"
   else
     TYPE="standard"

Modified: pcbsd/branches/9.1/src-sh/warden/scripts/backend/setupusers.sh
===================================================================
--- pcbsd/branches/9.1/src-sh/warden/scripts/backend/setupusers.sh	2012-10-19 21:54:31 UTC (rev 19820)
+++ pcbsd/branches/9.1/src-sh/warden/scripts/backend/setupusers.sh	2012-10-19 21:56:27 UTC (rev 19821)
@@ -48,7 +48,7 @@
 
 echo -e "Changing root password on: ${IP} \c"
 
-if [ -e "${JMETADIR}/linuxjail" ] ; then
+if [ -e "${JMETADIR}/jail-linux" ] ; then
 
   echo '#!/bin/bash
 echo -e "${ROOTPW}\n${ROOTPW}" | passwd root

Modified: pcbsd/branches/9.1/src-sh/warden/scripts/backend/startjail.sh
===================================================================
--- pcbsd/branches/9.1/src-sh/warden/scripts/backend/startjail.sh	2012-10-19 21:54:31 UTC (rev 19820)
+++ pcbsd/branches/9.1/src-sh/warden/scripts/backend/startjail.sh	2012-10-19 21:56:27 UTC (rev 19821)
@@ -46,7 +46,7 @@
 
 set_warden_metadir
 
-if [ -e "${JMETADIR}/linuxjail" ] ; then
+if [ -e "${JMETADIR}/jail-linux" ] ; then
    LINUXJAIL="YES"
 fi
 
@@ -90,7 +90,7 @@
      mount -t procfs proc "${JDIR}/${IP}/proc"
   fi
 
-  if [ -e "${JMETADIR}/xjail" ] ; then mountjailxfs ${IP} ; fi
+  if [ -e "${JMETADIR}/jail-portjail" ] ; then mountjailxfs ${IP} ; fi
 fi
 
 IPS="${IP}"

Modified: pcbsd/branches/9.1/src-sh/warden/scripts/backend/stopjail.sh
===================================================================
--- pcbsd/branches/9.1/src-sh/warden/scripts/backend/stopjail.sh	2012-10-19 21:54:31 UTC (rev 19820)
+++ pcbsd/branches/9.1/src-sh/warden/scripts/backend/stopjail.sh	2012-10-19 21:56:27 UTC (rev 19821)
@@ -47,7 +47,7 @@
 echo -e ".\c"
 
 # Check if we need umount x mnts
-if [ -e "${JMETADIR}/xjail" ] ; then umountjailxfs ${IP} ; fi
+if [ -e "${JMETADIR}/jail-portjail" ] ; then umountjailxfs ${IP} ; fi
 
 # Get list of IPs for this jail
 IPS="${IP}"
@@ -74,7 +74,7 @@
   echo -e ".\c"
 done
 
-if [ -e "${JMETADIR}/linuxjail" ] ; then LINUXJAIL="YES" ; fi
+if [ -e "${JMETADIR}/jail-linux" ] ; then LINUXJAIL="YES" ; fi
 
 if [ "$LINUXJAIL" = "YES" ] ; then
   # If we have a custom stop script
@@ -168,7 +168,7 @@
   umount -f "${JDIR}/${IP}/proc"
 fi
 
-if [ -e "${JMETADIR}/xjail" ] ; then
+if [ -e "${JMETADIR}/jail-portjail" ] ; then
   umountjailxfs
 fi
 



More information about the Commits mailing list