Files
makemkv/scripts/build-ld-cache
Daniel Llewellyn 1b5e9609ce Add ld-cache and reduce snap size
Signed-off-by: Daniel Llewellyn <daniel@bowlhat.net>
2019-12-16 16:16:31 +00:00

20 lines
828 B
Bash
Executable File

#!/bin/bash -ex
# copying the conf dir from real /etc into $SNAP_DATA
mkdir -p "$SNAP_DATA/etc/ld.so.conf.d"
cp -r /etc/ld.so.conf.d/* "$SNAP_DATA/etc/ld.so.conf.d"
cp /etc/ld.so.conf "$SNAP_DATA/etc/ld.so.conf"
# delete empty entries in the LD_LIBRARY_PATH
# i.e. change "/a/b/c:/1/2/3::/other" into "/a/b/c:/1/2/3:/other"
# if we don't do this, then ldconfig gets confused with "" as arguments of dirs
# to add to the cache
LD_LIBRARY_PATH="${LD_LIBRARY_PATH//::/:}"
# run ldconfig on our LD_LIBRARY_PATH lib dirs
IFS=':' read -ra PATHS <<< "$LD_LIBRARY_PATH"
mkdir -p "$SNAP_DATA/fake-etc"
ldconfig -v -C "$SNAP_DATA/fake-etc/ld.so.cache" -f "$SNAP_DATA/etc/ld.so.conf" "${PATHS[@]}"
# install the new ld.so.cache to the global location by just copying it
cp "$SNAP_DATA/fake-etc/ld.so.cache" "$SNAP_DATA/etc/ld.so.cache"