File: mangle-hw-libs.sh

package info (click to toggle)
openshot-qt 2.6.1%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 130,080 kB
  • sloc: python: 450,926; javascript: 34,734; xml: 3,168; makefile: 219; sh: 150
file content (61 lines) | stat: -rwxr-xr-x 1,444 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh


usage()
{
    progname="$(basename "$0")"
    cat << __EOM__
${progname} - Replace system paths encoded into shared libraries

Usage: ${progname} HW_LIB_DIR
Arguments:
  HW_LIB_DIR	The directory containing libraries to be processed.
            	(Files will be modified IN PLACE, without backups.)
__EOM__
}

# Bail with usage information, if the directory path is unset
[ -z "$1" ] && usage && exit -1

# We take one argument, the path in which to look for target libraries
if [ -d "$1" ]; then
  hw_lib_dir="$1"
else
  usage && exit -1
fi

fix_va_lib()
{
  lname="$1"
  echo -n "Looking for ${lname}..."
  hwlib="${hw_lib_dir}/${lname}"
  if [ -w "${hwlib}" ]; then
    echo -n " found, processing..."
    # /usr/lib/x86_64-linux-gnu/dri => ./../lib/x86_64-linux-gnu/dri
    sed -i -e 's,/usr\(/lib/x86_64-linux-gnu/dri\),\./\.\.\1,g' "${hwlib}"
    echo " done."
  else
    echo " NOT found, skipping."
  fi
}

for libname in "libva.so.1" "libva.so.2"; do
  fix_va_lib $libname;
done

echo -n "Looking for libvdpau.so.1..."
hwlib="${hw_lib_dir}/libvdpau.so.1"
if [ -w "${hwlib}" ]; then
  echo -n " found, processing..."
  # 1: /usr/lib/x86_64-linux-gnu/vdpau => ./../lib/x86_64-linux-gnu/vdpau
  # 2: /usr/lib/vdpau => ./../lib/vdpau
  sed -i \
    -e 's,/usr\(/lib/x86_64-linux-gnu/vdpau\),\./\.\.\1,g' \
    -e 's,/usr\(/lib/vdpau\),\./\.\.\1,g' \
    "${hwlib}"
  echo " done."
else
  echo " NOT found, skipping."
fi

exit 0