[PC-BSD Commits] r8128 - in pcbsd/current/system-overlay/usr: local/etc/rc.d local/share/pcbsd/scripts share/skel/Desktop
svn at pcbsd.org
svn at pcbsd.org
Wed Dec 1 16:33:58 PST 2010
Author: kris
Date: 2010-12-01 16:33:58 -0800 (Wed, 01 Dec 2010)
New Revision: 8128
Removed:
pcbsd/current/system-overlay/usr/share/skel/Desktop/portsjail.desktop
Modified:
pcbsd/current/system-overlay/usr/local/etc/rc.d/portjail
pcbsd/current/system-overlay/usr/local/share/pcbsd/scripts/portjail.sh
Log:
Update how the portjail works, it will now require init before use, since its a waste of 300+
MB of space for most end-users who never touch it
Modified: pcbsd/current/system-overlay/usr/local/etc/rc.d/portjail
===================================================================
--- pcbsd/current/system-overlay/usr/local/etc/rc.d/portjail 2010-12-01 23:52:02 UTC (rev 8127)
+++ pcbsd/current/system-overlay/usr/local/etc/rc.d/portjail 2010-12-02 00:33:58 UTC (rev 8128)
@@ -19,13 +19,13 @@
portjail_start()
{
echo "Starting Port Jail..."
- /usr/local/share/pcbsd/scripts/portjail.sh start >/dev/null 2>/dev/null
+ /usr/local/share/pcbsd/scripts/portjail.sh start rc >/dev/null 2>/dev/null
}
portjail_stop()
{
echo "Stopping Port Jail..."
- /usr/local/share/pcbsd/scripts/portjail.sh stop >/dev/null 2>/dev/null
+ /usr/local/share/pcbsd/scripts/portjail.sh stop rc >/dev/null 2>/dev/null
}
run_rc_command "$1"
Modified: pcbsd/current/system-overlay/usr/local/share/pcbsd/scripts/portjail.sh
===================================================================
--- pcbsd/current/system-overlay/usr/local/share/pcbsd/scripts/portjail.sh 2010-12-01 23:52:02 UTC (rev 8127)
+++ pcbsd/current/system-overlay/usr/local/share/pcbsd/scripts/portjail.sh 2010-12-02 00:33:58 UTC (rev 8128)
@@ -16,7 +16,6 @@
echo "--------------------------------"
echo "Usage:"
echo " portjail start - Starts the jail, root only"
-# echo " portjail start adv - Starts the jail with linprocfs and /usr/src support (advance environment), root only"
echo " portjail stop - Stops the jail, root only"
echo " portjail console - Starts a shell session within the jail"
echo " portjail run <cmd> - Runs the specified command within the jail"
@@ -33,6 +32,11 @@
if [ "$1" = "start" ]
then
+ if [ ! -d "${PJDIR}/etc" ] ; then
+ if [ "$2" = "rc" ] ; then exit 0 ; fi
+ echo "Error: The portjail is not yet installed! Please run 'portjail init' as root."
+ exit 1
+ fi
if [ "`id -u`" != "0" ]
then
@@ -111,6 +115,12 @@
elif [ "$1" = "stop" ]
then
+ if [ ! -d "${PJDIR}/etc" ] ; then
+ if [ "$2" = "rc" ] ; then exit 0 ; fi
+ echo "Error: The portjail is not yet installed! Please run 'portjail init' as root."
+ exit 1
+ fi
+
if [ "`id -u`" != "0" ]
then
echo "Error: You must be root to stop the ports jail"
@@ -134,6 +144,14 @@
elif [ "$1" = "console" ]
then
+
+ if [ ! -d "${PJDIR}/etc" ] ; then
+ echo "Error: The portjail is not yet installed! Please run 'portjail init' as root."
+ echo "Press ENTER to exit"
+ read tmp
+ exit 1
+ fi
+
DBUS_SESSION_BUS_ADDRESS="" ; export DBUS_SESSION_BUS_ADDRESS
PJID=`jls | grep "${PJDIR}" | tr -s " " | awk '{ print $1 }'`
/usr/local/sbin/jailme $PJID /bin/csh
@@ -141,6 +159,13 @@
elif [ "$1" = "run" ]
then
+ if [ ! -d "${PJDIR}/etc" ] ; then
+ echo "Error: The portjail is not yet installed! Please run 'portjail init' as root."
+ echo "Press ENTER to exit"
+ read tmp
+ exit 1
+ fi
+
if [ -z "$2" ]
then
echo "Error: No command specified!"
@@ -151,5 +176,35 @@
PJID=`jls | grep "${PJDIR}" | tr -s " " | awk '{ print $1 }'`
/usr/local/sbin/jailme $PJID $2
+elif [ "$1" = "init" ]
+then
+ # Setup a new portjail
+
+ if [ "`id -u`" != "0" ] ; then
+ echo "Error: You must be root to setup the ports jail."
+ exit 1
+ fi
+
+ if [ ! -e "/usr/src/COPYRIGHT" ] ; then
+ echo "Error: You will need a copy of FreeBSD sources in /usr/src to build the portjail."
+ echo "You may checkout sources via the System Manager, CVS, SVN or other method."
+ exit 1
+ fi
+
+ # Preparing to build the jail
+ echo "Starting build of portsjail, this may take a while..."
+ sleep 5
+ cd /usr/src
+ make buildworld installworld distribution DESTDIR=${PJDIR}
+ if [ "$?" != "0" ] ; then
+ echo "Error: The portjail build failed! Please check your sources and try again."
+ exit 1
+ fi
+
+ # Make the home link
+ mkdir -p ${PJDIR}/portjail/usr/home
+ ln -s /usr/home ${PJDIR}/portjail/home
+
+ echo "Portjail setup finished! Please run 'portjail start' to enable the jail."
fi
More information about the Commits
mailing list