diff --git a/src/.config b/src/.config index 7628b6da3..df73420c1 100644 --- a/src/.config +++ b/src/.config @@ -157,6 +157,11 @@ VIM_SOURCE_URL=https://github.com/vim/vim/archive/v8.0.1298.tar.gz # ZLIB_SOURCE_URL=http://zlib.net/zlib-1.2.11.tar.xz +# You can find the latest dialog source bundles here: +# +# http://invisible-island.net/dialog/ +# +DIALOG_SOURCE_URL=ftp://ftp.invisible-island.net/dialog/dialog-1.3-20170509.tgz #################################################### # # @@ -237,6 +242,7 @@ COPY_SOURCE_ISO=true # cf_cli - CLoud Foundry CLI (command line interface). # coreutils - set of commonly used GNU executable utilities. # dhcp - DHCP and DNS functionality. +# dialog - shell scripting for ncurses # dropbear - SSH server and client. # felix - Apache Felix OSGi framework. # fio - I/O load generator. diff --git a/src/README b/src/README index b63b32837..317230c0c 100644 --- a/src/README +++ b/src/README @@ -31,6 +31,10 @@ Currently available overlay bundles: * dhcp - DHCP and DNS functionality to connect to the Internet. +* dialog - shell scripting library for ncurses + + This overlay bundle requires ncurses + * Dropbear - SSH server/client. Requires ~1MB additional space. The build process creates user 'root' with password 'toor'. These are sample commands which demonstrate how to use Dropbear: diff --git a/src/minimal_overlay/bundles/dialog/01_get.sh b/src/minimal_overlay/bundles/dialog/01_get.sh new file mode 100755 index 000000000..b6f3e00e0 --- /dev/null +++ b/src/minimal_overlay/bundles/dialog/01_get.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +SRC_DIR=$(pwd) + +. ../../common.sh + +# Grab everything after the '=' character. +DOWNLOAD_URL=$(grep -i DIALOG_SOURCE_URL $MAIN_SRC_DIR/.config | cut -f2 -d'=') + +# Grab everything after the last '/' character. +ARCHIVE_FILE=${DOWNLOAD_URL##*/} + +# 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/$ARCHIVE_FILE ] ; then + echo "Source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE is missing and will be downloaded." + USE_LOCAL_SOURCE="false" +fi + +cd $MAIN_SRC_DIR/source/overlay + +if [ ! "$USE_LOCAL_SOURCE" = "true" ] ; then + # Downloading dialog source bundle file. The '-c' option allows the download to resume. + echo "Downloading dialog source bundle from $DOWNLOAD_URL" + wget -c $DOWNLOAD_URL +else + echo "Using local dialog source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE" +fi + +# Delete folder with previously extracted dialog. +echo "Removing dialog work area. This may take a while..." +rm -rf $WORK_DIR/overlay/dialog +mkdir $WORK_DIR/overlay/dialog + +# Extract dialog to folder 'work/overlay/dialog'. +# Full path will be something like 'work/overlay/dialog/dialog-1.3-20170509'. +tar -xvf $ARCHIVE_FILE -C $WORK_DIR/overlay/dialog + +cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/dialog/02_build.sh b/src/minimal_overlay/bundles/dialog/02_build.sh new file mode 100755 index 000000000..29fdb8f74 --- /dev/null +++ b/src/minimal_overlay/bundles/dialog/02_build.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +. ../../common.sh + +cd $WORK_DIR/overlay/dialog + +DESTDIR="$PWD/dialog_installed" + +# Change to the dialog source directory which ls finds, e.g. 'dialog-1.3-20170509'. +cd $(ls -d dialog-*) + +echo "Preparing dialog work area. This may take a while..." +make -j $NUM_JOBS clean + +rm -rf $DESTDIR + +# Configure dialog +echo "Configuring dialog..." +CFLAGS="$CFLAGS" ./configure \ + --prefix=/usr + +echo "Building dialog..." +make -j $NUM_JOBS + +echo "Installing dialog..." +make -j $NUM_JOBS install DESTDIR=$DESTDIR + +echo "Reducing dialog size..." +strip -g $DESTDIR/usr/bin/* + +ROOTFS="$WORK_DIR/src/minimal_overlay/rootfs" + +cp -r $DESTDIR/usr/* $ROOTFS + +echo "dialog has been installed." + +cd $SRC_DIR + diff --git a/src/minimal_overlay/bundles/dialog/bundle.sh b/src/minimal_overlay/bundles/dialog/bundle.sh new file mode 100755 index 000000000..3935ced35 --- /dev/null +++ b/src/minimal_overlay/bundles/dialog/bundle.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +SRC_DIR=$(pwd) + +./01_get.sh +./02_build.sh + +cd $SRC_DIR +