-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgenerate-service-file.sh
50 lines (44 loc) · 1.29 KB
/
generate-service-file.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
#!/bin/sh
driver_version=$(grep -i ^version: nvidia-gfxG0?.spec |awk '{print $2}')
for arch in x86_64; do
file=NVIDIA-Linux-${arch}-${driver_version}.run
if [ ! -s ${file} ]; then
echo -n "Dowloading ${file} ... "
curl -s -o $file https://download.nvidia.com/XFree86/Linux-${arch}/${driver_version}/$file
echo "done"
fi
done
for arch in x86_64; do
file=NVIDIA-Linux-${arch}-${driver_version}.run
test -f ${file}
if [ $? -ne 0 ]; then
echo "${file} not available. Download failed? Exiting."
exit 1
else
echo -n "Checking ${file}: "
sh ./${file} --check
if [ $? -ne 0 ]; then
rm ${file}
echo "Check failed. Corrupt {file} removed. Download failed? Exiting."
exit 1
fi
fi
done
which sha256sum &> /dev/null
if [ $? -ne 0 ]; then
echo "sha256sum not available! Exiting."
exit 1
fi
sha256sum_x86_64=$(sha256sum NVIDIA-Linux-x86_64-${driver_version}.run | awk '{print $1}')
echo -n "Creating _service file ..."
cat << EOF > _service
<services>
<service name="download_files" mode="disabled"/>
<service name="verify_file" mode="disabled">
<param name="file">NVIDIA-Linux-x86_64-${driver_version}.run</param>
<param name="verifier">sha256</param>
<param name="checksum">${sha256sum_x86_64}</param>
</service>
</services>
EOF
echo done