Skip to content

Commit 75135a5

Browse files
authored
Add syncthing
fix #2122
1 parent 03f7cdd commit 75135a5

File tree

4 files changed

+166
-0
lines changed

4 files changed

+166
-0
lines changed

programs/aarch64-apps

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
◆ syncthing : Open Source Continuous File Synchronization.
12
◆ 12to11 : Unofficial, tool for running Wayland applications on an X server.
23
◆ 86box : Emulator of x86-based machines based on PCem.
34
◆ aerofoil : Unofficial, multiplatform port of Glider PRO.

programs/aarch64/syncthing

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/bin/sh
2+
3+
# AM INSTALL SCRIPT VERSION 3.5
4+
set -u
5+
APP=syncthing
6+
SITE="syncthing/syncthing"
7+
8+
# CREATE DIRECTORIES AND ADD REMOVER
9+
[ -n "$APP" ] && mkdir -p "/opt/$APP/tmp" "/opt/$APP/icons" && cd "/opt/$APP/tmp" || exit 1
10+
printf "#!/bin/sh\nset -e\nrm -f /usr/local/bin/$APP\nrm -R -f /opt/$APP" > ../remove
11+
printf '\n%s' "rm -f /usr/local/share/applications/$APP-*-AM.desktop" >> ../remove
12+
chmod a+x ../remove || exit 1
13+
14+
# DOWNLOAD AND PREPARE THE APP, $version is also used for updates
15+
version=$(curl -Ls https://api.github.com/repos/syncthing/syncthing/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*" | grep -i "aarch64\|arm64" | grep -vi "alpha\|beta\|rc\|candidate\|backup\|devel" | grep -i "download.*linux" | head -1)
16+
wget "$version" || exit 1
17+
[ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z
18+
[ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.*
19+
[ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip
20+
cd ..
21+
if [ -d ./tmp/* 2>/dev/null ]; then mv ./tmp/*/* ./; else mv ./tmp/* ./"$APP" 2>/dev/null || mv ./tmp/* ./; fi
22+
rm -R -f ./tmp || exit 1
23+
echo "$version" > ./version
24+
chmod a+x ./$APP || exit 1
25+
26+
# LINK TO PATH
27+
ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP"
28+
29+
# SCRIPT TO UPDATE THE PROGRAM
30+
cat >> ./AM-updater << 'EOF'
31+
#!/bin/sh
32+
set -u
33+
APP=syncthing
34+
SITE="syncthing/syncthing"
35+
version0=$(cat "/opt/$APP/version")
36+
version=$(curl -Ls https://api.github.com/repos/syncthing/syncthing/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*" | grep -i "aarch64\|arm64" | grep -vi "alpha\|beta\|rc\|candidate\|backup\|devel" | grep -i "download.*linux" | head -1)
37+
[ -n "$version" ] || { echo "Error getting link"; exit 1; }
38+
if [ "$version" != "$version0" ]; then
39+
mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1
40+
notify-send "A new version of $APP is available, please wait"
41+
wget "$version" || exit 1
42+
[ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z
43+
[ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.*
44+
[ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip
45+
cd ..
46+
if [ -d ./tmp/* 2>/dev/null ]; then mv --backup=t ./tmp/*/* ./; else mv --backup=t ./tmp/* ./"$APP" 2>/dev/null || mv --backup=t ./tmp/* ./; fi
47+
chmod a+x ./"$APP" || exit 1
48+
echo "$version" > ./version
49+
rm -R -f ./tmp ./*~
50+
notify-send "$APP is updated!"
51+
else
52+
echo "Update not needed!"
53+
fi
54+
EOF
55+
chmod a+x ./AM-updater || exit 1
56+
57+
# ICON
58+
mkdir -p icons
59+
wget https://portable-linux-apps.github.io/icons/syncthing.png -O ./icons/"$APP" 2> /dev/null
60+
61+
# LAUNCHER
62+
echo "[Desktop Entry]
63+
Name=Syncthing Web UI
64+
GenericName=File synchronization UI
65+
Comment=Opens Syncthing's Web UI in the default browser (Syncthing must already be started).
66+
Exec=$APP browser
67+
Icon=/opt/$APP/icons/$APP
68+
Terminal=false
69+
Type=Application
70+
Keywords=synchronization;interface;
71+
Categories=Network;FileTransfer;P2P;" > /usr/local/share/applications/"$APP"-UI-AM.desktop
72+
73+
echo "[Desktop Entry]
74+
Name=Start Syncthing
75+
GenericName=File synchronization
76+
Comment=Starts the main syncthing process in the background.
77+
Exec=$APP serve --no-browser --logfile=default
78+
Icon=/opt/$APP/icons/$APP
79+
Terminal=false
80+
Type=Application
81+
Keywords=synchronization;daemon;
82+
Categories=Network;FileTransfer;P2P" > /usr/local/share/applications/"$APP"-start-AM.desktop

programs/x86_64-apps

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
◆ syncthing : Open Source Continuous File Synchronization.
12
◆ 0ad : FOSS historical Real Time Strategy, RTS game of ancient warfare.
23
◆ 0ad-prerelease : FOSS historical Real Time Strategy, RTS game of ancient warfare (Pre-release).
34
◆ 12to11 : Unofficial, tool for running Wayland applications on an X server.

programs/x86_64/syncthing

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/bin/sh
2+
3+
# AM INSTALL SCRIPT VERSION 3.5
4+
set -u
5+
APP=syncthing
6+
SITE="syncthing/syncthing"
7+
8+
# CREATE DIRECTORIES AND ADD REMOVER
9+
[ -n "$APP" ] && mkdir -p "/opt/$APP/tmp" "/opt/$APP/icons" && cd "/opt/$APP/tmp" || exit 1
10+
printf "#!/bin/sh\nset -e\nrm -f /usr/local/bin/$APP\nrm -R -f /opt/$APP" > ../remove
11+
printf '\n%s' "rm -f /usr/local/share/applications/$APP-*-AM.desktop" >> ../remove
12+
chmod a+x ../remove || exit 1
13+
14+
# DOWNLOAD AND PREPARE THE APP, $version is also used for updates
15+
version=$(curl -Ls https://api.github.com/repos/syncthing/syncthing/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*" | grep -i "amd64\|x64\|x86_64" | grep -vi "alpha\|beta\|rc\|candidate\|backup\|devel" | grep -i "download.*linux" | head -1)
16+
wget "$version" || exit 1
17+
[ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z
18+
[ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.*
19+
[ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip
20+
cd ..
21+
if [ -d ./tmp/* 2>/dev/null ]; then mv ./tmp/*/* ./; else mv ./tmp/* ./"$APP" 2>/dev/null || mv ./tmp/* ./; fi
22+
rm -R -f ./tmp || exit 1
23+
echo "$version" > ./version
24+
chmod a+x ./$APP || exit 1
25+
26+
# LINK TO PATH
27+
ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP"
28+
29+
# SCRIPT TO UPDATE THE PROGRAM
30+
cat >> ./AM-updater << 'EOF'
31+
#!/bin/sh
32+
set -u
33+
APP=syncthing
34+
SITE="syncthing/syncthing"
35+
version0=$(cat "/opt/$APP/version")
36+
version=$(curl -Ls https://api.github.com/repos/syncthing/syncthing/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*" | grep -i "amd64\|x64\|x86_64" | grep -vi "alpha\|beta\|rc\|candidate\|backup\|devel" | grep -i "download.*linux" | head -1)
37+
[ -n "$version" ] || { echo "Error getting link"; exit 1; }
38+
if [ "$version" != "$version0" ]; then
39+
mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1
40+
notify-send "A new version of $APP is available, please wait"
41+
wget "$version" || exit 1
42+
[ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z
43+
[ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.*
44+
[ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip
45+
cd ..
46+
if [ -d ./tmp/* 2>/dev/null ]; then mv --backup=t ./tmp/*/* ./; else mv --backup=t ./tmp/* ./"$APP" 2>/dev/null || mv --backup=t ./tmp/* ./; fi
47+
chmod a+x ./"$APP" || exit 1
48+
echo "$version" > ./version
49+
rm -R -f ./tmp ./*~
50+
notify-send "$APP is updated!"
51+
else
52+
echo "Update not needed!"
53+
fi
54+
EOF
55+
chmod a+x ./AM-updater || exit 1
56+
57+
# ICON
58+
mkdir -p icons
59+
wget https://portable-linux-apps.github.io/icons/syncthing.png -O ./icons/"$APP" 2> /dev/null
60+
61+
# LAUNCHER
62+
echo "[Desktop Entry]
63+
Name=Syncthing Web UI
64+
GenericName=File synchronization UI
65+
Comment=Opens Syncthing's Web UI in the default browser (Syncthing must already be started).
66+
Exec=$APP browser
67+
Icon=/opt/$APP/icons/$APP
68+
Terminal=false
69+
Type=Application
70+
Keywords=synchronization;interface;
71+
Categories=Network;FileTransfer;P2P;" > /usr/local/share/applications/"$APP"-UI-AM.desktop
72+
73+
echo "[Desktop Entry]
74+
Name=Start Syncthing
75+
GenericName=File synchronization
76+
Comment=Starts the main syncthing process in the background.
77+
Exec=$APP serve --no-browser --logfile=default
78+
Icon=/opt/$APP/icons/$APP
79+
Terminal=false
80+
Type=Application
81+
Keywords=synchronization;daemon;
82+
Categories=Network;FileTransfer;P2P" > /usr/local/share/applications/"$APP"-start-AM.desktop

0 commit comments

Comments
 (0)