Last active
July 1, 2022 07:55
-
-
Save jhenstridge/425c769949d034033f3d5d90acc2f181 to your computer and use it in GitHub Desktop.
Snapcraft ld.so.cache generation example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
mkdir -p $SNAP_DATA/etc | |
snap_ld_so_conf=$SNAP_DATA/etc/snap-ld.so.conf | |
snap_ld_so_cache=$SNAP_DATA/etc/snap-ld.so.cache | |
real_ld_so_cache=$SNAP_DATA/etc/ld.so.cache | |
RUNTIME=$SNAP/gnome-platform | |
cat > "$snap_ld_so_conf" <<EOF | |
/var/lib/snapd/lib/gl | |
/var/lib/snapd/lib/gl32 | |
$SNAP/lib/x86_64-linux-gnu | |
$SNAP/lib/i386-linux-gnu | |
$SNAP/lib | |
$SNAP/usr/lib/x86_64-linux-gnu | |
$SNAP/usr/lib/i386-linux-gnu | |
$SNAP/usr/lib | |
$SNAP/usr/lib/x86_64-linux-gnu/dri | |
$SNAP/usr/lib/i386-linux-gnu/dri | |
$RUNTIME/lib/x86_64-linux-gnu | |
$RUNTIME/lib/i386-linux-gnu | |
$RUNTIME/lib | |
$RUNTIME/usr/lib/x86_64-linux-gnu | |
$RUNTIME/usr/lib/i386-linux-gnu | |
$RUNTIME/usr/lib | |
$RUNTIME/usr/lib/x86_64-linux-gnu/dri | |
$RUNTIME/usr/lib/i386-linux-gnu/dri | |
/lib/x86_64-linux-gnu | |
/lib/i386-linux-gnu | |
/usr/lib/x86_64-linux-gnu | |
/usr/lib/i386-linux-gnu | |
EOF | |
ldconfig -X -f $snap_ld_so_conf -C $snap_ld_so_cache | |
# We need to update the real ld.so.cache in place rather than moving | |
# over the top of it, since it is the source of a bind mount. | |
cat $snap_ld_so_cache > $real_ld_so_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ld-so-cache-experiment | |
base: core20 | |
version: '0.1' | |
summary: ld.so.cache experiment | |
description: | | |
This is my-snap's description. You have a paragraph or two to tell the | |
most important story about your snap. Keep it under 100 words though, | |
we live in tweetspace and your description wants to look good in the snap | |
store. | |
grade: devel | |
confinement: strict | |
layout: | |
/etc/ld.so.cache: | |
bind-file: $SNAP_DATA/etc/ld.so.cache | |
plugs: | |
desktop: | |
mount-host-font-cache: false | |
opengl: | |
gnome-3-38-2004: | |
interface: content | |
target: $SNAP/gnome-platform | |
default-provider: gnome-3-38-2004 | |
apps: | |
shell: | |
command: bin/run.sh /bin/bash | |
parts: | |
my-part: | |
plugin: nil | |
source: . | |
override-build: | | |
mkdir $SNAPCRAFT_PART_INSTALL/gnome-platform | |
mkdir $SNAPCRAFT_PART_INSTALL/bin | |
cp *.sh $SNAPCRAFT_PART_INSTALL/bin | |
mkdir -p $SNAPCRAFT_PART_INSTALL/snap/hooks | |
ln -s ../../bin/hook.sh $SNAPCRAFT_PART_INSTALL/snap/hooks/post-refresh | |
ln -s ../../bin/hook.sh $SNAPCRAFT_PART_INSTALL/snap/hooks/connect-plug-gnome-3-38-2004 | |
ln -s ../../bin/hook.sh $SNAPCRAFT_PART_INSTALL/snap/hooks/disconnect-plug-gnome-3-38-2004 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment