mirror of
https://github.com/YunoHost-Apps/dokuwiki_ynh.git
synced 2024-09-03 18:26:20 +02:00
* [fix] Reactivate integrity check #26 * [fix] Use boolean type for is_public #25 * [fix] isolate user with php-fpm * [fix] boolean is_public for check_process * [fix] Create user for upgrade and restore * [fix] delete choices manifest.json * [fix] load generic function * [fix] delete reload php5-fpm * [fix] owner file with user dokuwiki * [fix] correctly ssowat config for install * [fix] Get file fonction if not been to the current directory * [fix] owner file with user dokuwiki - upgrade * [fix] Clean code * Reload php-fpm et after remove user * [fix] upgrade php5-fpm with a good user * [fix] owner root for all files & owner dokuwiki for write access * [fix] owner root for all files & owner dokuwiki for write access (upgrade script) * [fix] owner read & write for plugins directory
69 lines
2.1 KiB
Bash
Executable file
69 lines
2.1 KiB
Bash
Executable file
#!/bin/bash
|
|
# This restore script is adapted to Yunohost >=2.4
|
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
set -eu
|
|
|
|
# The parameter $2 is the id of the app instance ex: ynhexample__2
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
if [ ! -e .fonctions ]; then
|
|
# Get file fonction if not been to the current directory
|
|
sudo cp ../settings/scripts/.fonctions ./.fonctions
|
|
sudo chmod a+rx .fonctions
|
|
fi
|
|
# Loads the generic functions usually used in the script
|
|
source .fonctions
|
|
# Source app helpers
|
|
source /usr/share/yunohost/helpers
|
|
|
|
# Get old parameter of the app
|
|
domain=$(ynh_app_setting_get $app domain)
|
|
path=$(ynh_app_setting_get $app path)
|
|
is_public=$(ynh_app_setting_get $app is_public)
|
|
|
|
# Check domain/path availability
|
|
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
|
|| ynh_die "Path not available: ${domain}${path}"
|
|
|
|
# Check $final_path
|
|
final_path="/var/www/${app}"
|
|
if [ -d $final_path ]; then
|
|
ynh_die "There is already a directory: $final_path"
|
|
fi
|
|
|
|
# Check configuration files nginx
|
|
nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
|
if [ -f $nginx_conf ]; then
|
|
ynh_die "The NGINX configuration already exists at '${nginx_conf}'. You should safely delete it before restoring this app."
|
|
fi
|
|
# Check configuration files php-fpm
|
|
phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf"
|
|
if [ -f $phpfpm_conf ]; then
|
|
ynh_die "The PHP FPM configuration already exists at '${phpfpm_conf}'. You should safely delete it before restoring this app."
|
|
fi
|
|
|
|
phpfpm_ini="/etc/php5/fpm/conf.d/20-${app}.ini"
|
|
if [ -f $phpfpm_ini ]; then
|
|
ynh_die "The PHP FPM INI configuration already exists at '${phpfpm_ini}'. You should safely delete it before restoring this app."
|
|
fi
|
|
|
|
# Create system user dedicace for this app
|
|
ynh_system_user_create $app
|
|
|
|
# Restore sources & data
|
|
sudo cp -a ./sources "${final_path}"
|
|
|
|
# Set permissions
|
|
sudo chown -R $app: "${final_path}"
|
|
|
|
# Restore nginx configuration files
|
|
sudo cp -a ./nginx.conf "${nginx_conf}"
|
|
# Restore php-fpm configuration files
|
|
sudo cp -a ./php-fpm.conf "${phpfpm_conf}"
|
|
sudo cp -a ./php-fpm.ini "${phpfpm_ini}"
|
|
|
|
# Reload services
|
|
sudo systemctl reload php5-fpm
|
|
sudo systemctl reload nginx
|
|
sudo yunohost app ssowatconf
|