summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xezjail-admin83
1 files changed, 40 insertions, 43 deletions
diff --git a/ezjail-admin b/ezjail-admin
index d55bd9e..e2bced3 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -244,6 +244,45 @@ ezjail_queryftpserver () {
244 return ${_ret} 244 return ${_ret}
245} 245}
246 246
247parse_geli_attach_args () {
248 # create geli(8) attach arguments from geli(8) init arguments:
249 # -P becomes -p if present, -K newkeyfile becomes -k newkeyfile if present,
250 # everything else is dicarded
251 # exit values: 0->NO PASSWORD SET, 1->PASSWORD SET
252 _exit=0
253 shift
254 while getopts :bPva:i:K:l:s: arg; do
255 case ${arg} in
256 b|v|a|i|l|s);; # ignore these
257 P) echo -n "-p "; _exit=1 ;;
258 K) echo -n "-k '$OPTARG' ";;
259 ?) exerr "Error: Processing of attach params failed.";;
260 esac
261 done
262 return ${_exit}
263}
264
265parse_gbde_attach_args () {
266 # create gbde(8) attach arguments from gbde(8) init arguments:
267 # -L lockfile becomes -l lockfile if present
268 # -K keyfile becomes -k keyfile if present
269 # -P passphrase becomes -p passphrase if present
270 # everything else is discarded
271 # exit values: 0->NO PASSWORD SET, 1->PASSWORD SET
272 _exit=0
273 shift
274 while getopts :iK:f:L:P: arg; do
275 case ${arg} in
276 i|f);; # ignore these
277 P) echo -n "-p '$OPTARG' "; _exit=1;;
278 K) echo -n "-k '$OPTARG' ";;
279 L) echo -n "-l '$OPTARG' ";;
280 ?) exerr "Error: Processing of attach params failed.";;
281 esac
282 done
283 return ${_exit}
284}
285
247############################# 286#############################
248# End of function definitions 287# End of function definitions
249# 288#
@@ -380,9 +419,7 @@ create)
380 # parse imageparams, generate attachparams 419 # parse imageparams, generate attachparams
381 ezjail_attachblocking="YES" 420 ezjail_attachblocking="YES"
382 if [ "${ezjail_imageparams}" ]; then 421 if [ "${ezjail_imageparams}" ]; then
383 ezjail_attachparams=`echo $0 _parse_g${ezjail_imagetype}_attach_args_ ${ezjail_imageparams} | /bin/sh` 422 ezjail_attachparams=`eval parse_g${ezjail_imagetype}_attach_args ${ezjail_imageparams}` || unset ezjail_attachblocking
384 [ 5 -eq $? ] && exerr "processing of ezjail_imageparams failed"
385 [ 3 -eq $? ] && unset ezjail_attachblocking
386 fi 423 fi
387 case ${ezjail_imagetype} in 424 case ${ezjail_imagetype} in
388 bde) init_cmd="gbde init /dev/${ezjail_imagedevice} ${ezjail_imageparams}" 425 bde) init_cmd="gbde init /dev/${ezjail_imagedevice} ${ezjail_imageparams}"
@@ -1018,46 +1055,6 @@ config)
1018 ;; 1055 ;;
1019 esac 1056 esac
1020 ;; 1057 ;;
1021
1022##############################################################################
1023# ezjail_imageparams HACK starts here
1024#
1025#
1026_parse_geli_attach_args_)
1027 # create geli(8) attach arguments from geli(8) init arguments:
1028 # -P becomes -p if present, -K newkeyfile becomes -k newkeyfile if present,
1029 # everything else is dicarded
1030 # exit values: 2->NO_ERROR, 3->NO_ERROR,PASSWORD_SET, 5->PARSER_ERROR
1031 _exit=2
1032 shift; while getopts :bPva:i:K:l:s: arg; do case ${arg} in
1033 b|v|a|i|l|s);; # ignore these
1034 P) echo -n "-p "; _exit=3 ;;
1035 K) echo -n "-k '$OPTARG' ";;
1036 ?) exit 5;;
1037 esac; done
1038 exit ${_exit}
1039 ;;
1040_parse_gbde_attach_args_)
1041 # create gbde(8) attach arguments from gbde(8) init arguments:
1042 # -L lockfile becomes -l lockfile if present
1043 # -K keyfile becomes -k keyfile if present
1044 # -P passphrase becomes -p passphrase if present
1045 # everything else is discarded
1046 # exit values: 2->NO_ERROR, 3->NO_ERROR+PASSWORD_SET, 5->PARSER_ERROR
1047 _exit=2
1048 shift; while getopts :iK:f:L:P: arg; do case ${arg} in
1049 i|f);; # ignore these
1050 P) echo -n "-p '$OPTARG' "; _exit=3;;
1051 K) echo -n "-k '$OPTARG' ";;
1052 L) echo -n "-l '$OPTARG' ";;
1053 ?) exit 5;;
1054 esac; done
1055 exit ${_exit}
1056 ;;
1057#
1058# ezjail_imageparams HACK ends here (thank god)
1059##############################################################################
1060
1061*) 1058*)
1062 exerr ${ezjail_usage_ezjailadmin} 1059 exerr ${ezjail_usage_ezjailadmin}
1063 ;; 1060 ;;