-
Notifications
You must be signed in to change notification settings - Fork 6
/
bootstrap.sh
executable file
·70 lines (60 loc) · 1.5 KB
/
bootstrap.sh
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
62
63
64
65
66
67
68
69
70
#!/bin/bash
echo "$(date): Copying the NVidia drivers from the host."
NV_LIBS=" \
libnvidia-ml.so \
libcuda.so \
libnvidia-ptxjitcompiler.so \
libnvidia-fatbinaryloader.so \
libnvidia-opencl.so \
libnvidia-compiler.so \
libnvidia-cfg.so \
libvdpau.so \
libvdpau_trace.so \
libvdpau_nvidia.so \
libnvidia-encode.so \
libnvcuvid.so \
libnvidia-fbc.so \
libnvidia-ifr.so \
libnvidia-wfb.so \
libwfb.so \
libGL.so \
libGLX.so \
libglx.so \
libOpenGL.so \
libOpenCL.so \
libGLESv1_CM.so \
libGLESv2.so \
libEGL.so \
libGLdispatch.so \
libGLX_nvidia.so \
libEGL_nvidia.so \
libGLESv2_nvidia.so \
libGLESv1_CM_nvidia.so \
libnvidia-eglcore.so \
libnvidia-egl-wayland.so \
libnvidia-glcore.so \
libnvidia-tls.so \
libnvidia-glsi.so \
nvidia_drv.so"
new_library_paths=""
prefix=usr
librarylist=$(mktemp)
trap "rm ${librarylist}" EXIT
find /host${prefix} > ${librarylist}
for filename in $NV_LIBS; do
while read path; do
newpath="/${prefix}${path#/host${prefix}}"
if [ -f $path ]; then
mkdir -p `dirname $newpath` && \
cp -a $path $newpath
if [[ $newpath == */lib/* || $newpath == */lib32/* || \
$newpath == */lib64/* ]]; then
libpath=$(dirname $newpath)
new_library_paths="${libpath} ${new_library_paths}"
fi
fi
done < <(grep "${filename}*" ${librarylist})
done
echo "$(date): Reconfiguring ldcache."
echo "${new_library_paths}" | tr ' ' '\n' | sort -u > /etc/ld.so.conf.d/nvidia.conf
ldconfig