mirror of
https://github.com/YunoHost-Apps/syncthing_ynh.git
synced 2024-09-03 20:26:23 +02:00
correction de bug
This commit is contained in:
parent
52d96e8278
commit
c95b46258b
1 changed files with 75 additions and 75 deletions
150
scripts/install
150
scripts/install
|
@ -1,75 +1,75 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$1
|
domain=$1
|
||||||
path=$2
|
path=$2
|
||||||
|
|
||||||
# Configurable variables
|
# Configurable variables
|
||||||
syncVersion="0.10.29"
|
syncVersion="0.10.29"
|
||||||
arch=`uname -m`
|
arch=`uname -m`
|
||||||
if [ "$arch" = "x86_64" ] ; then
|
if [ "$arch" = "x86_64" ] ; then
|
||||||
syncArch="amd64"
|
syncArch="amd64"
|
||||||
fi
|
fi
|
||||||
if [ "$arch" = "i386" ] || [ "$arch" == "i686" ] ; then
|
if [ "$arch" = "i386" ] || [ "$arch" == "i686" ] ; then
|
||||||
syncArch="386"
|
syncArch="386"
|
||||||
fi
|
fi
|
||||||
if [ "$arch" = "arm" ] ; then
|
if [ "$arch" = "arm" ] ; then
|
||||||
syncArch="arm"
|
syncArch="arm"
|
||||||
fi
|
fi
|
||||||
syncHome="/home/yunohost.syncthing"
|
syncHome="/home/yunohost.syncthing"
|
||||||
syncUser=debian-syncthing
|
syncUser=debian-syncthing
|
||||||
syncSyncport=22000
|
syncSyncport=22000
|
||||||
syncUIport=8080
|
syncUIport=8080
|
||||||
|
|
||||||
|
|
||||||
sudo yunohost app checkurl $domain$path -a syncthing
|
sudo yunohost app checkurl $domain$path -a syncthing
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove trailing "/" for next commands
|
# Remove trailing "/" for next commands
|
||||||
path=${path%/}
|
path=${path%/}
|
||||||
|
|
||||||
# Check port availability
|
# Check port availability
|
||||||
sudo yunohost app checkport $syncUIport
|
sudo yunohost app checkport $syncUIport
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
sudo yunohost app checkport $syncSyncport
|
sudo yunohost app checkport $syncSyncport
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Open port in firewall
|
# Open port in firewall
|
||||||
sudo yunohost firewall allow TCP $syncSyncport > /dev/null 2>&1
|
sudo yunohost firewall allow TCP $syncSyncport > /dev/null 2>&1
|
||||||
|
|
||||||
# Create $syncUser user to syncthing service
|
# Create $syncUser user to syncthing service
|
||||||
sudo useradd -m -d $syncHome/ -s /bin/false $syncUser
|
sudo useradd -m -d $syncHome/ -s /bin/false $syncUser
|
||||||
|
|
||||||
# Make directories and set rights
|
# Make directories and set rights
|
||||||
sudo mkdir -p $syncHome/{bin,sync}
|
sudo mkdir -p $syncHome/{bin,sync}
|
||||||
sudo chown -R $syncUser:$syncUser $syncHome/
|
sudo chown -R $syncUser:$syncUser $syncHome/
|
||||||
sudo find $syncHome/ -type f | while read LINE; do sudo chmod 640 "$LINE" ; done
|
sudo find $syncHome/ -type f | while read LINE; do sudo chmod 640 "$LINE" ; done
|
||||||
sudo find $syncHome/ -type d | while read LINE; do sudo chmod 750 "$LINE" ; done
|
sudo find $syncHome/ -type d | while read LINE; do sudo chmod 750 "$LINE" ; done
|
||||||
|
|
||||||
# Download and install syncthing binary
|
# Download and install syncthing binary
|
||||||
sudo wget https://github.com/syncthing/syncthing/releases/download/v$syncVersion/syncthing-linux-$syncArch-v$syncVersion.tar.gz -O /tmp/syncthing.tar.gz
|
sudo wget https://github.com/syncthing/syncthing/releases/download/v$syncVersion/syncthing-linux-$syncArch-v$syncVersion.tar.gz -O /tmp/syncthing.tar.gz
|
||||||
sudo tar -C /tmp -xvf /tmp/syncthing.tar.gz syncthing-linux-$syncArch-v$syncVersion/syncthing
|
sudo tar -C /tmp -xvf /tmp/syncthing.tar.gz syncthing-linux-$syncArch-v$syncVersion/syncthing
|
||||||
sudo mv /tmp/syncthing-linux-$syncArch-v$syncVersion/syncthing $syncHome/bin/syncthing
|
sudo mv /tmp/syncthing-linux-$syncArch-v$syncVersion/syncthing $syncHome/bin/syncthing
|
||||||
sudo chown $syncUser: $syncHome/bin/syncthing
|
sudo chown $syncUser: $syncHome/bin/syncthing
|
||||||
sudo chmod 750 $syncHome/bin/syncthing
|
sudo chmod 750 $syncHome/bin/syncthing
|
||||||
|
|
||||||
# Install and monitor service
|
# Install and monitor service
|
||||||
# les deux lignes ci dessous si il s'avère nécessaire de créer un script sysinit
|
# les deux lignes ci dessous si il s'avère nécessaire de créer un script sysinit
|
||||||
# sudo cp ../conf/syncthingd /etc/init.d/syncthingd
|
# sudo cp ../conf/syncthingd /etc/init.d/syncthingd
|
||||||
# sudo update-rc.d syncthingd defaults
|
# sudo update-rc.d syncthingd defaults
|
||||||
sudo apt-get install runit -y -qq
|
sudo apt-get install runit -y -qq
|
||||||
sudo mkdir -p /etc/service/syncthing
|
sudo mkdir -p /etc/service/syncthing
|
||||||
sudo cp -R ../conf/run ../conf/log /etc/service/syncthing
|
sudo cp -R ../conf/run ../conf/log /etc/service/syncthing
|
||||||
sudo yunohost service add runit
|
sudo yunohost service add runit
|
||||||
|
|
||||||
# Configure Nginx and reload
|
# Configure Nginx and reload
|
||||||
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/syncthing.conf
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/syncthing.conf
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
echo $?
|
echo $?
|
||||||
|
|
Loading…
Add table
Reference in a new issue