-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathupdate-nvdaRemoteServer.sh
executable file
·45 lines (45 loc) · 1.3 KB
/
update-nvdaRemoteServer.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
#!/bin/sh
# Example script to upgrade an installed binary.
# This assumes you have tar on your system, installed the binary into /usr/bin, have sudo rights,
# and are using systemd for your daemon manager. This will automatically download the latest release.
# Modify the appropriate variables for your system, and commands, if needed.
binary="nvdaRemoteServer"
os="linux"
arch="amd64"
program="${binary}_${os}_${arch}"
check() {
eval $@
if [ $? -ne 0 ]; then
echo "Command $1 failed to execute."
exit 10
fi
}
echo Checking version.
version=$(check ${binary} version)
echo Current version ${version}
echo Downloading.
check wget -q https://github.com/tech10/nvdaRemoteServer/releases/latest/download/${program}.tar.gz
echo Extracting.
check tar -axf ${program}.tar.gz
echo Checking new version.
new_version=$(check ${program}/${binary} version)
update() {
echo Changing ownership of binary.
check sudo chown root:root ${program}/${binary}
echo Moving binary to /usr/bin
check sudo mv ${program}/${binary} /usr/bin/
echo Restarting server.
check sudo systemctl restart nvdaRemoteServer
}
clean() {
echo Cleaning up files.
check rm -r ${program} ${program}.tar.gz
}
if [ "$version" = "$new_version" ]; then
echo The two versions are identical. Not upgrading.
clean
exit
fi
echo Upgrading from $version to $new_version
update
clean