1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/syncthing_ynh.git synced 2024-09-03 20:26:23 +02:00

ajout du support de processeur

This commit is contained in:
Lahire BIETTE 2015-03-26 16:51:01 +01:00
parent b77ff2d17d
commit f0d7593d5b

View file

@ -1,65 +1,71 @@
#!/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"
syncHome="/home/yunohost.syncthing" arch=`uname -m`
syncUser=debian-syncthing if [ "$arch" = "x86_64"] ; then
syncSyncport=22000 syncArch="amd64"
syncUIport=8080 elif [ "$arch" = "i686"] ; then
syncArch="386"
fi
sudo yunohost app checkurl $domain$path -a syncthing syncHome="/home/yunohost.syncthing"
if [[ ! $? -eq 0 ]]; then syncUser=debian-syncthing
exit 1 syncSyncport=22000
fi syncUIport=8080
# Remove trailing "/" for next commands
path=${path%/} sudo yunohost app checkurl $domain$path -a syncthing
if [[ ! $? -eq 0 ]]; then
# Check port availability exit 1
sudo yunohost app checkport $syncUIport fi
if [[ ! $? -eq 0 ]]; then
exit 1 # Remove trailing "/" for next commands
fi path=${path%/}
sudo yunohost app checkport $syncSyncport
if [[ ! $? -eq 0 ]]; then # Check port availability
exit 1 sudo yunohost app checkport $syncUIport
fi if [[ ! $? -eq 0 ]]; then
exit 1
# Open port in firewall fi
sudo yunohost firewall allow TCP $syncSyncport > /dev/null 2>&1 sudo yunohost app checkport $syncSyncport
if [[ ! $? -eq 0 ]]; then
# Create $syncUser user to syncthing service exit 1
sudo useradd -m -d $syncHome/ -s /bin/false $syncUser fi
# Make directories and set rights # Open port in firewall
sudo mkdir -p $syncHome/{bin,sync} sudo yunohost firewall allow TCP $syncSyncport > /dev/null 2>&1
sudo chown -R $syncUser:$syncUser $syncHome/
sudo find $syncHome/ -type f | while read LINE; do sudo chmod 640 "$LINE" ; done # Create $syncUser user to syncthing service
sudo find $syncHome/ -type d | while read LINE; do sudo chmod 750 "$LINE" ; done sudo useradd -m -d $syncHome/ -s /bin/false $syncUser
# Download and install syncthing binary # Make directories and set rights
sudo wget https://github.com/syncthing/syncthing/releases/download/v$syncVersion/syncthing-linux-amd64-v$syncVersion.tar.gz -O /tmp/syncthing.tar.gz sudo mkdir -p $syncHome/{bin,sync}
sudo tar -C /tmp -xvf /tmp/syncthing.tar.gz syncthing-linux-amd64-v$syncVersion/syncthing sudo chown -R $syncUser:$syncUser $syncHome/
sudo mv /tmp/syncthing-linux-amd64-v$syncVersion/syncthing $syncHome/bin/syncthing sudo find $syncHome/ -type f | while read LINE; do sudo chmod 640 "$LINE" ; done
sudo chown $syncUser: $syncHome/bin/syncthing sudo find $syncHome/ -type d | while read LINE; do sudo chmod 750 "$LINE" ; done
sudo chmod 640 $syncHome/bin/syncthing
# Download and install syncthing binary
# Install and monitor service sudo wget https://github.com/syncthing/syncthing/releases/download/v$syncVersion/syncthing-linux-$syncArch-v$syncVersion.tar.gz -O /tmp/syncthing.tar.gz
# les deux lignes ci dessous si il s'avère nécessaire de créer un script sysinit sudo tar -C /tmp -xvf /tmp/syncthing.tar.gz syncthing-linux-$syncArch-v$syncVersion/syncthing
# sudo cp ../conf/syncthingd /etc/init.d/syncthingd sudo mv /tmp/syncthing-linux-$syncArch-v$syncVersion/syncthing $syncHome/bin/syncthing
# sudo update-rc.d syncthingd defaults sudo chown $syncUser: $syncHome/bin/syncthing
sudo apt-get install runit -y -qq sudo chmod 640 $syncHome/bin/syncthing
sudo mkdir -p /etc/service/syncthing
sudo cp -R ../conf/run ../conf/log /etc/service/syncthing # Install and monitor service
sudo yunohost service add runit # 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
# Configure Nginx and reload # sudo update-rc.d syncthingd defaults
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf sudo apt-get install runit -y -qq
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/syncthing.conf sudo mkdir -p /etc/service/syncthing
sudo service nginx reload sudo cp -R ../conf/run ../conf/log /etc/service/syncthing
echo $? sudo yunohost service add runit
# Configure Nginx and reload
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/syncthing.conf
sudo service nginx reload
echo $?