[PC-BSD Commits] r17375 - pcbsd/current/src-sh/warden/scripts/backend

svn at pcbsd.org svn at pcbsd.org
Thu Jun 21 10:05:01 PDT 2012


Author: kris
Date: 2012-06-21 17:04:59 +0000 (Thu, 21 Jun 2012)
New Revision: 17375

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

Add some more linux setup glue for jail creation



Modified: pcbsd/current/src-sh/warden/scripts/backend/createjail.sh
===================================================================
--- pcbsd/current/src-sh/warden/scripts/backend/createjail.sh	2012-06-21 16:36:00 UTC (rev 17374)
+++ pcbsd/current/src-sh/warden/scripts/backend/createjail.sh	2012-06-21 17:04:59 UTC (rev 17375)
@@ -5,9 +5,7 @@
 setup_linux_jail()
 {
   echo "Setting up linux jail..."
-  echo $LINUX_JAIL_SCRIPT
 
-
   mkdir -p ${JMETADIR}
   echo "${HOST}" > ${JMETADIR}/host
   echo "${IP}" > ${JMETADIR}/ip
@@ -16,8 +14,40 @@
   fi
   touch "${JMETADIR}/linuxjail"
 
-  exit 0
+  sh ${LINUX_JAIL_SCRIPT} "${JDIR}/${IP}" "${IP}"
+  if [ $? -ne 0 ] ; then
+     echo "Failed running ${LINUX_JAIL_SCRIPT}"
+     exit 1
+  fi
+  
+  # Create the master.passwd
+  echo "root::0:0::0:0:Charlie &:/root:/bin/bash" > ${JDIR}/${IP}/etc/master.passwd
+  pwd_mkdb -d ${JDIR}/${IP}/tmp -p ${JDIR}/${IP}/etc/master.passwd
+  mv ${JDIR}/${IP}/master.passwd ${JDIR}/${IP}/etc/
+  mv ${JDIR}/${IP}/pwd.db ${JDIR}/${IP}/etc/
+  mv ${JDIR}/${IP}/spwd.db ${JDIR}/${IP}/etc/
 
+  # Copy resolv.conf
+  cp /etc/resolv.conf ${JDIR}/${IP}/etc/resolv.conf
+
+  # Do some touch-up to make linux happy
+  echo '#!/bin/bash
+cd /etc
+pwconv
+grpconv
+touch /etc/fstab
+touch /etc/mtab
+cd /sbin
+mv consoletype consoletype.orig
+ln -s /bin/true consoletype
+cd /bin
+mv umount umount.prev
+ln -s /bin/true umount
+' > ${JDIR}/${IP}/.fixSH
+  chmod 755 ${JDIR}/${IP}/.fixSH
+  chroot ${JDIR}/${IP} /.fixSH
+  rm ${JDIR}/${IP}/.fixSH
+
   # If we are auto-starting the jail, do it now
   if [ "$STARTUP" = "YES" ] ; then warden start ${IP} ; fi
 



More information about the Commits mailing list