diff --git a/src/.config b/src/.config index 579497e5f..1640eecd7 100644 --- a/src/.config +++ b/src/.config @@ -125,6 +125,7 @@ OVERLAY_TYPE=folder # # glibc_full - all core GNU C libraries. # bosh_cli - BOSH CLI (command line interface). +# c2048 - console version of the game 2048 # cf_cli - Cloud Foundry CLI (command line interface). # cf_tools - all BOSH and Cloud Foundry tools. # coreutils - set of commonly used GNU executable utilities. diff --git a/src/README b/src/README index 139e8971e..41cd29cd9 100644 --- a/src/README +++ b/src/README @@ -29,6 +29,8 @@ Currently available overlay bundles: case for this tool is to create and manage Cloud Foundry infrastructures. + c2048 - console version of the game 2048 + 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 diff --git a/src/minimal_overlay/bundles/c2048/.config b/src/minimal_overlay/bundles/c2048/.config new file mode 100644 index 000000000..cfa50b0d3 --- /dev/null +++ b/src/minimal_overlay/bundles/c2048/.config @@ -0,0 +1,5 @@ +# You can find the latest c2048 source bundles here: +# +# https://github.com/mevdschee/2048.c +# +C2048_SOURCE_URL=https://raw.githubusercontent.com/mevdschee/2048.c/master/2048.c diff --git a/src/minimal_overlay/bundles/c2048/01_get.sh b/src/minimal_overlay/bundles/c2048/01_get.sh new file mode 100755 index 000000000..395b74d66 --- /dev/null +++ b/src/minimal_overlay/bundles/c2048/01_get.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +set -e + +. ../../common.sh + +# Read the common configuration properties. +DOWNLOAD_URL=`read_property C2048_SOURCE_URL` +USE_LOCAL_SOURCE=`read_property USE_LOCAL_SOURCE` + +# Grab everything after the last '/' character. +ARCHIVE_FILE=${DOWNLOAD_URL##*/} + +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 c2048 source bundle file. The '-c' option allows the download to resume. + echo "Downloading c2048 source bundle from $DOWNLOAD_URL" + wget -c $DOWNLOAD_URL +else + echo "Using local c2048 source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE" +fi + +# Delete folder with previously extracted 2048. +echo "Removing c2048 work area. This may take a while." +rm -rf $WORK_DIR/overlay/$BUNDLE_NAME +mkdir $WORK_DIR/overlay/$BUNDLE_NAME + +cp $ARCHIVE_FILE $WORK_DIR/overlay/$BUNDLE_NAME + +cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/c2048/02_build.sh b/src/minimal_overlay/bundles/c2048/02_build.sh new file mode 100755 index 000000000..17274501e --- /dev/null +++ b/src/minimal_overlay/bundles/c2048/02_build.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +. ../../common.sh + +cd $WORK_DIR/overlay/$BUNDLE_NAME + +rm -f 2048 + +gcc $CFLAGS -Os -o 2048 2048.c +strip -g 2048 + +mkdir -p $OVERLAY_ROOTFS/usr/bin +cp --remove-destination $PWD/2048 $OVERLAY_ROOTFS/usr/bin/ + +echo "Bundle 'c2048' has been installed." + +cd $SRC_DIR + diff --git a/src/minimal_overlay/bundles/c2048/bundle.sh b/src/minimal_overlay/bundles/c2048/bundle.sh new file mode 100755 index 000000000..cacf2e88b --- /dev/null +++ b/src/minimal_overlay/bundles/c2048/bundle.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +./01_get.sh +./02_build.sh + +cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/c2048/bundle_deps b/src/minimal_overlay/bundles/c2048/bundle_deps new file mode 100644 index 000000000..e471f21bf --- /dev/null +++ b/src/minimal_overlay/bundles/c2048/bundle_deps @@ -0,0 +1 @@ +glibc_libc