Merge "Allow manual installation of packages."

This commit is contained in:
Jenkins 2012-12-21 17:53:11 +00:00 committed by Gerrit Code Review
commit a215ffcd92
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 " -o filename -- set the name of the output file"
echo " -x -- turn on tracing" echo " -x -- turn on tracing"
echo " -u -- uncompressed; do not compress the image - larger but faster" 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 exit 0
} }
INSTALL_PACKAGES=""
COMPRESS_IMAGE="true" 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 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
echo "XXX $TEMP" echo "XXX $TEMP"
@ -45,6 +47,7 @@ while true ; do
-h) show_options;; -h) show_options;;
-x) shift; set -x;; -x) shift; set -x;;
-u) shift; export COMPRESS_IMAGE="";; -u) shift; export COMPRESS_IMAGE="";;
-p) IFS="," read -a INSTALL_PACKAGES <<< "$2"; export INSTALL_PACKAGES ; shift 2 ;;
--) shift ; break ;; --) shift ; break ;;
*) echo "Internal error!" ; exit 1 ;; *) echo "Internal error!" ; exit 1 ;;
esac esac
@ -88,6 +91,7 @@ mount_tmp_image ${IMAGE_BLOCK_DEVICE}
create_base create_base
run_d extra-data run_d extra-data
do_pre_install do_pre_install
do_extra_package_install
do_install do_install
prepare_first_boot prepare_first_boot
finalise_base finalise_base

View File

@ -231,3 +231,10 @@ function do_install () {
run_d_in_target install run_d_in_target install
unblock_daemons 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
}