diff --git a/src/.config b/src/.config index cde495093..78a64b14a 100644 --- a/src/.config +++ b/src/.config @@ -80,6 +80,11 @@ LUA_SOURCE_URL=https://www.lua.org/ftp/lua-5.3.4.tar.gz # STATIC_GET_SOURCE_URL=http://s.minos.io/s +# You can find the latest Cloud Foundry CLI binary here: +# +# http://github.com/cloudfoundry/cli +# +CLOUD_FOUNDRY_CLI_URL=http://cli.run.pivotal.io/stable?release=linux64-binary&source=github #################################################### @@ -165,11 +170,12 @@ COPY_SOURCE_ISO=true # mll_utils - set of executable utilities (mll-*). # lua - scripting language # static_get - portable binaries for Linux (http://s.minos.io) +# cf_cli - CLoud Foundry CLI (command line interface) # # Refer to the README file for more information. # -#OVERLAY_BUNDLES=glibc_full,links,dropbear,java,felix,mll_utils,lua -#OVERLAY_BUNDLES=static_get +#OVERLAY_BUNDLES=glibc_full,links,dropbear,java,felix,mll_utils,lua,static_get,cf_cli +#OVERLAY_BUNDLES=cf_cli # This property enables the standard penguin boot logo in the upper left corner # of the screen. The property is used in 'xx_build_kernel.sh'. The default value diff --git a/src/minimal_overlay/bundles/cf_cli/01_get.sh b/src/minimal_overlay/bundles/cf_cli/01_get.sh new file mode 100755 index 000000000..ae47f0360 --- /dev/null +++ b/src/minimal_overlay/bundles/cf_cli/01_get.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +SRC_DIR=$(pwd) + +# Find the main source directory +cd ../../.. +MAIN_SRC_DIR=$(pwd) +cd $SRC_DIR + +# Grab everything after the '=' character. +#DOWNLOAD_URL=$(grep -i CLOUD_FOUNDRY_CLI_URL $MAIN_SRC_DIR/.config | cut -f2 -d'=') +# TODO - hardcoding for now +DOWNLOAD_URL="http://cli.run.pivotal.io/stable?release=linux64-binary&source=github" + +# Read the 'USE_LOCAL_SOURCE' property from '.config' +USE_LOCAL_SOURCE="$(grep -i USE_LOCAL_SOURCE $MAIN_SRC_DIR/.config | cut -f2 -d'=')" + +if [ "$USE_LOCAL_SOURCE" = "true" -a ! -f $MAIN_SRC_DIR/source/overlay/cf-cli.tgz ] ; then + echo "Shell script $MAIN_SRC_DIR/source/overlay/cf-cli.tgz is missing and will be downloaded." + USE_LOCAL_SOURCE="false" +fi + +cd $MAIN_SRC_DIR/source/overlay + +if [ ! "$USE_LOCAL_SOURCE" = "true" ] ; then + # Downloading cloud foundry compressed binary archive. The '-c' option allows the download to resume. + echo "Downloading cloud foundry compressed binary archive from $DOWNLOAD_URL" + wget -O cf-cli.tgz -c $DOWNLOAD_URL +else + echo "Using local cloud foundry compressed binary archive $MAIN_SRC_DIR/source/overlay/cf-cli.tgz" +fi + +# Delete folder with previously prepared cloud foundry cli. +echo "Removing cloud foundry cli work area. This may take a while..." +rm -rf ../../work/overlay/clofo +mkdir ../../work/overlay/clofo + +# Copy cf-cli.tgz to folder 'work/overlay/clofo'. +cp cf-cli.tgz ../../work/overlay/clofo + +cd $SRC_DIR + diff --git a/src/minimal_overlay/bundles/cf_cli/02_install.sh b/src/minimal_overlay/bundles/cf_cli/02_install.sh new file mode 100755 index 000000000..4a125cace --- /dev/null +++ b/src/minimal_overlay/bundles/cf_cli/02_install.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +SRC_DIR=$(pwd) + +# Find the main source directory +cd ../../.. +MAIN_SRC_DIR=$(pwd) +cd $SRC_DIR + +echo "Removing old cloud foundry artifacts. This may take a while..." +rm -rf $MAIN_SRC_DIR/work/overlay/clofo/clofo_installed +mkdir -p $MAIN_SRC_DIR/work/overlay/clofo/clofo_installed/opt/clofo +mkdir -p $MAIN_SRC_DIR/work/overlay/clofo/clofo_installed/bin + +cd $MAIN_SRC_DIR/work/overlay/clofo + +cp $MAIN_SRC_DIR/source/overlay/cf-cli.tgz . + +tar -xvf cf-cli.tgz +rm -f LICENSE NOTICE cf-cli.tgz +chmod +rx cf + +cp cf $MAIN_SRC_DIR/work/overlay/clofo/clofo_installed/opt/clofo/cf + +cd $MAIN_SRC_DIR/work/overlay/clofo/clofo_installed + +ln -s ../opt/clofo/cf bin/cf + +cp -r $MAIN_SRC_DIR/work/overlay/clofo/clofo_installed/* \ + $MAIN_SRC_DIR/work/src/minimal_overlay/rootfs + +echo "cloud foundry cli has been installed." + +cd $SRC_DIR + diff --git a/src/minimal_overlay/bundles/cf_cli/bundle.sh b/src/minimal_overlay/bundles/cf_cli/bundle.sh new file mode 100755 index 000000000..cf641b3e8 --- /dev/null +++ b/src/minimal_overlay/bundles/cf_cli/bundle.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +SRC_DIR=$(pwd) + +time sh 01_get.sh +time sh 02_install.sh + +cd $SRC_DIR +