mirror of
https://github.com/YunoHost-Apps/z-push_ynh.git
synced 2024-09-03 18:05:58 +02:00
Upgrade with full removal and full reinstall
This commit is contained in:
parent
73634befbe
commit
0d5ae0c52f
1 changed files with 56 additions and 35 deletions
|
@ -1,22 +1,30 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$(sudo yunohost app setting z-push domain)
|
|
||||||
path="/Microsoft-Server-ActiveSync"
|
|
||||||
app=z-push
|
app=z-push
|
||||||
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
|
path="/Microsoft-Server-ActiveSync"
|
||||||
|
|
||||||
# Prereqs
|
# Prereqs
|
||||||
sudo apt-get install php-soap php5-imap libawl-php php5-xsl
|
sudo apt-get install php-soap php5-imap libawl-php php5-xsl
|
||||||
|
|
||||||
|
# Cleaning
|
||||||
|
sudo rm -rf /var/www/$app
|
||||||
|
sudo rm -rf /var/log/$app
|
||||||
|
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
sudo rm -f /etc/php5/fpm/pool.d/$app.conf
|
||||||
|
|
||||||
|
final_logpath=/var/log/$app
|
||||||
|
final_path=/var/www/$app
|
||||||
|
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
final_path=/var/www/z-push
|
|
||||||
sudo mkdir -p $final_path
|
sudo mkdir -p $final_path
|
||||||
sudo cp -a ../sources/* $final_path
|
sudo cp -a ../sources/* $final_path
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" ../conf/config*.php
|
sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" ../conf/config.php
|
||||||
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/config*.php
|
sed -i "s@ALIASTOCHANGE@$final_path@g" ../conf/config.php
|
||||||
|
sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/config.php
|
||||||
|
|
||||||
# Enable caldav carddav support
|
# Enable caldav carddav support
|
||||||
sudo yunohost app list -f baikal --json | grep '"installed": true'
|
sudo yunohost app list -f baikal --json | grep '"installed": true'
|
||||||
|
@ -26,50 +34,63 @@ if [ "$?" -eq 0 ]; then
|
||||||
caldavpath=$(sudo yunohost app setting baikal path)
|
caldavpath=$(sudo yunohost app setting baikal path)
|
||||||
caldavpath=${caldavpath%/}
|
caldavpath=${caldavpath%/}
|
||||||
|
|
||||||
|
# Configuration of backend
|
||||||
|
sed -i "s@BACKENDTOCHANGE@BackendCombined@g" ../conf/config.php
|
||||||
|
|
||||||
# Configuration baikal
|
# Configuration baikal
|
||||||
sed -i "s@BAIKALDOMAIN@$caldavdomain@g" ../conf/backend/config*.php
|
sed -i "s@BAIKALDOMAIN@$caldavdomain@g" ../conf/backend/config*.php
|
||||||
sed -i "s@BAIKALPATH@$caldavpath@g" ../conf/backend/config*.php
|
sed -i "s@BAIKALPATH@$caldavpath@g" ../conf/backend/config*.php
|
||||||
sed -i "s@DOMAINTOCHANGE@$domain@g" ../conf/backend/config-imap.php
|
sed -i "s@DOMAINTOCHANGE@$domain@g" ../conf/backend/config-imap.php
|
||||||
|
sed -i "s@FLAGTOCHANGE@true@g" ../conf/backend/config-imap.php
|
||||||
|
|
||||||
# Copy config
|
# Copy config
|
||||||
sudo cp ../conf/config-combined.php $final_path/config.php
|
sudo cp ../conf/config.php $final_path/config.php
|
||||||
sudo cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php
|
sudo cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php
|
||||||
sudo cp ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php
|
sudo cp ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php
|
||||||
sudo cp ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php
|
sudo cp ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php
|
||||||
sudo cp ../conf/backend/config-combined.php $final_path/backend/combined/config.php
|
sudo cp ../conf/backend/config-combined.php $final_path/backend/combined/config.php
|
||||||
else
|
else
|
||||||
|
# Configuration of backend
|
||||||
|
sed -i "s@BACKENDTOCHANGE@BackendIMAP@g" ../conf/config.php
|
||||||
|
|
||||||
# Copy config
|
# Copy config
|
||||||
sudo cp ../conf/config.php $final_path/
|
sudo cp ../conf/config.php $final_path/config.php
|
||||||
sed -i "s@DOMAINTOCHANGE@$domain@g" ../conf/backend/config-imap.php
|
sed -i "s@DOMAINTOCHANGE@$domain@g" ../conf/backend/config-imap.php
|
||||||
|
sed -i "s@FLAGTOCHANGE@false@g" ../conf/backend/config-imap.php
|
||||||
sudo cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php
|
sudo cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create directory
|
# Set permissions to z-push directory
|
||||||
sudo mkdir -p /var/log/z-push
|
sudo chown -R www-data: $final_path
|
||||||
sudo chmod 750 /var/log/z-push
|
|
||||||
sudo chown www-data:www-data /var/log/z-push
|
|
||||||
|
# Create log directory
|
||||||
|
sudo mkdir -p $final_logpath
|
||||||
|
sudo chmod 750 $final_logpath
|
||||||
|
sudo chown www-data:www-data $final_logpath
|
||||||
|
|
||||||
#Copy XMLElement.php
|
#Copy XMLElement.php
|
||||||
sudo ln -s /usr/share/awl/inc/XML* /var/www/z-push/include/
|
sudo ln -s /usr/share/awl/inc/XML* /var/www/z-push/include/
|
||||||
|
|
||||||
|
|
||||||
# Set permissions to z-push directory
|
|
||||||
sudo chown -R www-data: $final_path
|
|
||||||
|
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
|
sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
|
||||||
sudo sed -i "s@NAMETOCHANGE@$app@g" ../conf/nginx.conf
|
sudo sed -i "s@NAMETOCHANGE@$app@g" ../conf/nginx.conf
|
||||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/z-push.conf
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
|
||||||
# Dedicated php-fpm processes
|
# Dedicated php-fpm processes
|
||||||
sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf
|
sudo sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf
|
||||||
finalphpconf=/etc/php5/fpm/pool.d/$app.conf
|
finalphpconf=/etc/php5/fpm/pool.d/$app.conf
|
||||||
sudo cp ../conf/php-fpm.conf $finalphpconf
|
sudo cp ../conf/php-fpm.conf $finalphpconf
|
||||||
sudo chown root: $finalphpconf
|
sudo chown root: $finalphpconf
|
||||||
sudo chmod 644 $finalphpconf
|
sudo chmod 644 $finalphpconf
|
||||||
|
|
||||||
# Reload Nginx and regenerate SSOwat conf
|
# Enable api for client
|
||||||
|
sudo yunohost app setting $app skipped_uris -v "/"
|
||||||
|
|
||||||
|
|
||||||
|
# Restart of services
|
||||||
|
sudo service php5-fpm restart
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue