diff options
author | erdgeist <erdgeist@erdgeist.org> | 2005-09-24 13:41:35 +0000 |
---|---|---|
committer | erdgeist <erdgeist@erdgeist.org> | 2005-09-24 13:41:35 +0000 |
commit | fa9f4ec518ba8976adcd44e7ee2b0e9855ba88d8 (patch) | |
tree | a9bebf50a8cafa3be2a56dd1fd7199a6a162f2ae /ezjail-admin | |
parent | 6f67d582484a2954b81b10ab8674421f22e8d106 (diff) |
started implementing delete
Diffstat (limited to 'ezjail-admin')
-rwxr-xr-x | ezjail-admin | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/ezjail-admin b/ezjail-admin index 3316e42..13c5092 100755 --- a/ezjail-admin +++ b/ezjail-admin | |||
@@ -53,7 +53,7 @@ create) | |||
53 | done; | 53 | done; |
54 | newjail_name=$1; newjail_ip=$2; shift 2; | 54 | newjail_name=$1; newjail_ip=$2; shift 2; |
55 | 55 | ||
56 | # wee need at least a name and an ip for new jail | 56 | # we need at least a name and an ip for new jail |
57 | if [ -z "$newjail_name" -o -z "$newjail_ip" -o $# != 0 ]; then | 57 | if [ -z "$newjail_name" -o -z "$newjail_ip" -o $# != 0 ]; then |
58 | echo 'Usage: ezjail create [-r jailroot] [-x] jailname jailip'; exit 1; | 58 | echo 'Usage: ezjail create [-r jailroot] [-x] jailname jailip'; exit 1; |
59 | fi | 59 | fi |
@@ -118,6 +118,36 @@ create) | |||
118 | 118 | ||
119 | ;; | 119 | ;; |
120 | delete) | 120 | delete) |
121 | shift | ||
122 | args=`getopt w $*` | ||
123 | if [ $? != 0 ]; then | ||
124 | echo 'Usage: ezjail delete [-w] jailname'; | ||
125 | exit 1; | ||
126 | fi | ||
127 | |||
128 | oldjail_wipe="NO" | ||
129 | |||
130 | set -- $args | ||
131 | for arg do | ||
132 | case $arg in | ||
133 | -w) oldjail_wipe="YES"; shift;; | ||
134 | --) shift; break;; | ||
135 | esac | ||
136 | done; | ||
137 | oldjail_name=$1; shift; | ||
138 | |||
139 | # we only need name of jail to vanish | ||
140 | if [ -z "$oldjail_name" -o $# != 0 ]; then | ||
141 | echo 'Usage: ezjail delete [-w] jailname'; exit 1; | ||
142 | fi | ||
143 | |||
144 | # check for existence of jail in our records | ||
145 | if [ ! -f ${ezjail_jailcfgs}/${oldjail_name} ]; then | ||
146 | echo 'Error: Nothing known about jail $oldjail_name'; exit 1 | ||
147 | fi | ||
148 | |||
149 | . ${ezjail_jailcfgs}/${oldjail_name} | ||
150 | eval jail_root=\"\$jail_${jail}_root\" | ||
121 | 151 | ||
122 | ;; | 152 | ;; |
123 | list) | 153 | list) |