From cc5c2477627aa2874704319ad3447db574a9fac9 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Thu, 9 Nov 2017 13:07:55 -0500 Subject: [PATCH 1/6] Update .config --- src/.config | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/.config b/src/.config index 1f2c88734..ec67014e2 100644 --- a/src/.config +++ b/src/.config @@ -92,6 +92,12 @@ CLOUD_FOUNDRY_CLI_URL=http://cli.run.pivotal.io/stable?release=linux64-binary&so # OPENJDK_URL=http://download.java.net/java/GA/jdk9/9/binaries/jdk-9+181_linux-x64_bin.tar.gz +# You can find the latest util_linux archives here: +# +# https://www.kernel.org/pub/linux/utils/util-linux/ +# +UTIL_LINUX_SOURCE_URL=https://www.kernel.org/pub/linux/utils/util-linux/v2.31/util-linux-2.31.tar.gz + # You can find the latest ZLIB source bundles here: # # http://zlib.net From be2d6604d63393df6e3a5d3b2fc90e65d25178d6 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Thu, 9 Nov 2017 13:08:47 -0500 Subject: [PATCH 2/6] Add files via upload --- .../bundles/util_linux/01_get.sh | 41 +++++++++++++++++ .../bundles/util_linux/02_build.sh | 46 +++++++++++++++++++ .../bundles/util_linux/bundle.sh | 9 ++++ 3 files changed, 96 insertions(+) create mode 100644 src/minimal_overlay/bundles/util_linux/01_get.sh create mode 100644 src/minimal_overlay/bundles/util_linux/02_build.sh create mode 100644 src/minimal_overlay/bundles/util_linux/bundle.sh diff --git a/src/minimal_overlay/bundles/util_linux/01_get.sh b/src/minimal_overlay/bundles/util_linux/01_get.sh new file mode 100644 index 000000000..e51161c08 --- /dev/null +++ b/src/minimal_overlay/bundles/util_linux/01_get.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +SRC_DIR=$(pwd) + +. ../../common.sh + +# Grab everything after the '=' character. +DOWNLOAD_URL=$(grep -i UTIL_LINUX_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 util-linux source bundle file. The '-c' option allows the download to resume. + echo "Downloading util-linux source bundle from $DOWNLOAD_URL" + wget -c $DOWNLOAD_URL +else + echo "Using local util-linux source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE" +fi + +# Delete folder with previously extracted util-linux. +echo "Removing util-linux work area. This may take a while..." +rm -rf $WORK_DIR/overlay/util_linux +mkdir $WORK_DIR/overlay/util_linux + +# Extract util-linux to folder 'work/overlay/util_linux'. +# Full path will be something like 'work/overlay/util_linux/util-linux-2.31'. +tar -xvf $ARCHIVE_FILE -C $WORK_DIR/overlay/util_linux + +cd $SRC_DIR + diff --git a/src/minimal_overlay/bundles/util_linux/02_build.sh b/src/minimal_overlay/bundles/util_linux/02_build.sh new file mode 100644 index 000000000..8dc26a21c --- /dev/null +++ b/src/minimal_overlay/bundles/util_linux/02_build.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +. ../../common.sh + +cd $WORK_DIR/overlay/util_linux + +DESTDIR="$PWD/util_linux_installed" + +# Change to the util-linux source directory which ls finds, e.g. 'util-linux-2.31'. +cd $(ls -d util-linux-*) + +echo "Preparing util-linux work area. This may take a while..." +make -j $NUM_JOBS clean + +rm -rf $DESTDIR + +echo "Configuring util-linux..." +CFLAGS="$CFLAGS" ./configure \ + --prefix=/usr \ + --disable-graphics \ + --disable-utf8 \ + --without-ipv6 \ + --without-ssl \ + --without-zlib \ + --without-x + +echo "Building util-linux..." +make -j $NUM_JOBS + +echo "Installing util-linux..." +make -j $NUM_JOBS install DESTDIR=$DESTDIR + +echo "Reducing util-linux size..." +strip -g $DESTDIR/usr/bin/* + +ROOTFS="$WORK_DIR/src/minimal_overlay/rootfs" + +mkdir -p "$ROOTFS/usr/bin" +cp -r $DESTDIR/usr/bin/* $ROOTFS/usr/bin/ + +echo "util-linux has been installed." + +cd $SRC_DIR + diff --git a/src/minimal_overlay/bundles/util_linux/bundle.sh b/src/minimal_overlay/bundles/util_linux/bundle.sh new file mode 100644 index 000000000..6284178ab --- /dev/null +++ b/src/minimal_overlay/bundles/util_linux/bundle.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +SRC_DIR=$(pwd) + +time sh 01_get.sh +time sh 02_build.sh + +cd $SRC_DIR + From 736b7552656ff3612028c8cd25ec7efa16f2f119 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Fri, 10 Nov 2017 12:01:55 -0500 Subject: [PATCH 3/6] Update 02_build.sh --- src/minimal_overlay/bundles/util_linux/02_build.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/minimal_overlay/bundles/util_linux/02_build.sh b/src/minimal_overlay/bundles/util_linux/02_build.sh index 8dc26a21c..d9407ebf9 100644 --- a/src/minimal_overlay/bundles/util_linux/02_build.sh +++ b/src/minimal_overlay/bundles/util_linux/02_build.sh @@ -37,10 +37,8 @@ strip -g $DESTDIR/usr/bin/* ROOTFS="$WORK_DIR/src/minimal_overlay/rootfs" -mkdir -p "$ROOTFS/usr/bin" -cp -r $DESTDIR/usr/bin/* $ROOTFS/usr/bin/ +cp -r $DESTDIR/* $ROOTFS echo "util-linux has been installed." cd $SRC_DIR - From 038f75320b9b43d112316c63fa90b577c18ae755 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Fri, 10 Nov 2017 12:13:07 -0500 Subject: [PATCH 4/6] Update README --- src/README | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/README b/src/README index 3cd2744db..a53b54655 100644 --- a/src/README +++ b/src/README @@ -80,6 +80,9 @@ Currently available overlay bundles: * dhcp - DHCP and DNS functionality +* util_linux - util-linux is a standard package distributed by the Linux Kernel + Organization similar to busybox or GNU Core Utils. + ### ### ### I only provide the build scripts. It's entirely up to you to configure and From d3bd8b8d55b2978255a935ce00c7271c693a3153 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Fri, 10 Nov 2017 12:13:54 -0500 Subject: [PATCH 5/6] Update .config --- src/.config | 1 + 1 file changed, 1 insertion(+) diff --git a/src/.config b/src/.config index ec67014e2..c39c017bb 100644 --- a/src/.config +++ b/src/.config @@ -193,6 +193,7 @@ COPY_SOURCE_ISO=true # cf_cli - CLoud Foundry CLI (command line interface) # nweb - simple mini http server # dhcp - DHCP and DNS functionality +# util_linux - standard package distributed by the Linux Kernel Organization. # zlib - DEFLATE compression/decompression library. # # Refer to the README file for more information. From 9afc41b075597cde774dac522f6c685111c0f217 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Fri, 10 Nov 2017 16:17:26 -0500 Subject: [PATCH 6/6] Update 02_build.sh --- .../bundles/util_linux/02_build.sh | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/minimal_overlay/bundles/util_linux/02_build.sh b/src/minimal_overlay/bundles/util_linux/02_build.sh index d9407ebf9..cfc860174 100644 --- a/src/minimal_overlay/bundles/util_linux/02_build.sh +++ b/src/minimal_overlay/bundles/util_linux/02_build.sh @@ -18,13 +18,19 @@ rm -rf $DESTDIR echo "Configuring util-linux..." CFLAGS="$CFLAGS" ./configure \ - --prefix=/usr \ - --disable-graphics \ - --disable-utf8 \ - --without-ipv6 \ - --without-ssl \ - --without-zlib \ - --without-x + ADJTIME_PATH=/var/lib/hwclock/adjtime \ + --docdir=/usr/share/doc/util-linux-2.31 \ + --disable-chfn-chsh \ + --disable-login \ + --disable-nologin \ + --disable-su \ + --disable-setpriv \ + --disable-runuser \ + --disable-pylibmount \ + --disable-static \ + --without-python \ + --without-systemd \ + --without-systemdsystemunitdir echo "Building util-linux..." make -j $NUM_JOBS