Permalink
Browse files

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

  • Loading branch information...
1 parent 2567eba commit 9cc2f9cce79500f8d063abfde11963f8cbccee19 @kmoore134 kmoore134 committed Jun 12, 2013
Showing with 35 additions and 34 deletions.
  1. +35 −2 src-sh/warden/bin/warden
  2. +0 −32 src-sh/warden/scripts/backend/createtemplate.sh
View
37 src-sh/warden/bin/warden
@@ -726,8 +726,41 @@ details) JAILNAME="${2}"
template) require_root
OPT="$2"
case $OPT in
- create) shift ; shift; ${PROGDIR}/scripts/backend/createtemplate.sh $* ;;
- delete) delete_template $3 ;;
+ create) shift ; shift;
+ # Read our flags
+ while [ $# -gt 0 ]; do
+ case $1 in
+ -fbsd) shift
+ if [ -z "$1" ] ; then exit_err "No FreeBSD version specified"; fi
+ FBSDVER="${1}"
+ ;;
+ -trueos) shift
+ if [ -z "$1" ] ; then exit_err "No TrueOS version specified"; fi
+ TRUEOSVER="${1}"
+ ;;
+ -arch) shift
+ if [ -z "$1" ] ; then exit_err "No FreeBSD architecture specified"; fi
+ FBSDARCH="${1}"
+ ;;
+ -tar) shift
+ if [ -z "$1" ] ; then exit_err "No tar file specified"; fi
+ if [ ! -e "$1" ] ; then exit_err "Could not find tar file: $1"; fi
+ FBSDTAR="${1}"
+ ;;
+ -nick) shift
+ if [ -z "$1" ] ; then exit_err "No nickname specified"; fi
+ TNICK="`echo ${1} | sed 's| |_|g'`"
+ ;;
+ -pluginjail) shift
+ TPLUGJAIL="YES"
+ ;;
+ *) exit_err "Invalid option: $1" ;;
+ esac
+ shift
+ done
+ export TPLUGJAIL TNICK FBSDTAR FBSDARCH TRUEOSVER FBSDVER
+ ${PROGDIR}/scripts/backend/createtemplate.sh ;;
+ delete) delete_template "$3" ;;
list) list_templates ;;
*) help_template ; exit 1 ;;
esac
View
32 src-sh/warden/scripts/backend/createtemplate.sh
@@ -163,38 +163,6 @@ create_template()
};
-# Read our flags
-while [ $# -gt 0 ]; do
- case $1 in
- -fbsd) shift
- if [ -z "$1" ] ; then exit_err "No FreeBSD version specified"; fi
- FBSDVER="${1}"
- ;;
- -trueos) shift
- if [ -z "$1" ] ; then exit_err "No TrueOS version specified"; fi
- TRUEOSVER="${1}"
- ;;
- -arch) shift
- if [ -z "$1" ] ; then exit_err "No FreeBSD architecture specified"; fi
- FBSDARCH="${1}"
- ;;
- -tar) shift
- if [ -z "$1" ] ; then exit_err "No tar file specified"; fi
- if [ ! -e "$1" ] ; then exit_err "Could not find tar file: $1"; fi
- FBSDTAR="${1}"
- ;;
- -nick) shift
- if [ -z "$1" ] ; then exit_err "No nickname specified"; fi
- TNICK="${1}"
- ;;
- -pluginjail) shift
- TPLUGJAIL="YES"
- ;;
- *) exit_err "Invalid option: $1" ;;
- esac
- shift
-done
-
if [ -z "$TNICK" ] ; then exit_err "No nickname specified, use -nick <nickname>"; fi
if [ -z "$FBSDTAR" ] ; then
if [ -z "$FBSDVER" -a -z "${TRUEOSVER}" ] ; then exit_err "Need either -fbsd or -trueos specified!"; fi

0 comments on commit 9cc2f9c

Please sign in to comment.