mirror of
https://github.com/diddlesnaps/makemkv.git
synced 2026-04-22 15:01:03 -04:00
Add ld-cache and reduce snap size
Signed-off-by: Daniel Llewellyn <daniel@bowlhat.net>
This commit is contained in:
committed by
Daniel Llewellyn
parent
962147eee8
commit
1b5e9609ce
20
scripts/build-ld-cache
Executable file
20
scripts/build-ld-cache
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/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"
|
||||
32
scripts/check-ld-cache
Executable file
32
scripts/check-ld-cache
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# save the original LD_LIBRARY_PATH, and unset it to check the cache
|
||||
ORIGINAL_LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
|
||||
LD_LIBRARY_PATH=""
|
||||
export LD_LIBRARY_PATH
|
||||
|
||||
# FINAL_BINARY should be set and exported to what the "real" final executable
|
||||
# that's run is so we can check that
|
||||
# an alternative would be to always run the "real" final executable immediately
|
||||
# after this script in the chain, and then check "$1" here, but that is probably
|
||||
# fragile
|
||||
if [ -z "$FINAL_BINARY" ]; then
|
||||
echo "FINAL_BINARY unset, can't check the dynamic linker cache for correctness"
|
||||
else
|
||||
# this is a bit tricky, we want to exit 0 if we didn't find a library, but
|
||||
# exit 1 if we didn't _not_ find a library, so use the output phrase
|
||||
# "=> not found" as what to look for from ldd
|
||||
# TODO: make this less of a hack?
|
||||
if ldd "$FINAL_BINARY" | grep "=> not found" | grep -q "=> not found"; then
|
||||
# regenerate the cache first
|
||||
LD_LIBRARY_PATH=$ORIGINAL_LD_LIBRARY_PATH
|
||||
export LD_LIBRARY_PATH
|
||||
# "$SNAP/bin/build-ld-cache"
|
||||
# # unset to continue executing the next command in the chain
|
||||
# LD_LIBRARY_PATH=""
|
||||
# export LD_LIBRARY_PATH
|
||||
fi
|
||||
fi
|
||||
|
||||
# execute the next command in the chain
|
||||
exec "$@"
|
||||
23
scripts/makemkv-launch
Executable file
23
scripts/makemkv-launch
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
if [ ! -f $SNAP_USER_DATA/.MakeMKV/settings.conf ]; then
|
||||
mkdir -p $SNAP_USER_DATA/.MakeMKV
|
||||
|
||||
cat > $SNAP_USER_DATA/.MakeMKV/settings.conf <<SEOF
|
||||
#
|
||||
# MakeMKV settings file, written by MakeMKV v1.14.5 linux(x64-release)
|
||||
#
|
||||
|
||||
app_DestinationDir = ""
|
||||
app_Java = ""
|
||||
app_Key = ""
|
||||
app_PreferredLanguage = ""
|
||||
app_ccextractor = "/snap/makemkv/current/usr/bin/ccextractor"
|
||||
dvd_MinimumTitleLength = "300"
|
||||
sdf_Stop = ""
|
||||
SEOF
|
||||
|
||||
elif grep 'app_ccextractor = ""' $SNAP_USER_DATA/.MakeMKV/settings.conf; then
|
||||
sed -i -E 's|(app_ccextractor = )""|\1"/snap/makemkv/current/usr/bin/ccextractor"|' $SNAP_USER_DATA/.MakeMKV/settings.conf
|
||||
fi
|
||||
|
||||
exec $@
|
||||
Reference in New Issue
Block a user