From 02b7620839a428c58924153f8f9fab3cb80b486a Mon Sep 17 00:00:00 2001
From: erdgeist <erdgeist@erdgeist.org>
Date: Thu, 14 Jan 2010 02:11:03 +0000
Subject: Introduce a default flavour setting, also fix some leftovers from
 renaming default to example. Many thanks to Panagiotis J. Christias

---
 Makefile           | 2 +-
 ezjail-admin       | 9 ++++++---
 ezjail.conf.sample | 5 ++++-
 man5/ezjail.conf.5 | 5 +++++
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 1ad6144..0b980e9 100755
--- a/Makefile
+++ b/Makefile
@@ -17,4 +17,4 @@ install:
 	sed s:EZJAIL_PREFIX:${PREFIX}: man5/ezjail.5 > ${PREFIX}/man/man5/ezjail.5
 	chmod 755 ${PREFIX}/etc/rc.d/ezjail.sh ${PREFIX}/bin/ezjail-admin
 	chown -R root:wheel ${PREFIX}/man/man1/ezjail-admin.1 ${PREFIX}/man/man5/ezjail.conf.5 ${PREFIX}/man/man5/ezjail.5 ${PREFIX}/share/examples/ezjail/
-	chmod 0440 ${PREFIX}/share/examples/ezjail/default/usr/local/etc/sudoers
+	chmod 0440 ${PREFIX}/share/examples/ezjail/example/usr/local/etc/sudoers
diff --git a/ezjail-admin b/ezjail-admin
index 417eb0e..5438a56 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -268,15 +268,15 @@ ezjail_splitworld() {
   fi
 
   # If the default flavour example has not yet been copied, do it now
-  [ -d "${ezjail_flavours}/default" ] || mkdir -p "${ezjail_flavours}" && cp -p -R "${ezjail_examples}/default" "${ezjail_flavours}"
+  [ -d "${ezjail_flavours}/example" ] || mkdir -p "${ezjail_flavours}" && cp -p -R "${ezjail_examples}/example" "${ezjail_flavours}"
 
   # no /usr/ports? link to /basejail/usr/ports
   [ -e "${ezjail_jailtemplate}/usr/ports" ] || ln -s /basejail/usr/ports "${ezjail_jailtemplate}/usr/ports"
 
   # A ports collection inside jails is hardly useful w/o an appropriate
   # /etc/make.conf.
-  if [ -f "${ezjail_examples}/default/etc/make.conf" -a ! -f "${ezjail_jailtemplate}/etc/make.conf" ]; then
-    cp -p "${ezjail_examples}/default/etc/make.conf" "${ezjail_jailtemplate}/etc/"
+  if [ -f "${ezjail_examples}/example/etc/make.conf" -a ! -f "${ezjail_jailtemplate}/etc/make.conf" ]; then
+    cp -p "${ezjail_examples}/example/etc/make.conf" "${ezjail_jailtemplate}/etc/"
     echo "Note: a non-standard /etc/make.conf was copied to the template jail in order to get the ports collection running inside jails."
   fi
 
@@ -480,6 +480,9 @@ create)
     [ -e "${ezjail_softlink}" ] && ezjail_softlink=`mktemp -u "${ezjail_softlink}.XXXXXX"`
   fi
 
+  # if no flavour specified on command line, use default flavour
+  : ${ezjail_flavour=${ezjail_default_flavour}}
+
   # do some sanity checks on the selected flavour (if any)
   [ "${ezjail_flavour}" -a ! -d "${ezjail_flavours}/${ezjail_flavour}" ] && exerr "Error: Flavour config directory ${ezjail_flavours}/${ezjail_flavour} not found.\n  Refer to ${ezjail_admin}s man page for details on flavours."
 
diff --git a/ezjail.conf.sample b/ezjail.conf.sample
index 46c08bc..7aec8d5 100755
--- a/ezjail.conf.sample
+++ b/ezjail.conf.sample
@@ -27,7 +27,10 @@
 # ezjail_ftphost=ftp.freebsd.org
 
 # This is the command that is being executed by the console subcommand
-# ezjail_default_execute=/usr/bin/login -f root
+# ezjail_default_execute="/usr/bin/login -f root"
+
+# This is the flavour used by default when setting up a new jail
+# ezjail_default_flavour=""
 
 # This is the default location where ezjail archives its jails to
 # ezjail_archivedir=`pwd -P`
diff --git a/man5/ezjail.conf.5 b/man5/ezjail.conf.5
index 259d4ee..36b27c4 100755
--- a/man5/ezjail.conf.5
+++ b/man5/ezjail.conf.5
@@ -112,6 +112,11 @@ for more information).
 Set to YES, if ezjail should provide a soft link from /usr/bin/perl to /usr/local/bin/perl in base jail.
 .br
 .I default: YES
+.TP
+.B ezjail_default_flavour (str)
+Controls which flavour should be used for newly created jails.
+.br
+.I default: none
 .SH ZFS OPTIONS
 .TP
 .B ezjail_use_zfs (bool)
-- 
cgit v1.2.3