diff options
-rwxr-xr-x | ezjail-admin | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ezjail-admin b/ezjail-admin index 701464a..177bd42 100755 --- a/ezjail-admin +++ b/ezjail-admin | |||
@@ -70,9 +70,13 @@ create) | |||
70 | # foo_com in most scripts | 70 | # foo_com in most scripts |
71 | 71 | ||
72 | newjail_name=`echo -n ${newjail_name} | tr /~ __` | 72 | newjail_name=`echo -n ${newjail_name} | tr /~ __` |
73 | newjail_nname=`echo -n "${newjail_name}" | tr -c [:alnum:]_ _` | 73 | newjail_nname=`echo -n "${newjail_name}" | tr -c [:alnum:] _` |
74 | newjail_root=${newjail_root:-"${ezjail_jaildir}/${newjail_name}"} | 74 | newjail_root=${newjail_root:-"${ezjail_jaildir}/${newjail_name}"} |
75 | 75 | ||
76 | # jail names may lead to identical configs, eg. foo.bar.com == foo-bar.com | ||
77 | # so check, whether we might be running into problems | ||
78 | [ -e ${ezjail_jailcfgs}/${newjail_nname} ] && exerr "Error: an ezjail config already exists at ${ezjail_jailcfgs}/${newjail_nname}. Please rename the ezjail." | ||
79 | |||
76 | # if jail root specified on command line is not absolute, | 80 | # if jail root specified on command line is not absolute, |
77 | # make it absolute inside our jail directory | 81 | # make it absolute inside our jail directory |
78 | [ ${newjail_root#/} = ${newjail_root} ] && newjail_root=${ezjail_jaildir}/${newjail_root} | 82 | [ ${newjail_root#/} = ${newjail_root} ] && newjail_root=${ezjail_jaildir}/${newjail_root} |
@@ -176,7 +180,7 @@ delete) | |||
176 | [ "${oldjail_name}" -a $# = 1 ] || exerr 'Usage: ezjail delete [-w] jailname' | 180 | [ "${oldjail_name}" -a $# = 1 ] || exerr 'Usage: ezjail delete [-w] jailname' |
177 | 181 | ||
178 | # tidy up jail name the ezjail way | 182 | # tidy up jail name the ezjail way |
179 | oldjail_nname=`echo -n ${oldjail_name} | tr -c [:alnum:]_ _`; | 183 | oldjail_nname=`echo -n ${oldjail_name} | tr -c [:alnum:] _`; |
180 | 184 | ||
181 | # check for existence of jail in our records | 185 | # check for existence of jail in our records |
182 | [ -f ${ezjail_jailcfgs}/${oldjail_nname} ] || exerr "Error: Nothing known about jail ${oldjail_name}." | 186 | [ -f ${ezjail_jailcfgs}/${oldjail_nname} ] || exerr "Error: Nothing known about jail ${oldjail_name}." |