diff options
author | erdgeist <erdgeist@erdgeist.org> | 2005-09-12 12:33:42 +0000 |
---|---|---|
committer | erdgeist <erdgeist@erdgeist.org> | 2005-09-12 12:33:42 +0000 |
commit | 79fc7aa69a56933d7c622309b1e7b6bafc8df504 (patch) | |
tree | 537ebe705db29fa732b5f1a08dba5b99e08ed733 /ezjail-admin | |
parent | fe4697c638d8eb4e9b78698c11992eca3401fb9a (diff) |
argument evaluation for create subcommand
Diffstat (limited to 'ezjail-admin')
-rwxr-xr-x | ezjail-admin | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/ezjail-admin b/ezjail-admin index 613e73b..19725d2 100755 --- a/ezjail-admin +++ b/ezjail-admin | |||
@@ -11,12 +11,51 @@ if [ -f ${ezjail_prefix}/etc/ezjail.conf ]; then | |||
11 | . ${ezjail_prefix}/etc/ezjail.conf; | 11 | . ${ezjail_prefix}/etc/ezjail.conf; |
12 | fi | 12 | fi |
13 | 13 | ||
14 | # set defaults | ||
15 | ezjail_jaildir=${ezjail_jaildir:-"/usr/jails"} | ||
16 | ezjail_jailtemplate=${ezjail_jailtemplate:-"$ezjail_jaildir/newjail"} | ||
17 | ezjail_jailbase=${ezjail_jailbase:-"$ezjail_jaildir/basejail"} | ||
18 | ezjail_sourcetree=${ezjail_sourcetree:-"/usr/src"} | ||
19 | |||
20 | ezjail_mount_enable=${ezjail_mount_enable:-"YES"} | ||
21 | ezjail_devfs_enable=${ezjail_devfs_enable:-"YES"} | ||
22 | ezjail_devfs_ruleset=${ezjail_devfs_ruleset:-"devfsrules_jail"} | ||
23 | ezjail_procfs_enable=${ezjail_procfs_enable:-"YES"} | ||
24 | ezjail_fdescfs_enable=${ezjail_fdescfs_enable:-"YES"} | ||
25 | |||
26 | # check for command | ||
14 | if [ -z "$1" ]; | 27 | if [ -z "$1" ]; |
15 | then echo "Syntax: `basename $0` [create|delete|list|update] {params}"; exit; | 28 | then echo "Usage: `basename $0` [create|delete|list|update] {params}"; exit; |
16 | fi | 29 | fi |
17 | 30 | ||
18 | case "$1" in | 31 | case "$1" in |
19 | create) | 32 | create) |
33 | shift | ||
34 | args=`getopt xr: $*` | ||
35 | if [ $? != 0 ]; then | ||
36 | echo 'Usage: ezjail create [-r jailroot] [-x] jailname jailip'; exit 1; | ||
37 | fi | ||
38 | |||
39 | newjail_root= | ||
40 | newjail_fill="YES" | ||
41 | |||
42 | for arg in args; do | ||
43 | case $arg in | ||
44 | -x) newjail_fill="NO"; shift;; | ||
45 | -r) newjail_root="$2"; shift 2;; | ||
46 | --) shift; break;; | ||
47 | esac | ||
48 | done; | ||
49 | newjail_name=$1; newjail_ip=$2; shift 2; | ||
50 | |||
51 | if [ -z "$newjail_name" -o -z "$newjail_ip" -o $# != 0 ]; then | ||
52 | echo 'Usage: ezjail create [-r jailroot] [-x] jailname jailip'; exit 1; | ||
53 | fi | ||
54 | |||
55 | echo running CREATE $newjail_name $newjail_ip $newjail_fill | ||
56 | |||
57 | exit | ||
58 | |||
20 | mkdir ${newjail_root} && cd ${ezjail_jailtemplate} \ | 59 | mkdir ${newjail_root} && cd ${ezjail_jailtemplate} \ |
21 | && find * | cpio -p -v ${newjail_root} | 60 | && find * | cpio -p -v ${newjail_root} |
22 | ;; | 61 | ;; |
@@ -52,6 +91,6 @@ update) | |||
52 | 91 | ||
53 | ;; | 92 | ;; |
54 | *) | 93 | *) |
55 | echo "Syntax: `basename $0` [create|delete|list|update] {params}"; exit; | 94 | echo "Usage: `basename $0` [create|delete|list|update] {params}"; exit; |
56 | ;; | 95 | ;; |
57 | esac | 96 | esac |