2015-08-11 12:26:57 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Retrieve arguments
|
|
|
|
path=$(sudo yunohost app setting movim path)
|
2015-08-19 14:08:24 +02:00
|
|
|
domain=$(sudo yunohost app setting movim domain)
|
|
|
|
port=$(sudo yunohost app setting movim port)
|
2015-08-11 12:26:57 +02:00
|
|
|
|
|
|
|
# Install Movim files
|
|
|
|
final_path=/var/www/movim
|
|
|
|
sudo cp -a ../sources/* $final_path
|
2015-08-19 11:25:29 +02:00
|
|
|
#sudo chown -R www-data: $final_path
|
2015-08-11 12:26:57 +02:00
|
|
|
|
2015-08-19 11:25:29 +02:00
|
|
|
# Create movim user if not exists and set permissions
|
|
|
|
if grep -q movim /etc/passwd; then
|
2015-08-19 11:30:54 +02:00
|
|
|
sudo chown -R movim:www-data $final_path
|
2015-08-19 14:11:09 +02:00
|
|
|
sudo chmod -R 770 $final_path
|
2015-08-19 11:25:29 +02:00
|
|
|
else
|
2015-08-19 11:30:54 +02:00
|
|
|
sudo useradd -s /bin/sh -d $final_path movim
|
|
|
|
sudo chown -R movim:www-data $final_path
|
2015-08-19 14:11:09 +02:00
|
|
|
sudo chmod -R 770 $final_path
|
2015-08-19 11:25:29 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Update PHP dependencies
|
|
|
|
sudo su -c "curl -sS https://getcomposer.org/installer | php -- --install-dir=$final_path" movim
|
|
|
|
sudo su -c "cd $final_path && php composer.phar install" movim
|
2015-08-11 12:26:57 +02:00
|
|
|
|
|
|
|
# Movim configuration
|
|
|
|
sudo sed -i "s@/ws/@$path/ws/@g" $final_path/app/assets/js/movim_websocket.js
|
|
|
|
|
2015-08-19 11:25:29 +02:00
|
|
|
# Update init scripts
|
2015-08-19 14:08:24 +02:00
|
|
|
sudo sed -i "s@YHURL@$domain$path@g" ../conf/movim.{service,init}
|
|
|
|
sudo sed -i "s@YHDIR@$final_path@g" ../conf/movim.{service,init}
|
|
|
|
sudo sed -i "s@YHPORT@$port@g" ../conf/movim.{service,init}
|
2015-08-19 11:25:29 +02:00
|
|
|
initcheck=`pgrep -ox systemd`
|
|
|
|
if [ "$initcheck" = "1" ];
|
|
|
|
then
|
|
|
|
sudo systemctl stop movim.service
|
|
|
|
sudo systemctl disable movim.service
|
|
|
|
sudo cp ../conf/movim.service /lib/systemd/system/
|
|
|
|
sudo systemctl enable movim.service
|
|
|
|
sudo systemctl start movim.service
|
|
|
|
else
|
|
|
|
sudo /etc/init.d/movim stop
|
|
|
|
sudo cp ../conf/movim.init /etc/init.d/movim
|
|
|
|
sudo chmod 755 /etc/init.d/movim
|
|
|
|
sudo update-rc.d movim defaults
|
|
|
|
sudo /etc/init.d/movim start
|
|
|
|
fi
|
|
|
|
|
2015-08-11 12:26:57 +02:00
|
|
|
# Reload
|
|
|
|
sudo yunohost app ssowatconf
|
2015-08-19 14:00:16 +02:00
|
|
|
sudo service movim restart
|