Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Config
Commits
a3c57c4b
Commit
a3c57c4b
authored
May 02, 2018
by
Igor Pecovnik
Browse files
syncthing RFC and various fixes
parent
2c7fc036
Changes
1
Hide whitespace changes
Inline
Side-by-side
debian-software
View file @
a3c57c4b
...
...
@@ -82,7 +82,7 @@ function check_status
#
dialog
--
backtitle
"
$BACKTITLE
"
--
title
"Please wait"
--
infobox
"
\n
Loading install info ... "
5
28
LIST
=
()
LIST_CONST
=
5
LIST_CONST
=
3
# Samba
SAMBA_STATUS
=
"$(check_if_installed samba && echo "
on
" || echo "
off
" )"
LIST
+=
(
"Samba"
"Windows compatible file sharing"
"
$SAMBA_STATUS
"
)
...
...
@@ -95,7 +95,7 @@ if [[ "$family" == "Ubuntu" ]]; then
LIST
+=
(
"TV headend"
"TV streaming / proxy"
"
$TVHEADEND_STATUS
"
)
fi
# synthing
SYNCTHING_STATUS
=
"$(
check_if_installed
syncthing && echo "
on
" || echo "
off
" )"
SYNCTHING_STATUS
=
"$(
[[ -d /usr/bin/
syncthing
]]
&& echo "
on
" || echo "
off
" )"
LIST
+=
(
"Syncthing"
"Personal cloud @syncthing.net"
"
$SYNCTHING_STATUS
"
)
# Exagear
if
[[
"$(check_if_installed xserver-xorg && echo "
on
")"
==
"on"
&&
"
$family
"
==
"Ubuntu"
]];
then
...
...
@@ -103,7 +103,7 @@ if [[ "$(check_if_installed xserver-xorg && echo "on")" == "on" && "$family" ==
LIST
+=
(
"ExaGear"
"32bit x86 Linux/Windows emulator trial"
"
$EXAGEAR_STATUS
"
)
fi
if
[[
"$(dpkg --print-architecture)"
==
"armhf"
||
"$(dpkg --print-architecture)"
==
"amd64"
]];
then
LIST_CONST
=
4
LIST_CONST
=
2
# vpn server
VPN_SERVER_STATUS
=
"$([[ -d /usr/local/vpnserver ]] && echo "
on
" || echo "
off
" )"
LIST
+=
(
"VPN server"
"Softether VPN server"
"
$VPN_SERVER_STATUS
"
)
...
...
@@ -113,7 +113,7 @@ if [[ "$(dpkg --print-architecture)" == "armhf" || "$(dpkg --print-architecture)
fi
# OMV
OMV_STATUS
=
"$(check_if_installed openmediavault && echo "
on
" || echo "
off
" )"
[[
"
$family
"
!=
"Ubuntu"
]]
&&
LIST
+=
(
"OMV"
"OpenMediaVault NAS solution"
"
$OMV_STATUS
"
)
&&
LIST_CONST
=
5
[[
"
$family
"
!=
"Ubuntu"
]]
&&
LIST
+=
(
"OMV"
"OpenMediaVault NAS solution"
"
$OMV_STATUS
"
)
&&
LIST_CONST
=
3
# Plex
PLEX_STATUS
=
"$((check_if_installed plexmediaserver || check_if_installed plexmediaserver-installer) && echo "
on
" || echo "
off
" )"
LIST
+=
(
"Plex"
"Plex media server"
"
$PLEX_STATUS
"
)
...
...
@@ -583,8 +583,9 @@ install_urbackup ()
#
# Client/server backup system https://www.urbackup.org/
#
if [ "$(dpkg --print-architecture | grep arm64)" == "arm64" ]; then local arch=armhf; else local arch=$(dpkg --print-architecture); fi
PREFIX="http://hndl.urbackup.org/Server/latest/"
URL="http://hndl.urbackup.org/Server/latest/"$(wget -q $PREFIX -O - | html2text -width 120 | grep deb | awk ' { print $3 }' | grep $
(dpkg --print-architecture)
)
URL="http://hndl.urbackup.org/Server/latest/"$(wget -q $PREFIX -O - | html2text -width 120 | grep deb | awk ' { print $3 }' | grep $
arch
)
fancy_wget "$URL" "-O ${TEMP_DIR}/package.deb"
dpkg -i ${TEMP_DIR}/package.deb >/dev/null 2>
&
1
apt-get -yy -f install
...
...
@@ -673,55 +674,39 @@ install_syncthing ()
#
Install
Personal
cloud
https:
//
syncthing.net
/
#
add_choose_user
curl
-s
https:
//
syncthing.net
/
release-key.txt
|
apt-key
add
-
>
/dev/null 2>
&
1
if !(grep -qs syncthing "/etc/apt/sources.list.d/syncthing.list");then
echo "deb http://apt.syncthing.net/ syncthing release" | tee /etc/apt/sources.list.d/syncthing.list
if
[
"$(
dpkg
--print-architecture
|
grep
armhf
)"
==
"
armhf
"
];
then
local
filename=
"linux-arm"
elif
[
"$(
dpkg
--print-architecture
|
grep
arm64
)"
==
"
arm64
"
];
then
local
filename=
"linux-arm64"
else
local
filename=
"linux-amd64"
fi
debconf-apt-progress -- apt-get update
install_packet "syncthing syncthing-inotify" "Install Personal cloud https://syncthing.net/"
cat
<
<
EOT
>
/etc/systemd/system/syncthing.service
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
After=network.target
[Service]
ExecStart=/usr/bin/syncthing -no-browser -no-restart -logfile=/var/log/syncthing.log -logflags=3
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
User=$CHOSEN_USER
mkdir
-p
/
usr
/
bin
/
syncthing
wgeturl=
$(curl
-s
"
https:
//
api.github.com
/
repos
/
syncthing
/
syncthing
/
releases
"
|
grep
$
filename
|
grep
'
browser_download_url
'
|
head
-1
|
cut
-d
\"
-f
4)
fancy_wget
"$
wgeturl
"
"
-O
${
TEMP_DIR
}/
syncthing.tgz
"
wgeturl=
$(curl
-s
"
https:
//
api.github.com
/
repos
/
syncthing
/
syncthing-inotify
/
releases
"
|
grep
$
filename
|
grep
'
browser_download_url
'
|
head
-1
|
cut
-d
\"
-f
4)
fancy_wget
"$
wgeturl
"
"
-O
${
TEMP_DIR
}/
syncthing-inotify.tgz
"
tar
xf
${
TEMP_DIR
}/
syncthing.tgz
-C
${
TEMP_DIR
}
tar
xf
${
TEMP_DIR
}/
syncthing-inotify.tgz
-C
/
usr
/
bin
/
syncthing
cp
-R
${
TEMP_DIR
}/
syncthing-*
/
syncthing
/
usr
/
bin
/
syncthing
/
cp
${
TEMP_DIR
}/
syncthing-*
/
etc
/
linux-systemd
/
system
/
syncthing*
/
etc
/
systemd
/
system
/
cp
/
etc
/
systemd
/
system
/
syncthing
@.
service
/
etc
/
systemd
/
system
/
syncthing-inotify
@.
service
#
adjust
service
for
inotify
sed
-i
"
s
/^
Description=
.*/Description=Syncthing
Inotify
File
Watcher
/"
/
etc
/
systemd
/
system
/
syncthing-inotify
@.
service
sed
-i
"
s
/^
After=
.*/After=network.target
syncthing.service
/"
/
etc
/
systemd
/
system
/
syncthing-inotify
@.
service
sed
-i
"
s
/^
ExecStart=
.*/ExecStart=\/usr\/bin\/syncthing-inotify
-logfile=
\/var\/log\/syncthing-inotify.log
-logflags=
3/"
/
etc
/
systemd
/
system
/
syncthing-inotify
@.
service
sed
-i
"/^\[
Install
\]/
a
Requires=
syncthing.service"
/
etc
/
systemd
/
system
/
syncthing-inotify
@.
service
[Install]
WantedBy=default.target
EOT
cat
<
<
EOT
>
/etc/systemd/system/syncthing-inotify.service
[Unit]
Description=Syncthing Inotify File Watcher
After=network.target syncthing.service
Requires=syncthing.service
[Service]
User=$CHOSEN_USER
ExecStart=/usr/bin/syncthing-inotify -logfile=/var/log/syncthing-inotify.log -logflags=3
SuccessExitStatus=2
RestartForceExitStatus=3
Restart=on-failure
ProtectSystem=full
ProtectHome=read-only
[Install]
WantedBy=multi-user.target
EOT
#
increase
open
file
limit
if
!(
grep
-qs
"
fs.inotify.max_user_watches=
204800"
"/
etc
/
sysctl.conf
");
then
echo
-e
"
fs.inotify.max_user_watches=
204800"
|
tee
-a
/
etc
/
sysctl.conf
fi
systemctl enable syncthing
systemctl start syncthing
systemctl enable syncthing-inotify
systemctl start syncthing-inotify
add_choose_user
systemctl
enable
syncthing
@${
CHOSEN_USER
}.
service
systemctl
start
syncthing
@${
CHOSEN_USER
}.
service
systemctl
enable
syncthing-inotify
@${
CHOSEN_USER
}.
service
systemctl
start
syncthing-inotify
@${
CHOSEN_USER
}.
service
}
...
...
@@ -1363,6 +1348,8 @@ mysql_pass=""
BACKTITLE="Softy - Armbian post deployment scripts, http://www.armbian.com"
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"
&&
pwd )"
#check_status
# main dialog routine
#
DIALOG_CANCEL=1
...
...
@@ -1372,11 +1359,10 @@ while true; do
# prepare menu items
check_status
LISTLENGHT="$(($LIST_CONST+${#LIST[@]}/2))"
LISTLENGHT="$((${#LIST[@]}/2))"
exec 3>
&
1
selection=$(dialog --backtitle "$BACKTITLE" --title "Installing to $family $distribution" --clear --cancel-label \
"Exit" --checklist "\nChoose what you want to install:\n " $LISTLENGHT 70 15 "${LIST[@]}" 2>
&
1 1>
&
3)
"Exit" --checklist "\nChoose what you want to install:\n "
$((
$LISTLENGHT
+$LIST_CONST))
70 15 "${LIST[@]}" 2>
&
1 1>
&
3)
exit_status=$?
exec 3>
&
-
case $exit_status in
...
...
@@ -1480,8 +1466,8 @@ while true; do
if [[ "$selection" == *Transmission*
&&
"$TRANSMISSION_STATUS" != "on" ]]; then
install_transmission
check_port 9091 transmission
dialog --title "Seed Armbian torrents" --backtitle "$BACKTITLE" --yes-label "Yes" --no-label "Cancel" --yesno "\n
Do you want to help
\
community and seed armbian torrent files? It will ensure faster download for everyone. We need around 50Gb of your space." 10 44
dialog --title "Seed Armbian torrents" --backtitle "$BACKTITLE" --yes-label "Yes" --no-label "Cancel" --yesno "\n\
Do you want to help
community and seed armbian torrent files? It will ensure faster download for everyone. We need around 50Gb of your space." 10 44
if [[ $? = 0 ]]; then
install_transmission_seed_armbian_torrents
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment