From 1fcc7026a54c13443b3536d27944a1b4a8104e67 Mon Sep 17 00:00:00 2001 From: bauen1 Date: Mon, 27 Nov 2017 21:30:30 +0100 Subject: [PATCH] Rewrote glibc_libresolv --- .../bundles/glibc_libresolv/bundle.sh | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/minimal_overlay/bundles/glibc_libresolv/bundle.sh b/src/minimal_overlay/bundles/glibc_libresolv/bundle.sh index e5c93cd35..cf2ad0413 100755 --- a/src/minimal_overlay/bundles/glibc_libresolv/bundle.sh +++ b/src/minimal_overlay/bundles/glibc_libresolv/bundle.sh @@ -9,24 +9,34 @@ if [ ! -d $SYSROOT ] ; then exit 1 fi -mkdir -p "$WORK_DIR/overlay/$BUNDLE_NAME" -cd $WORK_DIR/overlay/$BUNDLE_NAME +echo "Preparing the overlay $BUNDLE_NAME folder. This may take a while..." +rm -rf $WORK_DIR/overlay/$BUNDLE_NAME +mkdir -p $WORK_DIR/overlay/$BUNDLE_NAME/lib -DESTDIR="$PWD/${BUNDLE_NAME}_installed" +cd $SYSROOT/lib -rm -rf $DESTDIR +find . -name "libresolv*" -type l -exec cp {} $WORK_DIR/overlay/$BUNDLE_NAME/lib \; +echo "All libraries have been copied." -mkdir -p $DESTDIR/lib -cp $SYSROOT/lib/libresolv.so.2 $DESTDIR/lib/ -ln -s libresolv.so.2 $DESTDIR/lib/libresolv.so +cd $WORK_DIR/overlay/$BUNDLE_NAME/lib -echo "Reducing $BUNDLE_NAME size" -strip -g $DESTDIR/lib/* +for FILE_DEL in `ls *.so` +do + FILE_KEEP=`ls $FILE_DEL.*` -ROOTFS="$WORK_DIR/src/minimal_overlay/rootfs" + if [ ! "$FILE_KEEP" = "" ] ; then + # We remove the shorter file and replace it with symbolic link. + rm $FILE_DEL + ln -s $FILE_KEEP $FILE_DEL + fi +done +echo "Duplicate libraries have been replaced with soft links." -cp -r $DESTDIR/* $ROOTFS +strip -g * +echo "All libraries have been optimized for size." -echo "$BUNDLE_NAME has been installed." +cp -r $WORK_DIR/overlay/$BUNDLE_NAME/lib $WORK_DIR/src/minimal_overlay/rootfs + +echo "All $BUNDLE_NAME libraries have been installed." cd $SRC_DIR