diff options
Diffstat (limited to 'ezjail-admin')
-rwxr-xr-x | ezjail-admin | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/ezjail-admin b/ezjail-admin index 6f5f849..9c8e485 100755 --- a/ezjail-admin +++ b/ezjail-admin | |||
@@ -19,6 +19,7 @@ ezjail_jailcfgs="${ezjail_etc}/ezjail" | |||
19 | : ${ezjail_jailfull="${ezjail_jaildir}/fulljail"} | 19 | : ${ezjail_jailfull="${ezjail_jaildir}/fulljail"} |
20 | : ${ezjail_jailtemp="${ezjail_jaildir}/ezjailtemp"} | 20 | : ${ezjail_jailtemp="${ezjail_jaildir}/ezjailtemp"} |
21 | : ${ezjail_flavours_dir="${ezjail_jaildir}/flavours"} | 21 | : ${ezjail_flavours_dir="${ezjail_jaildir}/flavours"} |
22 | : ${ezjail_archivedir="${ezjail_jaildir}/ezjail_archives"} | ||
22 | : ${ezjail_portscvsroot="freebsdanoncvs@anoncvs.FreeBSD.org:/home/ncvs"} | 23 | : ${ezjail_portscvsroot="freebsdanoncvs@anoncvs.FreeBSD.org:/home/ncvs"} |
23 | : ${ezjail_sourcetree="/usr/src"} | 24 | : ${ezjail_sourcetree="/usr/src"} |
24 | : ${ezjail_uglyperlhack="YES"} | 25 | : ${ezjail_uglyperlhack="YES"} |
@@ -45,7 +46,7 @@ case `uname -p` in amd64) ezjail_dirlist="${ezjail_dirlist} usr/lib32"; ezjail_b | |||
45 | ezjail_usage_ezjailadmin="${ezjail_admin} v3.1.1b\nUsage: ${ezjail_admin} [archive|config|console|create|delete|install|list|restore|update] {params}" | 46 | ezjail_usage_ezjailadmin="${ezjail_admin} v3.1.1b\nUsage: ${ezjail_admin} [archive|config|console|create|delete|install|list|restore|update] {params}" |
46 | ezjail_usage_install="Usage: ${ezjail_admin} install [-mMpPsS] [-h host] [-r release]" | 47 | ezjail_usage_install="Usage: ${ezjail_admin} install [-mMpPsS] [-h host] [-r release]" |
47 | ezjail_usage_create="Usage: ${ezjail_admin} create [-xbi] [-f flavour] [-r jailroot] [-s size] [-c bde|eli|zfs] [-C args] [-a archive] jailname jailip" | 48 | ezjail_usage_create="Usage: ${ezjail_admin} create [-xbi] [-f flavour] [-r jailroot] [-s size] [-c bde|eli|zfs] [-C args] [-a archive] jailname jailip" |
48 | ezjail_usage_delete="Usage: ${ezjail_admin} delete [-w] jailname" | 49 | ezjail_usage_delete="Usage: ${ezjail_admin} delete [-wf] jailname" |
49 | ezjail_usage_update="Usage: ${ezjail_admin} update [-s sourcetree] [-p] (-b|-i|-u|-P)" | 50 | ezjail_usage_update="Usage: ${ezjail_admin} update [-s sourcetree] [-p] (-b|-i|-u|-P)" |
50 | ezjail_usage_config="Usage: ${ezjail_admin} config [-r run|norun] [-n newname] [-c cpuset] [-z zfs-datasets] [-f fib] [-i attach|detach|fsck] jailname" | 51 | ezjail_usage_config="Usage: ${ezjail_admin} config [-r run|norun] [-n newname] [-c cpuset] [-z zfs-datasets] [-f fib] [-i attach|detach|fsck] jailname" |
51 | ezjail_usage_console="Usage: ${ezjail_admin} console [-f] [-e command] jailname" | 52 | ezjail_usage_console="Usage: ${ezjail_admin} console [-f] [-e command] jailname" |
@@ -350,8 +351,8 @@ ezjail_makeabsolute ( ) { | |||
350 | 351 | ||
351 | parse_geli_attach_args () { | 352 | parse_geli_attach_args () { |
352 | # create geli(8) attach arguments from geli(8) init arguments: | 353 | # create geli(8) attach arguments from geli(8) init arguments: |
353 | # -P becomes -p if present, -K newkeyfile becomes -k newkeyfile if present, | 354 | # -P becomes -p if present, -K newkeyfile becomes -k newkeyfile if present, |
354 | # everything else is dicarded | 355 | # everything else is discarded |
355 | # exit values: 0->NO PASSWORD SET, 1->PASSWORD SET | 356 | # exit values: 0->NO PASSWORD SET, 1->PASSWORD SET |
356 | _exit=0 | 357 | _exit=0 |
357 | while getopts :bPva:i:K:l:s: arg; do | 358 | while getopts :bPva:i:K:l:s: arg; do |
@@ -481,7 +482,7 @@ create) | |||
481 | # This scenario really will only lead to real troubles in the 'fulljail' | 482 | # This scenario really will only lead to real troubles in the 'fulljail' |
482 | # case, but I should still explain this to the user and not claim that | 483 | # case, but I should still explain this to the user and not claim that |
483 | # "an ezjail would already exist" | 484 | # "an ezjail would already exist" |
484 | case ${ezjail_hostname} in basejail|newjail|fulljail|flavours|ezjailtemp) exerr "Error: Cannot name the jail ${ezjail_hostname}.\n ezjail needs the ${ezjail_hostname} directory for its own administrative purposes.\n Please rename the ezjail.";; esac | 485 | case ${ezjail_hostname} in basejail|newjail|fulljail|flavours|ezjailtemp|ezjail_archives) exerr "Error: Cannot name the jail ${ezjail_hostname}.\n ezjail needs the ${ezjail_hostname} directory for its own administrative purposes.\n Please rename the ezjail.";; esac |
485 | 486 | ||
486 | # jail names may lead to identical configs, eg. foo.bar.com == foo-bar.com | 487 | # jail names may lead to identical configs, eg. foo.bar.com == foo-bar.com |
487 | # so check, whether we might be running into problems | 488 | # so check, whether we might be running into problems |
@@ -1050,8 +1051,8 @@ archive) | |||
1050 | # Specifying no jails only is acceptable if archiving all jails | 1051 | # Specifying no jails only is acceptable if archiving all jails |
1051 | [ $# -lt 1 -a -z "${ezjail_archivealljails}" ] && exerr ${ezjail_usage_archive} | 1052 | [ $# -lt 1 -a -z "${ezjail_archivealljails}" ] && exerr ${ezjail_usage_archive} |
1052 | 1053 | ||
1053 | # Default archive directory to . | 1054 | # Ensure that archive directory is there |
1054 | : ${ezjail_archivedir=`pwd -P`} | 1055 | [ "${ezjail_archive}" = "-" ] || mkdir -p "${ezjail_archivedir}" || exerr "Error: Can not create archive directory ${ezjail_archivedir}." |
1055 | 1056 | ||
1056 | # Will not backup more than one jail per archive | 1057 | # Will not backup more than one jail per archive |
1057 | [ "${ezjail_archive}" -a "${ezjail_archivealljails}" ] && exerr "Error: Must not specify an archive location for multiple archives.\n Can not archive multiple jails into one archive." | 1058 | [ "${ezjail_archive}" -a "${ezjail_archivealljails}" ] && exerr "Error: Must not specify an archive location for multiple archives.\n Can not archive multiple jails into one archive." |
@@ -1145,7 +1146,7 @@ archive) | |||
1145 | ####################### ezjail-admin RESTORE ######################## | 1146 | ####################### ezjail-admin RESTORE ######################## |
1146 | restore) | 1147 | restore) |
1147 | # Clean variables, prevent polution | 1148 | # Clean variables, prevent polution |
1148 | unset ezjail_archivedir ezjail_safename ezjail_forcerestore | 1149 | unset ezjail_safename ezjail_forcerestore |
1149 | 1150 | ||
1150 | shift; while getopts :d:f arg; do case ${arg} in | 1151 | shift; while getopts :d:f arg; do case ${arg} in |
1151 | d) ezjail_archivedir=${OPTARG};; | 1152 | d) ezjail_archivedir=${OPTARG};; |
@@ -1155,9 +1156,6 @@ restore) | |||
1155 | 1156 | ||
1156 | [ $# -eq 0 ] && exerr ${ezjail_usage_restore} | 1157 | [ $# -eq 0 ] && exerr ${ezjail_usage_restore} |
1157 | 1158 | ||
1158 | # Default archive directory to . | ||
1159 | : ${ezjail_archivedir=`pwd -P`} | ||
1160 | |||
1161 | for ezjail_fromarchive in $@; do | 1159 | for ezjail_fromarchive in $@; do |
1162 | unset ezjail_safename ezjail_imagedata ezjail_nameprop | 1160 | unset ezjail_safename ezjail_imagedata ezjail_nameprop |
1163 | 1161 | ||
@@ -1294,7 +1292,7 @@ config) | |||
1294 | # This scenario really will only lead to real troubles in the 'fulljail' | 1292 | # This scenario really will only lead to real troubles in the 'fulljail' |
1295 | # case, but I should still explain this to the user and not claim that | 1293 | # case, but I should still explain this to the user and not claim that |
1296 | # "an ezjail would already exist" | 1294 | # "an ezjail would already exist" |
1297 | case ${ezjail_hostname} in basejail|newjail|fulljail|flavours|ezjailtemp) exerr "Error: ezjail needs the ${ezjail_hostname} directory for its own administrative purposes.\n Please chose another name.";; esac | 1295 | case ${ezjail_hostname} in basejail|newjail|fulljail|flavours|ezjailtemp|ezjail_archives) exerr "Error: ezjail needs the ${ezjail_hostname} directory for its own administrative purposes.\n Please chose another name.";; esac |
1298 | 1296 | ||
1299 | # jail names may lead to identical configs, eg. foo.bar.com == foo-bar.com | 1297 | # jail names may lead to identical configs, eg. foo.bar.com == foo-bar.com |
1300 | # so check, whether we might be running into problems | 1298 | # so check, whether we might be running into problems |