Skip to content

Commit 73fc79f

Browse files
Check sha256sum of tigervnc and make download script generic
1 parent f837ed8 commit 73fc79f

6 files changed

+82
-61
lines changed

build_release_linux.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ rm -rf out
2020
# Don't include Windows VNC binaries on Linux
2121
rm -rf vnc-software/uvnc-windows
2222
if [ ! -d "vnc-software/tigervnc-linux-x86_64" ]; then
23-
echo "vnc-software/tigervnc-linux-x86_64 not found, running vnc-software/download_tigervnc.sh"
24-
./vnc-software/download_tigervnc.sh
23+
echo "vnc-software/tigervnc-linux-x86_64 not found, running vnc-software/download_generic.sh"
24+
./vnc-software/download_generic.sh "tigervnc-latest-stable.tar.gz" "tigervnc-linux-x86_64" "https://netix.dl.sourceforge.net/project/tigervnc/stable/1.13.1/tigervnc-1.13.1.x86_64.tar.gz" "d643316760fb34cb610b843b8af75e19f16eae34acf8e55cae088c4f7adf083f" "tigervnc.conf" "tigervnc-linux-x86_64/usr/bin/plain.bin"
25+
downloadresult=$?
26+
if [ $downloadresult -ne 0 ]; then
27+
echo "Download of VNC client returned error: $downloadresult"
28+
exit 1
29+
fi
2530
fi
2631

2732

build_release_windows.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ rm -rf out
2323
# dont include linux binaries in Windows build
2424
rm -rf vnc-software/tigervnc-linux-x86_64
2525
if [ ! -d "vnc-software/uvnc-windows" ]; then
26-
echo "vnc-software/uvnc-windows not found, running vnc-software/download_uvnc.sh"
27-
./vnc-software/download_uvnc.sh
26+
echo "vnc-software/uvnc-windows not found, running vnc-software/download_generic.sh"
27+
./vnc-software/download_generic.sh "uvnc-windows.zip" "uvnc-windows" "https://uvnc.com/component/jdownloads/send/0-/470-ultravnc-1-4-6-zip.html" "3afe90cf4f287ff066649225223d9950221ddfd273e5f4805c2f6fde39a5df83" "ultravnc.conf" "uvnc-windows/x64/UltraVNC.ini"
2828
fi
2929

3030
# first make sure the correct files are packaged with electron-forge:

vnc-software/download_generic.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/sh -x
2+
# This script needs: readlink, dirname, curl, sha256sum, unzip, tar
3+
4+
outfile="$1"
5+
outdir="$2"
6+
downloadlink="$3"
7+
shasum="$4"
8+
configfilesrc="$5"
9+
configfiledst="$6"
10+
11+
if [ $# -ne 6 ]; then
12+
echo "Usage: $0 outfile outdir downloadlink sha256sum configfilesrc configfiledst"
13+
exit 1
14+
fi
15+
16+
# Execute with containing directory as current working directory
17+
mydir=$(readlink -f "$0")
18+
mydir=$(dirname "$mydir")
19+
cd "$mydir"
20+
21+
22+
curl "$downloadlink" > "$outfile"
23+
result=$?
24+
25+
if [ $result -eq 0 ]; then
26+
echo "Download successful, checking checksum and extracting..."
27+
# make sure outdir is gone so it will be replaced entierly
28+
rm -rf "$outdir"
29+
30+
echo "$shasum $outfile" | sha256sum -c -
31+
sharesult=$?
32+
if [ "$sharesult" -eq 0 ]; then
33+
if echo "$outfile" | grep "\.zip"; then
34+
if unzip -d "$outdir" "$outfile"; then
35+
echo "SUCCESS!"
36+
else
37+
echo "ERROR: unzip failed!"
38+
exit 3
39+
fi
40+
else # assume it's a tar
41+
if tar xf "$outfile"; then
42+
mv tigervnc-1.13.1.x86_64 tigervnc-linux-x86_64
43+
echo "SUCCESS!"
44+
else
45+
echo "ERROR: tar extract failed!"
46+
exit 4
47+
fi
48+
fi
49+
configfiledstdir=$(dirname "$configfiledst")
50+
if [ -f "$configfilesrc" -a -d "$configfiledstdir" ]; then
51+
cat "$configfilesrc" | sed -e 's/\r*$/\r/' > "$configfiledst"
52+
else
53+
echo "ERROR: could not write config file because $configfilesrc is not a file or $configfiledstdir is not a directory!"
54+
exit 5
55+
fi
56+
else
57+
echo "ERROR: sha256sum of $outfile did not match!"
58+
exit 2
59+
fi
60+
61+
# cleanup if download was successful
62+
rm "$outfile"
63+
else
64+
echo "ERROR: download of $downloadlink returned exit code: $result"
65+
cd - # Go back to original directory
66+
exit 1
67+
fi
68+
69+
70+
cd - # Go back to original directory

vnc-software/download_tigervnc.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

vnc-software/tigervnc.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3~T�M;

vnc-software/download_uvnc.sh renamed to vnc-software/ultravnc.conf

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,4 @@
1-
#!/bin/sh
2-
# This script needs: readlink, dirname, curl, sha256sum, unzip
3-
4-
# Execute with containing directory as current working directory
5-
mydir=$(readlink -f "$0")
6-
mydir=$(dirname "$mydir")
7-
cd "$mydir"
8-
9-
# Download link obtained from https://uvnc.com/component/jdownloads/summary/470-ultravnc-1-4-6-zip.html
10-
outfile=uvnc-windows.zip
11-
outdir=uvnc-windows
12-
downloadlink="https://uvnc.com/component/jdownloads/send/0-/470-ultravnc-1-4-6-zip.html"
13-
sha256sum=3afe90cf4f287ff066649225223d9950221ddfd273e5f4805c2f6fde39a5df83
14-
15-
curl "$downloadlink" > "$outfile"
16-
result=$?
17-
18-
if [ $result -eq 0 ]; then
19-
echo "Download successful, checking checksum and extracting..."
20-
rm -rf "$outdir"
21-
22-
echo "$sha256sum $outfile" | sha256sum -c - && \
23-
unzip -d "$outdir" "$outfile" && \
24-
rm "$outfile"
25-
26-
else
27-
echo "ERROR: download of $downloadlink returned exit code: $result"
28-
cd - # Go back to original directory
29-
exit 1
30-
fi
31-
32-
echo "[Permissions]
1+
[Permissions]
332
[admin]
343
FileTransferEnabled=1
354
FTUserImpersonation=1
@@ -113,6 +82,4 @@ group2=Administrators
11382
group3=VNCVIEWONLY
11483
locdom1=0
11584
locdom2=0
116-
locdom3=0" | sed -e 's/\r*$/\r/' > uvnc-windows/x64/UltraVNC.ini
117-
118-
cd - # Go back to original directory
85+
locdom3=0

0 commit comments

Comments
 (0)