-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
58 lines (49 loc) · 2.04 KB
/
install.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
#!/bin/bash
# pacman packages
#packages=""
# Change user nobody to match unRAID's settings
usermod -u 99 nobody
usermod -g 100 nobody
usermod -d /home nobody
chown -R nobody:users /home
# update pacman and install any needed packages
#pacman -Sy --noconfirm
#pacman -S --needed --noconfirm $packages
# download and install latest syncthing into /opt
install_location="/opt/syncthing"
latest_release_url=$(curl -k -L https://api.github.com/repos/syncthing/syncthing/releases/latest 2>/dev/null | grep 'browser_download_url.*linux-amd64' | cut -d \" -f4)
if [[ -n ${latest_release_url} ]]; then
echo "Updating Syncthing"
rm -rf ${install_location}
echo "Downloading package from: ${latest_release_url}"
mkdir -p ${install_location} && wget -nv -O - "${latest_release_url}" | tar -xzf - --strip-components=1 -C ${install_location}
else
exit 1
fi
# download and install latest discovery server into /opt
install_location="/opt/discosrv"
latest_release_url=$(curl -k -L https://api.github.com/repos/syncthing/discosrv/releases/latest 2>/dev/null | grep 'browser_download_url.*linux-amd64' | cut -d \" -f4)
if [[ -n ${latest_release_url} ]]; then
echo "Updating Discovery Server"
rm -rf ${install_location}
echo "Downloading package from: ${latest_release_url}"
mkdir -p ${install_location} && wget -nv -O - "${latest_release_url}" | tar -xzf - --strip-components=1 -C ${install_location}
else
exit 1
fi
# download and install latest relay server into /opt
install_location="/opt/relaysrv"
latest_release_url=$(curl -k -L https://api.github.com/repos/syncthing/relaysrv/releases/latest 2>/dev/null | grep 'browser_download_url.*linux-amd64' | cut -d \" -f4)
if [[ -n ${latest_release_url} ]]; then
echo "Updating Relay Server"
rm -rf ${install_location}
echo "Downloading package from: ${latest_release_url}"
mkdir -p ${install_location} && wget -nv -O - "${latest_release_url}" | tar -xzf - --strip-components=1 -C ${install_location}
else
exit 1
fi
# set permissions
chown -R nobody.users /opt/*
# Clean up
yes | pacman -Scc
rm -rf /usr/share/man/*