oi-build uses todo_action() instead of separate action vars
This commit is contained in:
26
oi-build
26
oi-build
@@ -101,6 +101,10 @@ init_vars() {
|
|||||||
imagebuilder_dir=${tarball%%.tar*}
|
imagebuilder_dir=${tarball%%.tar*}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
todo_action() {
|
||||||
|
echo "${actions}" | grep -q "$1"
|
||||||
|
}
|
||||||
|
|
||||||
fetch_image_builder() {
|
fetch_image_builder() {
|
||||||
echo_note "Downloading ${RELEASE} build from ${url_path}"
|
echo_note "Downloading ${RELEASE} build from ${url_path}"
|
||||||
|
|
||||||
@@ -229,10 +233,7 @@ Without any options, info is shown for the last image built.
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
do_fetch=""
|
actions=""
|
||||||
do_build=""
|
|
||||||
do_write=""
|
|
||||||
do_info=""
|
|
||||||
dryrun=""
|
dryrun=""
|
||||||
while [ -n "$1" ]; do
|
while [ -n "$1" ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
@@ -243,11 +244,11 @@ while [ -n "$1" ]; do
|
|||||||
-r) RELEASE=$2; shift ;;
|
-r) RELEASE=$2; shift ;;
|
||||||
-t) TARGET=$2; shift ;;
|
-t) TARGET=$2; shift ;;
|
||||||
-p) PROFILE=$2; shift ;;
|
-p) PROFILE=$2; shift ;;
|
||||||
-d) do_fetch=yes ;;
|
-d) actions+="fetch ";;
|
||||||
-b) do_fetch=yes; do_build=yes ;;
|
-b) actions+="fetch build " ;;
|
||||||
-i) do_fetch=yes; do_info=yes; ;;
|
-i) actions+="fetch info " ;;
|
||||||
|
-w) actions+="write " ;;
|
||||||
-n) dryrun=yes ;;
|
-n) dryrun=yes ;;
|
||||||
-w) do_write=yes ;;
|
|
||||||
-h) usage; exit 0 ;;
|
-h) usage; exit 0 ;;
|
||||||
*)
|
*)
|
||||||
usage
|
usage
|
||||||
@@ -258,16 +259,17 @@ while [ -n "$1" ]; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
init_vars
|
init_vars
|
||||||
|
echo_ok "actions = ${actions}"
|
||||||
|
|
||||||
[ -n "${do_fetch}" ] &&
|
todo_action fetch &&
|
||||||
fetch_image_builder
|
fetch_image_builder
|
||||||
|
|
||||||
echo_run_nodry "cd ${imagebuilder_dir}"
|
echo_run_nodry "cd ${imagebuilder_dir}"
|
||||||
|
|
||||||
[ -n "${do_build}" ] &&
|
todo_action build &&
|
||||||
image_build
|
image_build
|
||||||
|
|
||||||
if [ -n "${do_write}" ]; then
|
if todo_action write; then
|
||||||
if [ -d bin/targets/${TARGET} ]; then
|
if [ -d bin/targets/${TARGET} ]; then
|
||||||
image_write_to_sdcard
|
image_write_to_sdcard
|
||||||
else
|
else
|
||||||
@@ -275,7 +277,7 @@ if [ -n "${do_write}" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "${do_info}" ] && image_builder_make_info
|
todo_action info && image_builder_make_info
|
||||||
|
|
||||||
echo_inv "Final output info"
|
echo_inv "Final output info"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user