-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathnvidia-generate-tarballs.sh
executable file
·107 lines (80 loc) · 2.64 KB
/
nvidia-generate-tarballs.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/sh
set -e
set_vars() {
export VERSION=${VERSION:-565.77}
export DL_SITE=${DL_SITE:-http://download.nvidia.com/XFree86}
export TEMP_UNPACK=${ARCH}
export PLATFORM=Linux-${ARCH}
export RUN_FILE=NVIDIA-${PLATFORM}-${VERSION}.run
}
run_file_get() {
printf "Downloading installer ${RUN_FILE}... "
[[ -f $RUN_FILE ]] || wget -c -q ${DL_SITE}/${PLATFORM}/${VERSION}/$RUN_FILE
printf "OK\n"
}
run_file_extract() {
rm -fr ${TEMP_UNPACK}
sh ${RUN_FILE} --extract-only --target ${TEMP_UNPACK}
}
cleanup_folder() {
printf "Cleaning up binaries... "
cd ${TEMP_UNPACK}
# Stuff not needed for packages:
# - Compiled from source
# - Interactive installer files
# - GLVND GL libraries
# - Internal development only libraries
rm -fr \
nvidia-xconfig* \
nvidia-persistenced* \
nvidia-modprobe* \
libnvidia-gtk* libnvidia-wayland-client* nvidia-settings* \
libGLESv1_CM.so.* libGLESv2.so.* libGLdispatch.so.* libOpenGL.so.* libGLX.so.* libGL.so.1* libEGL.so.1* \
libnvidia-egl-wayland.so.* libnvidia-egl-gbm.so.* libnvidia-egl-xcb.so.* libnvidia-egl-xlib.so.* \
libOpenCL.so.1* \
libEGL.so.${VERSION} \
nvidia-installer* .manifest make* mk* tls_test* libglvnd_install_checker
if [ "${ARCH}" == x86_64 ]; then
rm -fr \
32/libGLESv1_CM.so.* 32/libGLESv2.so.* 32/libGLdispatch.so.* 32/libOpenGL.so.* 32/libGLX.so.* 32/libGL.so.1* 32/libEGL.so.1* \
32/libOpenCL.so.1* \
32/libGL.so.${VERSION} 32/libEGL.so.${VERSION} \
32/libnvidia-egl-wayland.so.* 32/libnvidia-egl-gbm.so.* 32/libnvidia-egl-xcb.so.* 32/libnvidia-egl-xlib.so.*
cp -f *.json* 32/
fi
cd ..
printf "OK\n"
}
create_tarball() {
KMOD=nvidia-kmod-${VERSION}-${ARCH}
KMOD_COMMON=nvidia-kmod-common-${VERSION}
USR_64=nvidia-driver-${VERSION}-${ARCH}
mkdir ${KMOD} ${KMOD_COMMON} ${USR_64}
mv ${TEMP_UNPACK}/kernel* ${KMOD}/
mv ${TEMP_UNPACK}/firmware ${KMOD_COMMON}/
if [ "$ARCH" == x86_64 ]; then
USR_32=nvidia-driver-${VERSION}-i386
mkdir ${USR_32}
mv ${TEMP_UNPACK}/32/* ${USR_32}/
rm -fr ${TEMP_UNPACK}/32
fi
mv ${TEMP_UNPACK}/* ${USR_64}/
rm -fr ${TEMP_UNPACK}
for tarball in ${KMOD} ${KMOD_COMMON} ${USR_64} ${USR_32}; do
printf "Creating tarball $tarball... "
XZ_OPT='-T0' tar --remove-files -cJf $tarball.tar.xz $tarball
printf "OK\n"
done
}
ARCH=aarch64
set_vars
run_file_get
run_file_extract
cleanup_folder
create_tarball
ARCH=x86_64
set_vars
run_file_get
run_file_extract
cleanup_folder
create_tarball