Factor out element processing.

This reduces code duplication for hygiene, no functional changes.

Change-Id: I10c96da4f07bcd1e5aabfcfbd115ecaef7bb65a1
This commit is contained in:
Robert Collins 2013-06-20 15:48:37 +12:00 committed by Chris Jones
parent 9b01f2b129
commit 0b1ff7d4b0
3 changed files with 17 additions and 15 deletions

View File

@ -75,23 +75,14 @@ if [ "$CLEAR_ENV" = "1" -a "$HOME" != "" ]; then
exec -c $0 "$@"
fi
for arg do IMAGE_ELEMENT="$IMAGE_ELEMENT $arg" ; done
if [ "$SKIP_BASE" != "1" ]; then
IMAGE_ELEMENT="base $IMAGE_ELEMENT"
fi
source $_LIB/img-defaults
source $_LIB/common-functions
source $_LIB/img-functions
arg_to_elements "$@"
IMAGE_NAME=${IMAGE_NAME%%\.${IMAGE_TYPE}}
IMAGE_ELEMENT=$($SCRIPT_HOME/element-info --expand-dependencies $IMAGE_ELEMENT)
echo "Building elements: $IMAGE_ELEMENT"
echo "If prompted for sudo, install sudoers.d/img-build-sudoers into /etc/sudoers.d and restart the build."
mk_build_dir
create_base
run_d extra-data

View File

@ -53,15 +53,12 @@ while true ; do
*) echo "Internal error!" ; exit 1 ;;
esac
done
for arg do IMAGE_ELEMENT="$IMAGE_ELEMENT $arg" ; done
source $_LIB/ramdisk-defaults
source $_LIB/common-functions
source $_LIB/ramdisk-functions
IMAGE_ELEMENT=$($SCRIPT_HOME/element-info --expand-dependencies $IMAGE_ELEMENT)
echo "Building element(s): ${IMAGE_ELEMENT}"
arg_to_elements "$@"
echo "Discovering binary dependencies"
ensure_binaries

View File

@ -173,3 +173,17 @@ function detach_loopback() {
echo Gave up trying to detach $loopdev
return 1
}
function arg_to_elements() {
for arg do IMAGE_ELEMENT="$IMAGE_ELEMENT $arg" ; done
if [ "$SKIP_BASE" != "1" ]; then
IMAGE_ELEMENT="base $IMAGE_ELEMENT"
fi
echo "Building elements: $IMAGE_ELEMENT"
echo "If prompted for sudo, install sudoers.d/img-build-sudoers into /etc/sudoers.d and restart the build."
IMAGE_ELEMENT=$($SCRIPT_HOME/element-info --expand-dependencies $IMAGE_ELEMENT)
echo "Expanded element dependencies to: $IMAGE_ELEMENT"
}