diff options
| -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) |
