From e7bed86b9c4d7d17c5a575aef2db33e918b3e3a5 Mon Sep 17 00:00:00 2001 From: Ivan Davidov Date: Sat, 2 Dec 2017 18:53:30 +0200 Subject: [PATCH] Fixed the 'cf_cli' bundle. Added new bundles 'bosh_cli" and 'cf_tools'. --- src/.config | 10 +++++- src/README | 14 ++++++++ .../bundles/bosh_cli/01_get.sh | 34 +++++++++++++++++++ .../bundles/bosh_cli/02_install.sh | 27 +++++++++++++++ .../bundles/bosh_cli/bundle.sh | 10 ++++++ src/minimal_overlay/bundles/cf_cli/01_get.sh | 8 ++--- .../bundles/cf_cli/02_install.sh | 12 +++---- .../bundles/cf_tools/bundle.sh | 5 +++ .../bundles/cf_tools/bundle_deps | 2 ++ 9 files changed, 108 insertions(+), 14 deletions(-) create mode 100755 src/minimal_overlay/bundles/bosh_cli/01_get.sh create mode 100755 src/minimal_overlay/bundles/bosh_cli/02_install.sh create mode 100755 src/minimal_overlay/bundles/bosh_cli/bundle.sh create mode 100755 src/minimal_overlay/bundles/cf_tools/bundle.sh create mode 100644 src/minimal_overlay/bundles/cf_tools/bundle_deps diff --git a/src/.config b/src/.config index 3645f3354..4c55b044a 100644 --- a/src/.config +++ b/src/.config @@ -45,7 +45,13 @@ SYSLINUX_SOURCE_URL=http://kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.0 # # http://github.com/cloudfoundry/cli # -CLOUD_FOUNDRY_CLI_URL=http://cli.run.pivotal.io/stable?release=linux64-binary&source=github +BOSH_CLI_URL=https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-2.0.45-linux-amd64 + +# 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 # You can find the latest coreutils source bundles here: # @@ -230,7 +236,9 @@ OVERLAY_TYPE=folder # Currently available overlay software: # # glibc_full - all core GNU C libraries (useful if other software is included). +# bosh_cli - BOSH CLI (command line interface). # cf_cli - Cloud Foundry CLI (command line interface). +# cf_tools - all BOSH and CLoud Foundry tools. # coreutils - set of commonly used GNU executable utilities. # dhcp - DHCP and DNS functionality. # dialog - shell scripting for ncurses diff --git a/src/README b/src/README index 95609261b..fcb104da3 100644 --- a/src/README +++ b/src/README @@ -27,6 +27,20 @@ Currently available overlay bundles: This overlay bundle depends on the GLIBC build process. +* bosh_cli - BOSH command line tool. It can be used as landscape manager for + virtual network and server infrastructures in cloud environment, + e.g. AWS, Google Cloud, etc. The most common use case for this + tool is to create and manage Cloud Foundry infrastructures. + +* cf_cli - Cloud Foundry command line tool. It can be used to manage all + aspects of already existing Cloud Foundry installation, including + the full software development lifecycle in cloud environment. + +* cf_tools - This is metapackage which installs all BOSH and Cloud Foundry + tools. Note that in MLL context these tools are mostly useful + as remote managers for already existing BOSH and Cloud Foundry + cloud infrastructures. + * coreutils - Set of commonly used GNU executable utilities. * dhcp - DHCP and DNS functionality to connect to the Internet. diff --git a/src/minimal_overlay/bundles/bosh_cli/01_get.sh b/src/minimal_overlay/bundles/bosh_cli/01_get.sh new file mode 100755 index 000000000..7dbf4950f --- /dev/null +++ b/src/minimal_overlay/bundles/bosh_cli/01_get.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +set -e + +# Grab everything after the '=' character. +DOWNLOAD_URL=`grep -i ^BOSH_CLI_URL= $CONFIG | cut -f2- -d'=' | xargs` + +# 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/bosh-cli ] ; then + echo "Shell script '$MAIN_SRC_DIR/source/overlay/bosh-cli' is missing and will be downloaded." + USE_LOCAL_SOURCE="false" +fi + +cd $MAIN_SRC_DIR/source/overlay + +if [ ! "$USE_LOCAL_SOURCE" = "true" ] ; then + # Downloading BOSH CLI binary. The '-c' option allows the download to resume. + echo "Downloading BOSH CLI binary from $DOWNLOAD_URL" + wget -O bosh-cli -c $DOWNLOAD_URL +else + echo "Using local BOSH CLI binary '$MAIN_SRC_DIR/source/overlay/bosh-cli'." +fi + +# Delete folder with previously prepared BOSH CLI. +echo "Removing BOSH CLI work area. This may take a while." +rm -rf $WORK_DIR/overlay/$BUNDLE_NAME +mkdir $WORK_DIR/overlay/$BUNDLE_NAME + +# Copy bosh-cli to folder 'work/overlay/bosh_cli'. +cp bosh-cli $WORK_DIR/overlay/$BUNDLE_NAME + +cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/bosh_cli/02_install.sh b/src/minimal_overlay/bundles/bosh_cli/02_install.sh new file mode 100755 index 000000000..e6caa7751 --- /dev/null +++ b/src/minimal_overlay/bundles/bosh_cli/02_install.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +set -e + +echo "Removing old 'BOSH CLI' artifacts. This may take a while." +rm -rf $DEST_DIR +mkdir -p $DEST_DIR/opt/$BUNDLE_NAME +mkdir -p $DEST_DIR/usr/bin + +cd $DEST_DIR + +cp $MAIN_SRC_DIR/source/overlay/bosh-cli opt/$BUNDLE_NAME/bosh + +chmod +rx opt/$BUNDLE_NAME/bosh + +cd $DEST_DIR/usr/bin + +ln -s ../../opt/$BUNDLE_NAME/bosh bosh + +# With '--remove-destination' all possibly existing soft links in +# '$OVERLAY_ROOTFS' will be overwritten correctly. +cp -r --remove-destination $DEST_DIR/* \ + $OVERLAY_ROOTFS + +echo "Bundle 'BOSH CLI' has been installed." + +cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/bosh_cli/bundle.sh b/src/minimal_overlay/bundles/bosh_cli/bundle.sh new file mode 100755 index 000000000..0be2a10d3 --- /dev/null +++ b/src/minimal_overlay/bundles/bosh_cli/bundle.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +. ../../common.sh + +./01_get.sh +./02_install.sh + +cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/cf_cli/01_get.sh b/src/minimal_overlay/bundles/cf_cli/01_get.sh index f11fc4a87..5ff387da0 100755 --- a/src/minimal_overlay/bundles/cf_cli/01_get.sh +++ b/src/minimal_overlay/bundles/cf_cli/01_get.sh @@ -2,17 +2,13 @@ set -e -. ../../common.sh - # 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" +DOWNLOAD_URL=`grep -i ^CLOUD_FOUNDRY_CLI_URL= $CONFIG | cut -f2- -d'=' | xargs` # 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 +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 diff --git a/src/minimal_overlay/bundles/cf_cli/02_install.sh b/src/minimal_overlay/bundles/cf_cli/02_install.sh index b71f56273..a6a1505af 100755 --- a/src/minimal_overlay/bundles/cf_cli/02_install.sh +++ b/src/minimal_overlay/bundles/cf_cli/02_install.sh @@ -2,12 +2,10 @@ set -e -. ../../common.sh - -echo "Removing old cloud foundry artifacts. This may take a while." +echo "Removing old 'Cloud Foundry CLI' artifacts. This may take a while." rm -rf $DEST_DIR mkdir -p $DEST_DIR/opt/$BUNDLE_NAME -mkdir -p $DEST_DIR/bin +mkdir -p $DEST_DIR/usr/bin cd $WORK_DIR/overlay/$BUNDLE_NAME @@ -19,15 +17,15 @@ chmod +rx cf cp cf $DEST_DIR/opt/$BUNDLE_NAME/cf -cd $DEST_DIR +cd $DEST_DIR/usr/bin -ln -s ../opt/$BUNDLE_NAME/cf bin/cf +ln -s ../../opt/$BUNDLE_NAME/cf cf # With '--remove-destination' all possibly existing soft links in # '$OVERLAY_ROOTFS' will be overwritten correctly. cp -r --remove-destination $DEST_DIR/* \ $OVERLAY_ROOTFS -echo "Cloud Foundry CLI has been installed." +echo "Bundle 'Cloud Foundry CLI' has been installed." cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/cf_tools/bundle.sh b/src/minimal_overlay/bundles/cf_tools/bundle.sh new file mode 100755 index 000000000..7b01e6f86 --- /dev/null +++ b/src/minimal_overlay/bundles/cf_tools/bundle.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +set -e + +echo "All BOSH and Cloud Foundry tools have been installed." diff --git a/src/minimal_overlay/bundles/cf_tools/bundle_deps b/src/minimal_overlay/bundles/cf_tools/bundle_deps new file mode 100644 index 000000000..b296e6fac --- /dev/null +++ b/src/minimal_overlay/bundles/cf_tools/bundle_deps @@ -0,0 +1,2 @@ +bosh_cli +cf_cli