1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/osticket_ynh.git synced 2024-09-03 19:56:17 +02:00

apply example_ynh

This commit is contained in:
yalh76 2021-02-17 10:11:58 +01:00
parent 4b228f499c
commit 8a53b62fb9
16 changed files with 165 additions and 184 deletions

View file

@ -1,10 +1,10 @@
# osTicket for YunoHost
[![Integration level](https://dash.yunohost.org/integration/osticket.svg)](https://dash.yunohost.org/appci/app/osticket) ![](https://ci-apps.yunohost.org/ci/badges/osticket.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/osticket.maintain.svg)
[![Install osTicket with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=osticket)
[![Install osTicket with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=osticket)
> *This package allow you to install osTicket quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
> *This package allows you to install osTicket quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
osTicket is a widely-used open source support ticket system. It seamlessly integrates inquiries created via email, phone and web-based forms into a simple easy-to-use multi-user web interface. Manage, organize and archive all your support requests and responses in one place while providing your customers with accountability and responsiveness they deserve.
@ -25,13 +25,13 @@ osTicket is a widely-used open source support ticket system. It seamlessly integ
## YunoHost specific features
#### Multi-users support
#### Multi-user support
LDAP and HTTP auth are supported through plugins
#### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/osticket%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/osticket/)
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/osticket%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/osticket/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/osticket%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/osticket/)
## Additional information
@ -66,9 +66,9 @@ LDAP and HTTP auth are supported through plugins
---
## Developers info
## Developer info
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/osticket_ynh/tree/testing).
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/osticket_ynh/tree/testing).
To try the testing branch, please proceed like that.
```

View file

@ -25,13 +25,8 @@
upgrade=1 from_commit=cadb10e497d938e0e684e43ac870a3807b4b60d9
backup_restore=1
multi_instance=1
# This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version.
# incorrect_path=1
port_already_use=0
change_url=1
;;; Levels
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 5=auto
;;; Options
Email=
Notification=none

View file

@ -4,3 +4,4 @@ SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/osTicket/osTicket-plugins/archive/14f4778904fd2aba707497e9a45dcecbb2129c9a.tar.gz
SOURCE_SUM=7bde26e1e08ffa9f7225b73744991594841eb4e9dd8b3e172975628cb00d9bd1
SOURCE_URL=https://github.com/osTicket/osTicket-plugins/archive/52f7bae08699d9408180d0a67b327e79c095cd37.tar.gz
SOURCE_SUM=468087ea48af6ef1b8372a7542974e1d2f00759c7e3fa87209ce06e7d6c0af70
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -17,7 +17,7 @@ location __PATH__/ {
try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_index index.php;
include fastcgi_params;

View file

@ -33,7 +33,7 @@ group = __USER__
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock
listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD)

View file

@ -1,32 +1,34 @@
---
name: Bug report
about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all.
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change url...), you are on the right place!*
- *Otherwise, the issue may be due to osticket itself. Refer to its documentation or repository for help.*
- *If you have a doubt, post here, we will figure it out together.*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to osTicket itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
**Describe the bug**
### Describe the bug
*A clear and concise description of what the bug is.*
**Versions**
### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance ?: *no / yes*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
**To Reproduce**
*Steps to reproduce the behavior.*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install osticket
@ -34,13 +36,20 @@ about: Create a report to help us debug, it would be nice to fill the template a
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '....'*
3. *Scroll down to '....'*
2. *Click on '...'*
3. *Scroll down to '...'*
4. *See error*
**Expected behavior**
### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
**Logs**
*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.*
### Logs
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.*

View file

@ -13,7 +13,7 @@
"name": "yalh76"
},
"requirements": {
"yunohost": ">= 3.5"
"yunohost": ">= 4.1.3"
},
"multi_instance": true,
"services": [

View file

@ -13,6 +13,4 @@
## Package_check results
---
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/osticket_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/osticket_ynh%20PR-NUM-%20(USERNAME)/)
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

View file

@ -5,7 +5,11 @@
#=================================================
# dependencies used by the app
pkg_dependencies="php-gd php-gettext php-imap php-json php-mbstring php-xml php-zip php-intl php-apcu php-curl"
pkg_dependencies="curl"
YNH_PHP_VERSION="7.3"
extra_php_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-gettext php-imap php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-apcu php${YNH_PHP_VERSION}-curl"
#=================================================
# PERSONAL HELPERS

View file

@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () {
true
@ -31,6 +30,7 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
@ -53,7 +53,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# SPECIFIC BACKUP

View file

@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
ynh_print_info --message="Retrieve arguments from the manifest"
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
@ -25,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
@ -38,7 +37,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info --message="Backing up the app before changing its url (may take a while)..."
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
@ -73,7 +72,7 @@ fi
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_print_info --message="Updating nginx web server configuration..."
ynh_script_progression --message="Updating nginx web server configuration..."
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -110,7 +109,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload
@ -118,4 +117,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_print_info --message="Change of URL completed for $app"
ynh_script_progression --message="Change of URL completed for $app"

View file

@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () {
true
@ -23,7 +22,6 @@ ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
ynh_print_info --message="Retrieving arguments from the manifest..."
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
@ -37,7 +35,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_print_info --message="Validating installation parameters..."
ynh_script_progression --message="Validating installation parameters..."
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
@ -48,12 +46,11 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_print_info --message="Storing installation settings..."
ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=language --value=$language
#=================================================
@ -61,14 +58,14 @@ ynh_app_setting_set --app=$app --key=language --value=$language
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_print_info --message="Installing dependencies..."
ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
ynh_print_info --message="Creating a MySQL database..."
ynh_script_progression --message="Creating a MySQL database..."
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
@ -78,7 +75,7 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_print_info --message="Setting up source files..."
ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
@ -99,7 +96,7 @@ ynh_setup_source --dest_dir="$final_path/include/plugins/build/preventautoscroll
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Configuring nginx web server..."
ynh_script_progression --message="Configuring nginx web server..."
# Create a dedicated nginx config
ynh_add_nginx_config
@ -107,7 +104,7 @@ ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info --message="Configuring system user..."
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
@ -115,17 +112,18 @@ ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_print_info --message="Configuring php-fpm..."
ynh_script_progression --message="Configuring php-fpm..."
# Create a dedicated php-fpm config
ynh_add_fpm_config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC SETUP
#=================================================
# PREPARE INSTALL
#=================================================
ynh_print_info --message="Preparing install..."
ynh_script_progression --message="Preparing install..."
config_file=$final_path/include/ost-config.php
cp -f ../conf/ost-sampleconfig.php "$config_file"
@ -137,27 +135,27 @@ admin_mail=$(ynh_user_get_info $admin 'mail')
#=================================================
# BUILD PLUGINS
#=================================================
ynh_print_info --message="Building plugins..."
ynh_script_progression --message="Building plugins..."
pushd "$final_path/include/plugins/build"
php make.php hydrate
php -dphar.readonly=0 make.php build auth-cas
php -dphar.readonly=0 make.php build auth-ldap
php -dphar.readonly=0 make.php build auth-oauth
php -dphar.readonly=0 make.php build auth-passthru
php -dphar.readonly=0 make.php build storage-fs
php -dphar.readonly=0 make.php build storage-s3
php -dphar.readonly=0 make.php build archiver
php -dphar.readonly=0 make.php build attachment_preview
php -dphar.readonly=0 make.php build autocloser
php -dphar.readonly=0 make.php build fetch-note
php -dphar.readonly=0 make.php build field-radiobuttons
php -dphar.readonly=0 make.php build fwd-rewriter
php -dphar.readonly=0 make.php build mattermost
php -dphar.readonly=0 make.php build mentioner
php -dphar.readonly=0 make.php build microsoft-teams
php -dphar.readonly=0 make.php build slack
php -dphar.readonly=0 make.php build preventautoscroll
php${phpversion} make.php hydrate
php${phpversion} -dphar.readonly=0 make.php build auth-cas
php${phpversion} -dphar.readonly=0 make.php build auth-ldap
php${phpversion} -dphar.readonly=0 make.php build auth-oauth
php${phpversion} -dphar.readonly=0 make.php build auth-passthru
php${phpversion} -dphar.readonly=0 make.php build storage-fs
php${phpversion} -dphar.readonly=0 make.php build storage-s3
php${phpversion} -dphar.readonly=0 make.php build archiver
php${phpversion} -dphar.readonly=0 make.php build attachment_preview
php${phpversion} -dphar.readonly=0 make.php build autocloser
php${phpversion} -dphar.readonly=0 make.php build fetch-note
php${phpversion} -dphar.readonly=0 make.php build field-radiobuttons
php${phpversion} -dphar.readonly=0 make.php build fwd-rewriter
php${phpversion} -dphar.readonly=0 make.php build mattermost
php${phpversion} -dphar.readonly=0 make.php build mentioner
php${phpversion} -dphar.readonly=0 make.php build microsoft-teams
php${phpversion} -dphar.readonly=0 make.php build slack
php${phpversion} -dphar.readonly=0 make.php build preventautoscroll
cp *.phar $final_path/include/plugins/.
popd
ynh_secure_remove --file="$final_path/include/plugins/build"
@ -165,21 +163,22 @@ ynh_secure_remove --file="$final_path/include/plugins/build"
#=================================================
# INSTALL LANGUAGE
#=================================================
ynh_print_info --message="Installing language..."
ynh_script_progression --message="Installing language..."
rsync -a "../conf/i18n" "$final_path/include/."
#=================================================
# SETUP APPLICATION WITH CURL
#=================================================
ynh_print_info --message="Setuping application with CURL..."
ynh_script_progression --message="Setuping application with CURL..."
# Set right permissions for curl install
chown -R $app: $final_path
# Set the app as temporarily public for curl call
ynh_print_info --message="Configuring SSOwat..."
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
ynh_script_progression --message="Configuring SSOwat..."
# Making the app public for curl
ynh_permission_update --permission="main" --add="visitors"
# Reload SSOwat config
yunohost app ssowatconf
@ -187,19 +186,16 @@ yunohost app ssowatconf
ynh_systemd_action --service_name=nginx --action=reload
# Installation with curl
ynh_print_info --message="Finalizing installation..."
ynh_script_progression --message="Finalizing installation..."
ynh_local_curl "/setup/install.php" "s=install" "name=$app" "email=$app@$domain" "lang_id=$language" "fname=$admin_fname" "lname=$admin_lname" "admin_email=$admin_mail" "username=$admin" "passwd=$password" "passwd2=$password" "prefix=ost_" "dbhost=localhost" "dbname=$db_name" "dbuser=$db_user" "dbpass=$db_pwd"
# Remove the public access
if [ $is_public -eq 0 ]
then
ynh_app_setting_delete --app=$app --key=skipped_uris
fi
ynh_permission_update --permission="main" --remove="visitors"
#=================================================
# FINALIZE INSTALL
#=================================================
ynh_print_info --message="Finalizing install..."
ynh_script_progression --message="Finalizing install..."
# Removing setup folder
ynh_secure_remove --file="$final_path/setup"
@ -210,7 +206,7 @@ chmod 0644 $config_file
#=================================================
# SET THE CRON FILE
#=================================================
ynh_print_info --message="Setting the cron file..."
ynh_script_progression --message="Setting the cron file..."
cp ../conf/cron /etc/cron.d/$app
@ -219,7 +215,7 @@ ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
ynh_print_info --message="Storing the config file checksum..."
ynh_script_progression --message="Storing the config file checksum..."
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config_file"
@ -229,7 +225,7 @@ ynh_store_file_checksum --file="$config_file"
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_print_info --message="Securing files and directories..."
ynh_script_progression --message="Securing files and directories..."
# Set permissions to app files
chown -R $app: $final_path
@ -237,19 +233,20 @@ chown -R $app: $final_path
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info --message="Configuring SSOwat..."
ynh_script_progression --message="Configuring permissions..."
# 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=$app --key=unprotected_uris --value="/"
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload
@ -257,4 +254,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_print_info --message="Installation of $app completed"
ynh_script_progression --message="Installation of $app completed"

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -26,7 +26,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_print_info --message="Removing the MySQL database..."
ynh_script_progression --message="Removing the MySQL database..."
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
@ -34,7 +34,7 @@ ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_print_info --message="Removing dependencies..."
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
@ -42,7 +42,7 @@ ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_print_info --message="Removing app main directory..."
ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
@ -50,7 +50,7 @@ ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Removing nginx web server configuration..."
ynh_script_progression --message="Removing nginx web server configuration..."
# Remove the dedicated nginx config
ynh_remove_nginx_config
@ -58,7 +58,7 @@ ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_print_info --message="Removing php-fpm configuration..."
ynh_script_progression --message="Removing php-fpm configuration..."
# Remove the dedicated php-fpm config
ynh_remove_fpm_config
@ -68,7 +68,7 @@ ynh_remove_fpm_config
#=================================================
# REMOVE THE CRON FILE
#=================================================
ynh_print_info --message="Removing the cron file..."
ynh_script_progression --message="Removing the cron file..."
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"
@ -78,7 +78,7 @@ ynh_secure_remove --file="/etc/cron.d/$app"
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_print_info --message="Removing the dedicated system user..."
ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
ynh_system_user_delete --username=$app
@ -87,4 +87,4 @@ ynh_system_user_delete --username=$app
# END OF SCRIPT
#=================================================
ynh_print_info --message="Removal of $app completed"
ynh_script_progression --message="Removal of $app completed"

View file

@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () {
true
@ -24,7 +23,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading settings..."
ynh_script_progression --message="Loading settings..."
app=$YNH_APP_INSTANCE_NAME
@ -33,11 +32,12 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_print_info --message="Validating restoration parameters..."
ynh_script_progression --message="Validating restoration parameters..."
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
@ -49,21 +49,21 @@ test ! -d $final_path \
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Restoring the nginx configuration..."
ynh_script_progression --message="Restoring the nginx configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_print_info --message="Restoring the app main directory..."
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_print_info --message="Recreating the dedicated system user..."
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
@ -71,7 +71,7 @@ ynh_system_user_create --username=$app
#=================================================
# RESTORE USER RIGHTS
#=================================================
ynh_print_info --message="Restoring user rights..."
ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files
chown -R $app: $final_path
@ -79,16 +79,20 @@ chown -R $app: $final_path
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_print_info --message="Restoring PHP-FPM configuration..."
ynh_script_progression --message="Restoring PHP-FPM configuration..."
ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Create a dedicated php-fpm config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_print_info --message="Reinstalling dependencies..."
ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
@ -96,7 +100,7 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_print_info --message="Restoring the MySQL database..."
ynh_script_progression --message="Restoring the MySQL database..."
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
@ -105,7 +109,7 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./
#=================================================
# RESTORE THE CRON FILE
#=================================================
ynh_print_info --message="Restoring the cron file..."
ynh_script_progression --message="Restoring the cron file..."
ynh_restore_file --origin_path="/etc/cron.d/$app"
@ -114,13 +118,13 @@ ynh_restore_file --origin_path="/etc/cron.d/$app"
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_print_info --message="Reloading nginx web server and php-fpm..."
ynh_script_progression --message="Reloading nginx web server and php-fpm..."
ynh_systemd_action --service_name=php7.0-fpm --action=reload
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Restoration completed for $app"
ynh_script_progression --message="Restoration completed for $app"

View file

@ -12,14 +12,13 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
@ -29,40 +28,26 @@ config_file=$final_path/include/ost-config.php
#=================================================
# CHECK VERSION
#=================================================
ynh_print_info --message="Checking version..."
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_print_info --message="Ensuring downward compatibility..."
ynh_script_progression --message="Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/var/www/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info --message="Backing up the app before upgrading (may take a while)..."
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
@ -81,7 +66,7 @@ ynh_abort_if_errors
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_print_info --message="Upgrading source files..."
ynh_script_progression --message="Upgrading source files..."
tmpdir="$(mktemp -d)"
@ -113,7 +98,7 @@ fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Upgrading nginx web server configuration..."
ynh_script_progression --message="Upgrading nginx web server configuration..."
# Create a dedicated nginx config
ynh_add_nginx_config
@ -121,14 +106,14 @@ ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_print_info --message="Upgrading dependencies..."
ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info --message="Making sure dedicated system user exists..."
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
@ -136,39 +121,40 @@ ynh_system_user_create --username=$app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_print_info --message="Upgrading php-fpm configuration..."
ynh_script_progression --message="Upgrading php-fpm configuration..."
# Create a dedicated php-fpm config
ynh_add_fpm_config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC UPGRADE
#=================================================
# BUILD PLUGINS
#=================================================
ynh_print_info --message="Building plugins..."
ynh_script_progression --message="Building plugins..."
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
pushd "$final_path/include/plugins/build"
php make.php hydrate
php -dphar.readonly=0 make.php build auth-cas
php -dphar.readonly=0 make.php build auth-ldap
php -dphar.readonly=0 make.php build auth-oauth
php -dphar.readonly=0 make.php build auth-passthru
php -dphar.readonly=0 make.php build storage-fs
php -dphar.readonly=0 make.php build storage-s3
php -dphar.readonly=0 make.php build archiver
php -dphar.readonly=0 make.php build attachment_preview
php -dphar.readonly=0 make.php build autocloser
php -dphar.readonly=0 make.php build fetch-note
php -dphar.readonly=0 make.php build field-radiobuttons
php -dphar.readonly=0 make.php build fwd-rewriter
php -dphar.readonly=0 make.php build mattermost
php -dphar.readonly=0 make.php build mentioner
php -dphar.readonly=0 make.php build microsoft-teams
php -dphar.readonly=0 make.php build slack
php -dphar.readonly=0 make.php build preventautoscroll
php${phpversion} make.php hydrate
php${phpversion} -dphar.readonly=0 make.php build auth-cas
php${phpversion} -dphar.readonly=0 make.php build auth-ldap
php${phpversion} -dphar.readonly=0 make.php build auth-oauth
php${phpversion} -dphar.readonly=0 make.php build auth-passthru
php${phpversion} -dphar.readonly=0 make.php build storage-fs
php${phpversion} -dphar.readonly=0 make.php build storage-s3
php${phpversion} -dphar.readonly=0 make.php build archiver
php${phpversion} -dphar.readonly=0 make.php build attachment_preview
php${phpversion} -dphar.readonly=0 make.php build autocloser
php${phpversion} -dphar.readonly=0 make.php build fetch-note
php${phpversion} -dphar.readonly=0 make.php build field-radiobuttons
php${phpversion} -dphar.readonly=0 make.php build fwd-rewriter
php${phpversion} -dphar.readonly=0 make.php build mattermost
php${phpversion} -dphar.readonly=0 make.php build mentioner
php${phpversion} -dphar.readonly=0 make.php build microsoft-teams
php${phpversion} -dphar.readonly=0 make.php build slack
php${phpversion} -dphar.readonly=0 make.php build preventautoscroll
cp -f *.phar $final_path/include/plugins/.
popd
ynh_secure_remove --file="$final_path/include/plugins/build"
@ -177,14 +163,14 @@ fi
#=================================================
# UPGRADE LANGUAGE
#=================================================
ynh_print_info --message="UPGRADING language..."
ynh_script_progression --message="UPGRADING language..."
rsync -a "../conf/i18n" "$final_path/include/."
#=================================================
# FINALIZE UPGRADE
#=================================================
ynh_print_info --message="Finalizing install..."
ynh_script_progression --message="Finalizing install..."
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
@ -198,7 +184,7 @@ fi
#=================================================
# SET THE CRON FILE
#=================================================
ynh_print_info --message="Setting the cron file..."
ynh_script_progression --message="Setting the cron file..."
cp -f ../conf/cron /etc/cron.d/$app
@ -207,7 +193,7 @@ ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
ynh_print_info --message="Storing the config file checksum..."
ynh_script_progression --message="Storing the config file checksum..."
ynh_backup_if_checksum_is_different --file="$config_file"
# Recalculate and store the checksum of the file for the next upgrade.
@ -218,27 +204,15 @@ ynh_store_file_checksum --file="$config_file"
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_print_info --message="Securing files and directories..."
ynh_script_progression --message="Securing files and directories..."
# Set permissions on app files
chown -R $app: $final_path
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info --message="Upgrading SSOwat configuration..."
# 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=$app --key=unprotected_uris --value="/"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload
@ -246,4 +220,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_print_info --message="Upgrade of $app completed"
ynh_script_progression --message="Upgrade of $app completed"