mirror of
https://github.com/YunoHost-Apps/z-push_ynh.git
synced 2024-09-03 18:05:58 +02:00
Upgrade to latest yunohost version
This commit is contained in:
parent
f73a249aa8
commit
5d5874b7a2
1 changed files with 53 additions and 18 deletions
|
@ -1,21 +1,59 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Source app helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(sudo yunohost app setting $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
path="/Microsoft-Server-ActiveSync"
|
path="/Microsoft-Server-ActiveSync"
|
||||||
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
final_logpath=$(ynh_app_setting_get $app final_logpath)
|
||||||
|
final_nginxconf=$(ynh_app_setting_get $app final_nginxconf)
|
||||||
|
final_phpconf=$(ynh_app_setting_get $app final_phpconf)
|
||||||
|
|
||||||
|
# We make the app retro-compatible with previous versions
|
||||||
|
if [ -z "$final_path" ];
|
||||||
|
then
|
||||||
|
final_path="/var/www/$app"
|
||||||
|
ynh_app_setting_set "$app" final_path "$final_path"
|
||||||
|
else
|
||||||
|
echo "${final_path} exists, we don't create it."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$final_logpath" ];
|
||||||
|
then
|
||||||
|
final_logpath="/var/log/$app"
|
||||||
|
ynh_app_setting_set "$app" final_logpath "$final_logpath"
|
||||||
|
else
|
||||||
|
echo "${final_logpath} exists, we don't create it."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$final_nginxconf" ];
|
||||||
|
then
|
||||||
|
final_nginxconf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||||
|
ynh_app_setting_set "$app" final_nginxconf "$final_nginxconf"
|
||||||
|
else
|
||||||
|
echo "${final_nginxconf} exists, we don't create it."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$final_phpconf" ];
|
||||||
|
then
|
||||||
|
final_phpconf=/etc/php5/fpm/pool.d/$app.conf
|
||||||
|
ynh_app_setting_set "$app" final_phpconf "$final_phpconf"
|
||||||
|
else
|
||||||
|
echo "${final_phpconf} exists, we don't create it."
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# 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
|
# Cleaning
|
||||||
sudo rm -rf /var/www/$app
|
sudo rm -rf $final_path
|
||||||
sudo rm -rf /var/log/$app
|
sudo rm -rf $final_logpath
|
||||||
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
sudo rm -f $final_nginxconf
|
||||||
sudo rm -f /etc/php5/fpm/pool.d/$app.conf
|
sudo rm -f $final_phpconf
|
||||||
|
|
||||||
final_logpath=/var/log/$app
|
|
||||||
final_path=/var/www/$app
|
|
||||||
|
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
sudo mkdir -p $final_path
|
sudo mkdir -p $final_path
|
||||||
|
@ -55,7 +93,7 @@ else
|
||||||
|
|
||||||
# Copy config
|
# Copy config
|
||||||
sudo cp ../conf/config.php $final_path/config.php
|
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
|
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
|
||||||
|
|
||||||
|
@ -64,7 +102,6 @@ fi
|
||||||
# Set permissions to z-push directory
|
# Set permissions to z-push directory
|
||||||
sudo chown -R www-data: $final_path
|
sudo chown -R www-data: $final_path
|
||||||
|
|
||||||
|
|
||||||
# Create log directory
|
# Create log directory
|
||||||
sudo mkdir -p $final_logpath
|
sudo mkdir -p $final_logpath
|
||||||
sudo chmod 750 $final_logpath
|
sudo chmod 750 $final_logpath
|
||||||
|
@ -76,18 +113,16 @@ sudo ln -s /usr/share/awl/inc/XML* /var/www/z-push/include/
|
||||||
# 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/$app.conf
|
sudo cp ../conf/nginx.conf $final_nginxconf
|
||||||
|
|
||||||
# Dedicated php-fpm processes
|
# Dedicated php-fpm processes
|
||||||
sudo 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
|
sudo cp ../conf/php-fpm.conf $final_phpconf
|
||||||
sudo cp ../conf/php-fpm.conf $finalphpconf
|
sudo chown root: $final_phpconf
|
||||||
sudo chown root: $finalphpconf
|
sudo chmod 644 $final_phpconf
|
||||||
sudo chmod 644 $finalphpconf
|
|
||||||
|
|
||||||
# Enable api for client
|
|
||||||
sudo yunohost app setting $app skipped_uris -v "/"
|
|
||||||
|
|
||||||
|
# Enable api for client and make the app public
|
||||||
|
ynh_app_setting_set $app skipped_uris "/"
|
||||||
|
|
||||||
# Restart of services
|
# Restart of services
|
||||||
sudo service php5-fpm reload
|
sudo service php5-fpm reload
|
||||||
|
|
Loading…
Add table
Reference in a new issue