Skip to content

Commit 774c0c7

Browse files
committed
Add script to modify HW libs in AppImage
1 parent f4615cf commit 774c0c7

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

installer/mangle-hw-libs.sh

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/sh
2+
3+
4+
usage()
5+
{
6+
progname=$(basename $0)
7+
cat << __EOM__
8+
${progname} - Replace system paths encoded into shared libraries
9+
10+
Usage: ${progname} HW_LIB_DIR
11+
Arguments:
12+
HW_LIB_DIR The directory containing libraries to be processed.
13+
(Files will be modified IN PLACE, without backups.)
14+
__EOM__
15+
}
16+
17+
# Bail with usage information, if the directory path is unset
18+
[ -z $1 ] && usage && exit -1
19+
20+
# We take one argument, the path in which to look for target libraries
21+
hw_lib_dir=$(realpath "$1")
22+
23+
# Count files processed
24+
((processed=0))
25+
26+
echo -n "Looking for libvdpau.so.1..."
27+
hwlib="${hw_lib_dir}/libvdpau.so.1"
28+
if [ -w "${hwlib}" ]; then
29+
echo -n " found, processing..."
30+
# 1: /usr/lib/x86_64-linux-gnu/vdpau => ./../lib/x86_64-linux-gnu/vdpau
31+
# 2: /usr/lib/vdpau => ./../lib/vdpau
32+
sed -i \
33+
-e 's,/usr\(/lib/x86_64-linux-gnu/vdpau\),\./\.\.\1,g' \
34+
-e 's,/usr\(/lib/vdpau\),\./\.\.\1,g' \
35+
"${hwlib}"
36+
echo " done."
37+
((processed+=1))
38+
else
39+
echo " NOT found, skipping."
40+
fi
41+
42+
echo -n "Looking for libva.so.1..."
43+
hwlib="${hw_lib_dir}/libva.so.1"
44+
if [ -w "${hwlib}" ]; then
45+
echo -n " found, processing..."
46+
# /usr/lib/x86_64-linux-gnu/dri => ./../lib/x86_64-linux-gnu/dri
47+
sed -i -e 's,/usr\(/lib/x86_64-linux-gnu/dri\),\./\.\.\1,g' "${hwlib}"
48+
echo " done."
49+
((processed+=1))
50+
else
51+
echo " NOT found, skipping."
52+
fi
53+
54+
# Final summary
55+
echo "Files processed: ${processed}" && exit 0
56+

0 commit comments

Comments
 (0)