Skip to content
This repository
Browse code

If user gives jail template with spaces in the name, correct it

  • Loading branch information...
commit 9cc2f9cce79500f8d063abfde11963f8cbccee19 1 parent 2567eba
Kris Moore authored June 12, 2013
37  src-sh/warden/bin/warden
@@ -726,8 +726,41 @@ details) JAILNAME="${2}"
726 726
 template) require_root
727 727
          OPT="$2"
728 728
          case $OPT in
729  
-	    create) shift ; shift; ${PROGDIR}/scripts/backend/createtemplate.sh $* ;;
730  
-	    delete) delete_template $3 ;;
  729
+	    create) shift ; shift; 
  730
+		    # Read our flags
  731
+		    while [ $# -gt 0 ]; do
  732
+   		    case $1 in
  733
+    			  -fbsd) shift
  734
+           			 if [ -z "$1" ] ; then exit_err "No FreeBSD version specified"; fi
  735
+           			 FBSDVER="${1}"
  736
+          		 	 ;;
  737
+  			-trueos) shift
  738
+           			 if [ -z "$1" ] ; then exit_err "No TrueOS version specified"; fi
  739
+           			 TRUEOSVER="${1}"
  740
+           			 ;;
  741
+    			  -arch) shift
  742
+           			 if [ -z "$1" ] ; then exit_err "No FreeBSD architecture specified"; fi
  743
+           		 	 FBSDARCH="${1}"
  744
+           			 ;;
  745
+    			   -tar) shift
  746
+           		         if [ -z "$1" ] ; then exit_err "No tar file specified"; fi
  747
+           			 if [ ! -e "$1" ] ; then exit_err "Could not find tar file: $1"; fi
  748
+           			 FBSDTAR="${1}"
  749
+           	 		 ;;
  750
+    			  -nick) shift
  751
+           		   	 if [ -z "$1" ] ; then exit_err "No nickname specified"; fi
  752
+           			 TNICK="`echo ${1} | sed 's| |_|g'`"
  753
+           			 ;;
  754
+  		    -pluginjail) shift
  755
+           			 TPLUGJAIL="YES"
  756
+           			 ;;
  757
+        		      *) exit_err "Invalid option: $1" ;;
  758
+   		    esac
  759
+   		    shift
  760
+		    done
  761
+		    export TPLUGJAIL TNICK FBSDTAR FBSDARCH TRUEOSVER FBSDVER
  762
+		    ${PROGDIR}/scripts/backend/createtemplate.sh ;;
  763
+	    delete) delete_template "$3" ;;
731 764
 	      list) list_templates ;;
732 765
 	         *) help_template ; exit 1 ;;
733 766
 	 esac
32  src-sh/warden/scripts/backend/createtemplate.sh
@@ -163,38 +163,6 @@ create_template()
163 163
 };
164 164
 
165 165
 
166  
-# Read our flags
167  
-while [ $# -gt 0 ]; do
168  
-   case $1 in
169  
-    -fbsd) shift
170  
-           if [ -z "$1" ] ; then exit_err "No FreeBSD version specified"; fi
171  
-           FBSDVER="${1}"
172  
-           ;;
173  
-  -trueos) shift
174  
-           if [ -z "$1" ] ; then exit_err "No TrueOS version specified"; fi
175  
-           TRUEOSVER="${1}"
176  
-           ;;
177  
-    -arch) shift
178  
-           if [ -z "$1" ] ; then exit_err "No FreeBSD architecture specified"; fi
179  
-           FBSDARCH="${1}"
180  
-           ;;
181  
-    -tar) shift
182  
-           if [ -z "$1" ] ; then exit_err "No tar file specified"; fi
183  
-           if [ ! -e "$1" ] ; then exit_err "Could not find tar file: $1"; fi
184  
-           FBSDTAR="${1}"
185  
-           ;;
186  
-    -nick) shift
187  
-           if [ -z "$1" ] ; then exit_err "No nickname specified"; fi
188  
-           TNICK="${1}"
189  
-	   ;;
190  
- -pluginjail) shift
191  
-           TPLUGJAIL="YES"
192  
-	   ;;
193  
-	*) exit_err "Invalid option: $1" ;;
194  
-   esac
195  
-   shift
196  
-done
197  
-
198 166
 if [ -z "$TNICK" ] ; then exit_err "No nickname specified, use -nick <nickname>"; fi
199 167
 if [ -z "$FBSDTAR" ] ; then 
200 168
   if [ -z "$FBSDVER" -a -z "${TRUEOSVER}" ] ; then exit_err "Need either -fbsd or -trueos specified!"; fi

0 notes on commit 9cc2f9c

Please sign in to comment.
Something went wrong with that request. Please try again.