Merge pull request #88 from TechnologyClassroom/util-linux
This adds 'util-linux' as overlay bundle.
This commit is contained in:
		
						commit
						85f5beef57
					
				@ -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
 | 
			
		||||
@ -187,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.
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										41
									
								
								src/minimal_overlay/bundles/util_linux/01_get.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								src/minimal_overlay/bundles/util_linux/01_get.sh
									
									
									
									
									
										Normal file
									
								
							@ -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
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										50
									
								
								src/minimal_overlay/bundles/util_linux/02_build.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								src/minimal_overlay/bundles/util_linux/02_build.sh
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,50 @@
 | 
			
		||||
#!/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 \
 | 
			
		||||
  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
 | 
			
		||||
 | 
			
		||||
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"
 | 
			
		||||
 | 
			
		||||
cp -r $DESTDIR/* $ROOTFS
 | 
			
		||||
 | 
			
		||||
echo "util-linux has been installed."
 | 
			
		||||
 | 
			
		||||
cd $SRC_DIR
 | 
			
		||||
							
								
								
									
										9
									
								
								src/minimal_overlay/bundles/util_linux/bundle.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								src/minimal_overlay/bundles/util_linux/bundle.sh
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
SRC_DIR=$(pwd)
 | 
			
		||||
 | 
			
		||||
time sh 01_get.sh
 | 
			
		||||
time sh 02_build.sh
 | 
			
		||||
 | 
			
		||||
cd $SRC_DIR
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user