From 0041646114c87af53e40eb5a8c893af12d7eb200 Mon Sep 17 00:00:00 2001 From: hayao Date: Wed, 15 Apr 2020 15:46:04 +0900 Subject: [PATCH] [update] : Supported specifying the destination of image file. --- wizard.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/wizard.sh b/wizard.sh index 234276be..16d109cd 100755 --- a/wizard.sh +++ b/wizard.sh @@ -421,6 +421,32 @@ function select_channel () { } +# イメージファイルの作成先 +function set_out_dir { + echo "イメージファイルの作成先を入力して下さい。" + echo "デフォルトは ${script_path}/out です。" + echo -n ": " + read out_dir + if [[ -z "${out_dir}" ]]; then + out_dir="${script_path}/out" + else + if [[ ! -d "${out_dir}" ]]; then + echo "存在しているディレクトリを指定して下さい" + set_out_dir + return 0 + elif [[ "${out_dir}" = / ]] || [[ "${out_dir}" = /home ]]; then + echo "そのディレクトリは使用できません。" + set_out_dir + return 0 + elif [[ -n "$(ls ${out_dir})" ]]; then + echo "ディレクトリは空ではありません。" + set_out_dir + return 0 + fi + fi +} + + # 最終的なbuild.shのオプションを生成 function generate_argument () { if [[ ${japanese} = true ]]; then @@ -441,6 +467,9 @@ function generate_argument () { if [[ -n ${password} ]]; then argument="${argument} -p '${password}'" fi + if [[ -n ${out_dir} ]]; then + argument="${argument} -o '${out_dir}'" + fi argument="${argument} ${channel}" } @@ -454,6 +483,7 @@ function ask () { set_username set_password select_channel + set_out_dir lastcheck } -- 2.11.0