From be2d6604d63393df6e3a5d3b2fc90e65d25178d6 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Thu, 9 Nov 2017 13:08:47 -0500 Subject: [PATCH] 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 +