Allow manual installation of packages.

Rather than force creation of an element for a single package install,
allow people to do this from the command line.

Change-Id: I63e2e7e50c4a7dbb8a8e198581dfadce91773621
This commit is contained in:
Chris Jones 2012-12-18 20:45:02 +00:00
parent 147489f239
commit 0f73578721
2 changed files with 12 additions and 1 deletions

View File

@ -27,11 +27,13 @@ function show_options () {
echo " -o filename -- set the name of the output file"
echo " -x -- turn on tracing"
echo " -u -- uncompressed; do not compress the image - larger but faster"
echo " -p package[,package,package] -- list of packages to install in the image"
exit 0
}
INSTALL_PACKAGES=""
COMPRESS_IMAGE="true"
TEMP=`getopt -o a:ho:xu -n $SCRIPTNAME -- "$@"`
TEMP=`getopt -o a:ho:xup: -n $SCRIPTNAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
echo "XXX $TEMP"
@ -45,6 +47,7 @@ while true ; do
-h) show_options;;
-x) shift; set -x;;
-u) shift; export COMPRESS_IMAGE="";;
-p) IFS="," read -a INSTALL_PACKAGES <<< "$2"; export INSTALL_PACKAGES ; shift 2 ;;
--) shift ; break ;;
*) echo "Internal error!" ; exit 1 ;;
esac
@ -88,6 +91,7 @@ mount_tmp_image ${IMAGE_BLOCK_DEVICE}
create_base
run_d extra-data
do_pre_install
do_extra_package_install
do_install
prepare_first_boot
finalise_base

View File

@ -231,3 +231,10 @@ function do_install () {
run_d_in_target install
unblock_daemons
}
function do_extra_package_install () {
# Install any packages that were requested with the -p command line option
if [ "$INSTALL_PACKAGES" != "" ]; then
run_in_target apt-get -y install ${INSTALL_PACKAGES[@]}
fi
}