[PC-BSD Commits] r1996 - pcbsd-projects/warden/scripts/backend

svn at pcbsd.org svn at pcbsd.org
Fri May 30 09:23:15 PDT 2008


Author: kris
Date: 2008-05-30 09:23:14 -0700 (Fri, 30 May 2008)
New Revision: 1996

Modified:
   pcbsd-projects/warden/scripts/backend/installinmate.sh
   pcbsd-projects/warden/scripts/backend/mkinmate.sh
Log:

Added feature to inmates to run scripts outside of jail environement for
user interaction via kdialog



Modified: pcbsd-projects/warden/scripts/backend/installinmate.sh
===================================================================
--- pcbsd-projects/warden/scripts/backend/installinmate.sh	2008-05-29 23:15:04 UTC (rev 1995)
+++ pcbsd-projects/warden/scripts/backend/installinmate.sh	2008-05-30 16:23:14 UTC (rev 1996)
@@ -101,9 +101,28 @@
 
 # Export our varibles for the scripts  
 IDIR="/.tmp.$$" ; export IDIR
-export IP
+JLOC="${JDIR}/${IP}"
+export IP JLOC
 
-# Check if we have a preinstall.sh script, and run it first
+# Check if we have a preinstall-ext.sh script, and run it externally
+if [ -e "${JDIR}/${IP}/.tmp.$$/preinstall-ext.sh" ]
+then
+  ${JDIR}/${IP}/.tmp.$$/preinstall-ext.sh
+  if [ "$?" = "2" ]
+  then
+
+    # Remove the created dir in the jail
+    rm -rf ${JDIR}/${IP}/.tmp.$$
+
+    # Remove the tmp directory
+    cd ${WTMP}
+    rm -rf tmp.$$
+
+    exit 2
+  fi
+fi
+
+# Check if we have a preinstall.sh script, and run it in the jail
 if [ -e "${JDIR}/${IP}/.tmp.$$/preinstall.sh" ]
 then
   chroot ${JDIR}/${IP} /.tmp.$$/preinstall.sh 
@@ -143,7 +162,13 @@
 
 echo "Done"
 
-# Check if we have a postinstall.sh script, and run it
+# Check if we have a postinstall-ext.sh script, and run it externally
+if [ -e "${JDIR}/${IP}/.tmp.$$/postinstall-ext.sh" ]
+then
+  ${JDIR}/${IP}/.tmp.$$/postinstall-ext.sh
+fi
+
+# Check if we have a postinstall.sh script, and run it in jail
 if [ -e "${JDIR}/${IP}/.tmp.$$/postinstall.sh" ]
 then
   chroot ${JDIR}/${IP} /.tmp.$$/postinstall.sh

Modified: pcbsd-projects/warden/scripts/backend/mkinmate.sh
===================================================================
--- pcbsd-projects/warden/scripts/backend/mkinmate.sh	2008-05-29 23:15:04 UTC (rev 1995)
+++ pcbsd-projects/warden/scripts/backend/mkinmate.sh	2008-05-30 16:23:14 UTC (rev 1996)
@@ -63,12 +63,25 @@
   echo "preinstall.sh: OK"
 fi
 
+if [ -e "${IDIR}/preinstall-ext.sh" ]
+then
+  chmod 755 ${IDIR}/preinstall-ext.sh
+  echo "preinstall-ext.sh: OK"
+fi
+
+
 if [ -e "${IDIR}/postinstall.sh" ]
 then
   chmod 755 ${IDIR}/postinstall.sh
   echo "postinstall.sh: OK"
 fi
 
+if [ -e "${IDIR}/postinstall-ext.sh" ]
+then
+  chmod 755 ${IDIR}/postinstall-ext.sh
+  echo "postinstall-ext.sh: OK"
+fi
+
 if [ -e "${IDIR}/uninstall.sh" ]
 then
   chmod 755 ${IDIR}/uninstall.sh



More information about the Commits mailing list