From 4dc6a89732061e64a8bd5c3b24b793559b95a87d Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Fri, 23 Sep 2016 23:29:41 +0300 Subject: Automatically move libs --- protostar | 51 ++++++++++++++++++--------------------------------- 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/protostar b/protostar index a5be59c..9589ddd 100755 --- a/protostar +++ b/protostar @@ -212,39 +212,6 @@ mkdir -p "${BOOTARCH}/cdrom" touch "${BOOTARCH}/reconfigure" pushd "${ROOT}" - -# We use 32-bit installgrub, but is not required to boot ;-) -if [ -e lib32 ]; then - mkdir -p usr/lib32 - mv lib32/* usr/lib32/ - ln -sf usr/lib32 $BOOTARCH/lib32 -fi - -# Move some critical libs: -march=`dpkg-architecture -qDEB_HOST_MULTIARCH` -mkdir -p lib/$march -for lib in \ - libbrand \ - libdiskmgt \ - libexacct \ - libfmevent \ - libidmap \ - libipmi \ - liblzma \ - libpool \ - libproject \ - libsmbios \ - libsqlite \ - libsunavl \ - libtecla \ - libtopo \ - libxml2 \ - libzonecfg \ - ; do - mv -v -f usr/lib/$march/$lib.so.* lib/$march/ || \ - mv -v -f usr/lib/$lib.so.* lib/$march/ -done - # Moving some files from usr to usr1 # and creating symlinks from usr to usr1 usr_symlink_move usr/bin/cat @@ -263,6 +230,24 @@ usr_symlink_move usr/sbin/dladm usr_symlink_move usr/sbin/ipadm usr_symlink_move usr/sbin/lofiadm +bins=$(find usr1/*bin sbin usr1/lib lib/svc -type f) +libs=$(chroot . /usr/bin/ldd $bins 2>/dev/null | sed -rn '/=>/ s,.*=>\s*(/usr/\S*),\1,p' | sort -u || true) +for lib in $libs; do + usrdir=$(dirname "$lib") + rootdir=${usrdir/\/usr\//} + mkdir -p "$rootdir" + mv -v -f "./$lib"* "$rootdir/" +done +march=`dpkg-architecture -qDEB_HOST_MULTIARCH` +mv -fv ./lib/lib*.so* "./lib/$march/" || true + +# We use 32-bit installgrub, but it is not required to boot ;-) +if [ -e lib32 ]; then + rm -rf usr/lib32 + mv lib32 usr/lib32 + ln -sf usr/lib32 $BOOTARCH/lib32 +fi + # usr2 will be packed and stored on CD: mv usr usr2 -- cgit v1.2.3