From d28626739f5c7eb9f73c0d51879e3fbe9f4ead32 Mon Sep 17 00:00:00 2001 From: oxedions Date: Mon, 19 Oct 2020 14:23:52 +0200 Subject: [PATCH 1/2] Fix: bundles - Replace glibc_libcrypt by libxcrypt --- .../bundles/dropbear/bundle_deps | 2 +- .../bundles/glibc_full/bundle_deps | 2 +- .../bundles/glibc_libcrypt/bundle.sh | 33 --------------- src/minimal_overlay/bundles/libxcrypt/.config | 5 +++ .../bundles/libxcrypt/01_get.sh | 38 +++++++++++++++++ .../bundles/libxcrypt/02_build.sh | 41 +++++++++++++++++++ .../bundles/libxcrypt/bundle.sh | 10 +++++ 7 files changed, 96 insertions(+), 35 deletions(-) delete mode 100755 src/minimal_overlay/bundles/glibc_libcrypt/bundle.sh create mode 100644 src/minimal_overlay/bundles/libxcrypt/.config create mode 100755 src/minimal_overlay/bundles/libxcrypt/01_get.sh create mode 100755 src/minimal_overlay/bundles/libxcrypt/02_build.sh create mode 100755 src/minimal_overlay/bundles/libxcrypt/bundle.sh diff --git a/src/minimal_overlay/bundles/dropbear/bundle_deps b/src/minimal_overlay/bundles/dropbear/bundle_deps index 12ea48b66..ef4f78d98 100644 --- a/src/minimal_overlay/bundles/dropbear/bundle_deps +++ b/src/minimal_overlay/bundles/dropbear/bundle_deps @@ -1,4 +1,4 @@ glibc_libnsl #glibc_libnss_compat glibc_libutil -glibc_libcrypt +libxcrypt diff --git a/src/minimal_overlay/bundles/glibc_full/bundle_deps b/src/minimal_overlay/bundles/glibc_full/bundle_deps index 12409d184..068c25bb2 100644 --- a/src/minimal_overlay/bundles/glibc_full/bundle_deps +++ b/src/minimal_overlay/bundles/glibc_full/bundle_deps @@ -2,7 +2,6 @@ glibc_ld-linux glibc_libBrokenLocale glibc_libanl glibc_libc -glibc_libcrypt glibc_libdl glibc_libm glibc_libnsl @@ -15,3 +14,4 @@ glibc_libresolv glibc_librt glibc_libthread_db glibc_libutil +libxcrypt diff --git a/src/minimal_overlay/bundles/glibc_libcrypt/bundle.sh b/src/minimal_overlay/bundles/glibc_libcrypt/bundle.sh deleted file mode 100755 index bfb331fdf..000000000 --- a/src/minimal_overlay/bundles/glibc_libcrypt/bundle.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -set -e - -. ../../common.sh - -if [ ! -d $SYSROOT ] ; then - echo "Cannot continue - GLIBC is missing. Please buld GLIBC first." - exit 1 -fi - -mkdir -p "$WORK_DIR/overlay/$BUNDLE_NAME" -cd $WORK_DIR/overlay/$BUNDLE_NAME - -rm -rf $DEST_DIR - -mkdir -p $DEST_DIR/lib -cp $SYSROOT/lib/libcrypt.so.1 $DEST_DIR/lib/ -ln -s libcrypt.so.1 $DEST_DIR/lib/libcrypt.so - -echo "Reducing '$BUNDLE_NAME' size." -set +e -strip -g $DEST_DIR/lib/* -set -e - -# With '--remove-destination' all possibly existing soft links in -# '$OVERLAY_ROOTFS' will be overwritten correctly. -cp -r --remove-destination $DEST_DIR/* \ - $OVERLAY_ROOTFS - -echo "Bundle '$BUNDLE_NAME' has been installed." - -cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/libxcrypt/.config b/src/minimal_overlay/bundles/libxcrypt/.config new file mode 100644 index 000000000..d62327e6a --- /dev/null +++ b/src/minimal_overlay/bundles/libxcrypt/.config @@ -0,0 +1,5 @@ +# You can find the latest xcrypt source bundles here: +# +# https://github.com/besser82/libxcrypt +# +LIBXCRYPT_SOURCE_URL=https://github.com/besser82/libxcrypt/archive/v4.4.17.tar.gz diff --git a/src/minimal_overlay/bundles/libxcrypt/01_get.sh b/src/minimal_overlay/bundles/libxcrypt/01_get.sh new file mode 100755 index 000000000..158d555d9 --- /dev/null +++ b/src/minimal_overlay/bundles/libxcrypt/01_get.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +set -e + +. ../../common.sh + +# Read the common configuration properties. +DOWNLOAD_URL=`read_property LIBXCRYPT_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 LIBXCRYPT source bundle file. The '-c' option allows the download to resume. + echo "Downloading LIBXCRYPT source bundle from $DOWNLOAD_URL" + wget -c $DOWNLOAD_URL +else + echo "Using local LIBXCRYPT source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE" +fi + +# Delete folder with previously extracted LIBXCRYPT. +echo "Removing LIBXCRYPT work area. This may take a while." +rm -rf $WORK_DIR/overlay/$BUNDLE_NAME +mkdir $WORK_DIR/overlay/$BUNDLE_NAME + +# Extract LIBXCRYPT to folder 'work/overlay/glibc_libcrypt'. +# Full path will be something like 'work/overlay/glibc_libcrypt/glibc_libcrypt-4.4.17'. +tar -xvf $ARCHIVE_FILE -C $WORK_DIR/overlay/$BUNDLE_NAME + +cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/libxcrypt/02_build.sh b/src/minimal_overlay/bundles/libxcrypt/02_build.sh new file mode 100755 index 000000000..807ecb10c --- /dev/null +++ b/src/minimal_overlay/bundles/libxcrypt/02_build.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +set -e + +. ../../common.sh + +cd $WORK_DIR/overlay/$BUNDLE_NAME + +# Change to the Links source directory which ls finds, e.g. 'libxcrypt-4.4.17'. +cd $(ls -d libxcrypt-*) + +echo "Generating configure." +./autogen.sh + +rm -rf $DEST_DIR + +echo "Configuring '$BUNDLE_NAME'." +CFLAGS="$CFLAGS" ./configure \ + --prefix=$DEST_DIR + +echo "Preparing '$BUNDLE_NAME' work area. This may take a while." +make clean + +echo "Building '$BUNDLE_NAME'." +make -j $NUM_JOBS + +echo "Installing '$BUNDLE_NAME'." +make -j $NUM_JOBS install + +echo "Reducing '$BUNDLE_NAME' size." +set +e +strip -g $DEST_DIR/lib/* +set -e + +# With '--remove-destination' all possibly existing soft links in +# '$OVERLAY_ROOTFS' will be overwritten correctly. +cp -r --remove-destination $DEST_DIR/lib/libcrypt.so* $OVERLAY_ROOTFS/lib/ + +echo "Bundle '$BUNDLE_NAME' has been installed." + +cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/libxcrypt/bundle.sh b/src/minimal_overlay/bundles/libxcrypt/bundle.sh new file mode 100755 index 000000000..e132bc25f --- /dev/null +++ b/src/minimal_overlay/bundles/libxcrypt/bundle.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +. ../../common.sh + +./01_get.sh +./02_build.sh + +cd $SRC_DIR From a91271279427faa47174d440401722cb66fa9dba Mon Sep 17 00:00:00 2001 From: oxedions Date: Mon, 19 Oct 2020 16:55:06 +0200 Subject: [PATCH 2/2] Fix: bundles - Remove glibc references into libxcrypt scripts --- src/minimal_overlay/bundles/libxcrypt/01_get.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/minimal_overlay/bundles/libxcrypt/01_get.sh b/src/minimal_overlay/bundles/libxcrypt/01_get.sh index 158d555d9..004315f17 100755 --- a/src/minimal_overlay/bundles/libxcrypt/01_get.sh +++ b/src/minimal_overlay/bundles/libxcrypt/01_get.sh @@ -31,8 +31,8 @@ echo "Removing LIBXCRYPT work area. This may take a while." rm -rf $WORK_DIR/overlay/$BUNDLE_NAME mkdir $WORK_DIR/overlay/$BUNDLE_NAME -# Extract LIBXCRYPT to folder 'work/overlay/glibc_libcrypt'. -# Full path will be something like 'work/overlay/glibc_libcrypt/glibc_libcrypt-4.4.17'. +# Extract LIBXCRYPT to folder 'work/overlay/libxcrypt'. +# Full path will be something like 'work/overlay/libxcrypt/libxcrypt-4.4.17'. tar -xvf $ARCHIVE_FILE -C $WORK_DIR/overlay/$BUNDLE_NAME cd $SRC_DIR