mirror of
https://github.com/YunoHost-Apps/z-push_ynh.git
synced 2024-09-03 18:05:58 +02:00
Apply example_ynh
This commit is contained in:
parent
d67843f5f5
commit
c3b1e7a509
4 changed files with 330 additions and 144 deletions
|
@ -9,25 +9,30 @@
|
||||||
setup_root=0
|
setup_root=0
|
||||||
setup_nourl=0
|
setup_nourl=0
|
||||||
setup_private=0
|
setup_private=0
|
||||||
setup_public=0
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=0
|
multi_instance=0
|
||||||
wrong_user=0
|
|
||||||
wrong_path=1
|
|
||||||
incorrect_path=1
|
incorrect_path=1
|
||||||
corrupt_source=0
|
|
||||||
fail_download_source=0
|
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
final_path_already_use=0
|
change_url=0
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
Level 1=auto
|
||||||
Level 2=auto
|
Level 2=auto
|
||||||
Level 3=auto
|
Level 3=auto
|
||||||
# ?
|
;;; Levels
|
||||||
Level 4=1
|
Level 1=auto
|
||||||
# ?
|
Level 2=auto
|
||||||
Level 5=1
|
Level 3=auto
|
||||||
Level 6=auto
|
# Level 4: If the app supports LDAP and SSOwat, turn level 4 to '1' and add a link to an issue or a part of your code to show it.
|
||||||
Level 7=auto
|
# If the app does not use LDAP nor SSOwat, and can't use them, turn level 4 to 'na' and explain as well.
|
||||||
|
Level 4=na
|
||||||
|
Level 5=auto
|
||||||
|
Level 6=auto
|
||||||
|
Level 7=auto
|
||||||
|
Level 8=0
|
||||||
|
Level 9=0
|
||||||
|
Level 10=0
|
||||||
|
;;; Options
|
||||||
|
Email=
|
||||||
|
Notification=none
|
||||||
|
|
|
@ -1,30 +1,83 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source ../settings/scripts/_common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
### Remove this function if there's nothing to clean before calling the remove script.
|
||||||
|
true
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Source YunoHost helpers
|
|
||||||
source /usr/share/yunohost/helpers
|
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
statedir=$(ynh_app_setting_get $app statedir)
|
statedir=$(ynh_app_setting_get $app statedir)
|
||||||
final_logpath=$(ynh_app_setting_get $app final_logpath)
|
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)
|
|
||||||
|
|
||||||
# Backup sources & data
|
#=================================================
|
||||||
# Note: the last argument is where to save this path, see the restore script.
|
# STANDARD BACKUP STEPS
|
||||||
ynh_backup "$final_path" "sources"
|
#=================================================
|
||||||
|
# BACKUP THE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup "$final_path"
|
||||||
|
|
||||||
# Backup statedir
|
# Backup statedir
|
||||||
ynh_backup "$statedir" "statedir"
|
ynh_backup "$statedir"
|
||||||
|
|
||||||
# Backup logs
|
# Backup logs
|
||||||
ynh_backup "$final_logpath" "logs"
|
ynh_backup "$final_logpath"
|
||||||
ynh_backup "/etc/logrotate.d/$app" "logrotate"
|
|
||||||
|
|
||||||
# Copy NGINX configuration
|
#=================================================
|
||||||
ynh_backup "$final_nginxconf" "nginx.conf"
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Copy PHP-FPM configuration
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
ynh_backup "$final_phpconf" "php-fpm.conf"
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE MYSQL DATABASE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#ynh_mysql_dump_db "$db_name" > db.sql
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC BACKUP
|
||||||
|
#=================================================
|
||||||
|
# BACKUP LOGROTATE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP SYSTEMD
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#ynh_backup "/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP A CRON FILE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#ynh_backup "/etc/cron.d/$app"
|
144
scripts/restore
144
scripts/restore
|
@ -1,32 +1,96 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source ../settings/scripts/_common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
#### Remove this function if there's nothing to clean before calling the remove script.
|
||||||
|
true
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Source YunoHost helpers
|
|
||||||
source /usr/share/yunohost/helpers
|
|
||||||
|
|
||||||
# Retrieve old app settings
|
|
||||||
path=$(ynh_app_setting_get $app path)
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
path_url=$(ynh_app_setting_get $app path)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
statedir=$(ynh_app_setting_get $app statedir)
|
statedir=$(ynh_app_setting_get $app statedir)
|
||||||
final_logpath=$(ynh_app_setting_get $app final_logpath)
|
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)
|
|
||||||
|
|
||||||
# Prereqs
|
#=================================================
|
||||||
sudo apt-get update -y
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
sudo apt-get install php-soap php5-imap libawl-php php5-xsl -y
|
#=================================================
|
||||||
|
|
||||||
# Install dependencies using Helpers
|
ynh_webpath_available $domain $path_url \
|
||||||
#ynh_package_install_from_equivs ../conf/z-push-deps.control \
|
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||||
#|| ynh_die "Unable to install dependencies"
|
test ! -d $final_path \
|
||||||
|
|| ynh_die "There is already a directory: $final_path "
|
||||||
|
|
||||||
# Restore sources, data and permissions
|
#=================================================
|
||||||
sudo mkdir -p $final_path
|
# STANDARD RESTORATION STEPS
|
||||||
sudo cp -a ./sources/. $final_path/
|
#=================================================
|
||||||
sudo chown -R www-data: $final_path
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_restore_file "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE MYSQL DATABASE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||||
|
#ynh_mysql_setup_db $db_name $db_name $db_pwd
|
||||||
|
#ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RECREATE THE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Create the dedicated user (if not existing)
|
||||||
|
#ynh_system_user_create $app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE USER RIGHTS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Restore permissions on app files
|
||||||
|
chown -R www-data: $final_path
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC RESTORATION
|
||||||
|
#=================================================
|
||||||
|
# REINSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Define and install dependencies
|
||||||
|
ynh_install_app_dependencies php-soap php5-imap libawl-php php5-xsl
|
||||||
|
|
||||||
# Restore statedir
|
# Restore statedir
|
||||||
sudo mkdir -p $statedir
|
sudo mkdir -p $statedir
|
||||||
|
@ -38,25 +102,37 @@ sudo mkdir -p $final_logpath
|
||||||
sudo cp -a ./logs/. $final_logpath/
|
sudo cp -a ./logs/. $final_logpath/
|
||||||
sudo chown -R www-data:www-data $final_logpath
|
sudo chown -R www-data:www-data $final_logpath
|
||||||
|
|
||||||
# Restore logrotate
|
|
||||||
sudo cp -a ./logrotate /etc/logrotate.d/$app
|
|
||||||
sudo chmod 644 /etc/logrotate.d/$app
|
|
||||||
sudo chown root:root /etc/logrotate.d/$app
|
|
||||||
|
|
||||||
# Restore NGINX configuration
|
#=================================================
|
||||||
sudo cp -a ./nginx.conf $final_nginxconf
|
# RESTORE SYSTEMD
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Restore PHP-FPM configuration
|
#ynh_restore_file "/etc/systemd/system/$app.service"
|
||||||
sudo cp -a ./php-fpm.conf $final_phpconf
|
#systemctl enable $app.service
|
||||||
sudo chown root: $final_phpconf
|
|
||||||
sudo chmod 644 $final_phpconf
|
|
||||||
|
|
||||||
# Make app public
|
#=================================================
|
||||||
ynh_app_setting_set $app skipped_uris "/"
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#yunohost service add $app --log "/var/log/$app/APP.log"
|
||||||
|
|
||||||
# Restart webserver
|
#=================================================
|
||||||
sudo service nginx reload
|
# RESTORE THE CRON FILE
|
||||||
sudo service php5-fpm reload
|
#=================================================
|
||||||
sudo yunohost app ssowatconf
|
|
||||||
|
|
||||||
|
#ynh_restore_file "/etc/cron.d/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_restore_file "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX AND PHP-FPM
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
systemctl reload php5-fpm
|
||||||
|
systemctl reload nginx
|
||||||
|
|
214
scripts/upgrade
214
scripts/upgrade
|
@ -1,89 +1,116 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
|
||||||
|
|
||||||
# Source app helpers
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Retrieve arguments
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
path=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get $app path)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
statedir=$(ynh_app_setting_get $app statedir)
|
statedir=$(ynh_app_setting_get $app statedir)
|
||||||
final_logpath=$(ynh_app_setting_get $app final_logpath)
|
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" ];
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
then
|
#=================================================
|
||||||
final_path="/var/www/$app"
|
|
||||||
ynh_app_setting_set "$app" final_path "$final_path"
|
# Fix is_public as a boolean value
|
||||||
else
|
if [ "$is_public" = "Yes" ]; then
|
||||||
echo "${final_path} exists, we don't create it."
|
ynh_app_setting_set $app is_public 1
|
||||||
|
is_public=1
|
||||||
|
elif [ "$is_public" = "No" ]; then
|
||||||
|
ynh_app_setting_set $app is_public 0
|
||||||
|
is_public=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$statedir" ];
|
# If db_name doesn't exist, create it
|
||||||
then
|
if [ -z $db_name ]; then
|
||||||
statedir="/home/yunohost.app/$app"
|
db_name=$(ynh_sanitize_dbid $app)
|
||||||
ynh_app_setting_set "$app" statedir "$statedir"
|
ynh_app_setting_set $app db_name $db_name
|
||||||
else
|
|
||||||
echo "${statedir} exists, we don't create it."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$final_logpath" ];
|
# If final_path doesn't exist, create it
|
||||||
then
|
if [ -z $final_path ]; then
|
||||||
final_logpath="/var/log/$app"
|
final_path=/var/www/$app
|
||||||
ynh_app_setting_set "$app" final_logpath "$final_logpath"
|
ynh_app_setting_set $app final_path $final_path
|
||||||
else
|
|
||||||
echo "${final_logpath} exists, we don't create it."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$final_nginxconf" ];
|
#=================================================
|
||||||
then
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
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" ];
|
# Backup the current version of the app
|
||||||
then
|
ynh_backup_before_upgrade
|
||||||
final_phpconf=/etc/php5/fpm/pool.d/$app.conf
|
ynh_clean_setup () {
|
||||||
ynh_app_setting_set "$app" final_phpconf "$final_phpconf"
|
# restore it if the upgrade fails
|
||||||
else
|
ynh_restore_upgradebackup
|
||||||
echo "${final_phpconf} exists, we don't create it."
|
}
|
||||||
fi
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK THE PATH
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Prereqs
|
# Normalize the URL path syntax
|
||||||
#sudo apt-get install php-soap php5-imap libawl-php php5-xsl
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
# Install dependencies using Helpers
|
|
||||||
ynh_package_install_from_equivs ../conf/z-push-deps.control \
|
|
||||||
|| ynh_die "Unable to install dependencies"
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD UPGRADE STEPS
|
||||||
|
#=================================================
|
||||||
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Cleaning
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
sudo rm -rf $final_path
|
ynh_setup_source "$final_path"
|
||||||
sudo rm -rf $final_logpath
|
|
||||||
sudo rm -f $final_nginxconf
|
|
||||||
sudo rm -f $final_phpconf
|
|
||||||
sudo rm -f /etc/logrotate.d/$app
|
|
||||||
|
|
||||||
# Copy files to the right place
|
#=================================================
|
||||||
sudo mkdir -p $final_path
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# We download the sources and check the md5sum
|
# Create a dedicated nginx config
|
||||||
SFILE=`sudo cat ../sources/source_file`;
|
ynh_add_nginx_config
|
||||||
sudo wget -nv -i ../sources/source_url -O ${SFILE}.tar.gz
|
|
||||||
sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false)
|
#=================================================
|
||||||
sudo tar xvf ${SFILE}.tar.gz -C ../sources/
|
# UPGRADE DEPENDENCIES
|
||||||
sudo cp -a ../sources/$SFILE/. $final_path/
|
#=================================================
|
||||||
|
|
||||||
|
ynh_install_app_dependencies php-soap php5-imap libawl-php php5-xsl
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Create a dedicated user (if not existing)
|
||||||
|
ynh_system_user_create $app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Create a dedicated php-fpm config
|
||||||
|
ynh_add_fpm_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC UPGRADE
|
||||||
|
#=================================================
|
||||||
|
# ...
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# 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@LOGTOCHANGE@$final_logpath@g" ../conf/config.php
|
sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/config.php
|
||||||
sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/logrotate
|
|
||||||
|
|
||||||
# Storage of state_dir in /home/yunohost.app
|
# Storage of state_dir in /home/yunohost.app
|
||||||
# This contains the sync status in between device and z-push
|
# This contains the sync status in between device and z-push
|
||||||
|
@ -134,32 +161,57 @@ sudo mkdir -p $final_logpath
|
||||||
sudo chmod 750 $final_logpath
|
sudo chmod 750 $final_logpath
|
||||||
sudo chown www-data:www-data $final_logpath
|
sudo chown www-data:www-data $final_logpath
|
||||||
|
|
||||||
# Activate logrotate
|
|
||||||
sudo cp ../conf/logrotate /etc/logrotate.d/$app
|
|
||||||
sudo chmod 644 /etc/logrotate.d/$app
|
|
||||||
sudo chown root:root /etc/logrotate.d/$app
|
|
||||||
|
|
||||||
#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/
|
||||||
|
|
||||||
# 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@NAMETOCHANGE@$app@g" ../conf/nginx.conf
|
|
||||||
sudo cp ../conf/nginx.conf $final_nginxconf
|
|
||||||
|
|
||||||
# Dedicated php-fpm processes
|
|
||||||
sudo sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf
|
|
||||||
sudo cp ../conf/php-fpm.conf $final_phpconf
|
|
||||||
sudo chown root: $final_phpconf
|
|
||||||
sudo chmod 644 $final_phpconf
|
|
||||||
|
|
||||||
# Fixstates to avoid full resync of devices after version upgrades
|
# Fixstates to avoid full resync of devices after version upgrades
|
||||||
sudo $final_path/z-push-admin.php -a fixstates
|
sudo $final_path/z-push-admin.php -a fixstates
|
||||||
|
|
||||||
# Enable api for client and make the app public
|
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||||
ynh_app_setting_set $app skipped_uris "/"
|
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
||||||
|
ynh_backup_if_checksum_is_different "$final_path/config.php"
|
||||||
|
# Recalculate and store the checksum of the file for the next upgrade.
|
||||||
|
ynh_store_file_checksum "$final_path/config.php"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP LOGROTATE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Use logrotate to manage app-specific logfile(s)
|
||||||
|
ynh_use_logrotate --non-append
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SYSTEMD
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Create a dedicated systemd config
|
||||||
|
ynh_add_systemd_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# SECURE FILES AND DIRECTORIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Set permissions on app files
|
||||||
|
chown -R root: $final_path
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SSOWAT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Make app public if necessary
|
||||||
|
if [ $is_public -eq 1 ]
|
||||||
|
then
|
||||||
|
# unprotected_uris allows SSO credentials to be passed anyway
|
||||||
|
ynh_app_setting_set $app unprotected_uris "/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
systemctl reload nginx
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Restart of services
|
|
||||||
sudo service php5-fpm reload
|
|
||||||
sudo service nginx reload
|
|
||||||
sudo yunohost app ssowatconf
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue