1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/osticket_ynh.git synced 2024-09-03 19:56:17 +02:00
This commit is contained in:
Éric Gaspar 2023-04-01 22:16:29 +02:00
parent 42b2a3267e
commit c8be7a38e9
24 changed files with 326 additions and 279 deletions

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/osTicket/osTicket/releases/download/v1.17.3/osTicket-v1.17.3.zip
SOURCE_SUM=be3ade536a19b875e16fe0d9716e07f3897f5c0cdbd4efe4ff17ab262d98bed3
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,5 +0,0 @@
SOURCE_URL=https://github.com/osTicket/osTicket-plugins/archive/fc089b9339c2a89e293b99be878252f03276cdc7.tar.gz
SOURCE_SUM=227dd80a42cd9b66f45b0c60779bba4a1d1d7b71e59311f472960fdf1293ec9f
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -1 +1 @@
*/5 * * * * nobody /usr/bin/php__PHPVERSION__ __FINALPATH__/api/cron.php */5 * * * * nobody /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/api/cron.php

View file

@ -2,7 +2,7 @@
location __PATH__/ { location __PATH__/ {
# Path to source # Path to source
alias __FINALPATH__/; alias __INSTALL_DIR__/;
index index.php; index index.php;

View file

@ -358,7 +358,7 @@ request_terminate_timeout = 1d
; Chdir to this directory at the start. ; Chdir to this directory at the start.
; Note: relative path can be used. ; Note: relative path can be used.
; Default Value: current directory or / when chroot ; Default Value: current directory or / when chroot
chdir = __FINALPATH__ chdir = __INSTALL_DIR__
; Redirect worker stdout and stderr into main error log. If not set, stdout and ; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs. ; stderr will be redirected to /dev/null according to FastCGI specs.

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/clonemeagain/osticket-plugin-archiver/archive/df6eab6bb6a65d6aa02215b1becb01238883c62f.tar.gz
SOURCE_SUM=c3fa4416853fe2eb918cd68a6f0965c4b66dd411b79993614a47eea5baa095f2
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/clonemeagain/attachment_preview/archive/0a3e293f4c296981e9eb7252f29ebbea173fcf9f.tar.gz
SOURCE_SUM=4258cdd2781d84e0329aaa95938fb4c2baff2606c15b0faec85bd18be790f11e
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/clonemeagain/plugin-autocloser/archive/cc986b6a6c687144dca258e42dea6e00eca126df.tar.gz
SOURCE_SUM=ba4dbdddaa340b8cf457cb3b04beb510565c411cca19d67dbab764b562c47b65
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/bkonetzny/osticket-fetch-note/archive/7bd28052a33d448db68e0393ca5d92f1b1744283.tar.gz
SOURCE_SUM=d95c8c744cdad20b25fe4053ca795d118e82c36a5f0b86973da47209b5ac9cc0
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/Micke1101/OSTicket-plugin-field-radiobuttons/archive/5e5173b5b15f25a8f681f6df767ecd7f6d413530.tar.gz
SOURCE_SUM=cfd135076710cf4eaeb4966af73009bc20618ed8cc9d618f1ddf6499b381c348
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/clonemeagain/plugin-fwd-rewriter/archive/2c5e3bad0f0cb94a1b51a33a854cfd551ea67e30.tar.gz
SOURCE_SUM=c12f1757110ef5141f274b5dc10be186c1d608d2bed74d48f41bce956abc98a3
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/pberndro/osticket-mattermost/archive/8ac5224c121e765f22237818da1b8c189a9bd647.tar.gz
SOURCE_SUM=d18e2c796bd96c1016334195e816445d684a10e933f997a789d340eee75c7db7
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/clonemeagain/osticket-plugin-mentioner/archive/c2a8bcd93a8d559b783871a7843903ce2d1a9ff2.tar.gz
SOURCE_SUM=6c72a2a86599e3109e5e02194e4202a36e2326b25f916333f134a02cc8061196
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/ipavlovi/osTicket-Microsoft-Teams-plugin/archive/183a4248e9c605ee403a0054dbf076616b0459d2.tar.gz
SOURCE_SUM=f53388328d6647ba11a0586dfc46ca8f42e418688098a9ea0e9e7c8ec4f1e255
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/clonemeagain/osticket-plugin-preventautoscroll/archive/2b5c51200d0f64da15d1f504e9294d877577fc46.tar.gz
SOURCE_SUM=0e31ea961668097e739de0da4aaf41b36ebf71a56508642500ec3f5ec59ede19
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/clonemeagain/osticket-slack/archive/235436a8fb92168f01fa4d4e55336d203c6eded4.tar.gz
SOURCE_SUM=c97024c86688ba73b38fa4fa4d2329076dd7a912dca5f2aea042d6b095e6ab3e
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

123
manifest.toml Normal file
View file

@ -0,0 +1,123 @@
packaging_format = 2
id = "osticket"
name = "osTicket"
description.en = "Open source support ticket system"
description.fr = "Système de ticket de support open source"
version = "1.17.3~ynh1"
maintainers = ["yalh76"]
[upstream]
license = "GPL-2.0-or-later"
website = "https://osticket.com"
demo = "http://www.ostickethacks.com/demo/demo_info.php"
userdoc = "https://docs.osticket.com"
code = "https://github.com/osTicket/osTicket"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
[integration]
yunohost = ">= 4.3.0"
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
multi_instance = true
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
[install]
[install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain"
[install.path]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "path"
default = "/osticket"
[install.init_main_permission]
type = "group"
default = "visitors"
[install.language]
ask.en = "Choose the application language"
ask.fr = "Choisissez la langue de l'application"
type = "string"
choices = ["en_US", "fr", "ar_EG", "ar_SA", "az", "bg", "bn", "bs", "ca", "cs", "da", "de", "el", "en_GB", "es_AR", "es_ES", "es_MX", "et", "eu", "fa", "fi", "he", "hi", "hr", "hu", "id", "is", "it", "ja", "ka", "km", "ko", "lt", "lv", "mk", "mn", "ms", "nl", "no", "pl", "pt_BR", "pt_PT", "ro", "ru", "sk", "sl", "sq", "sr", "sr_CS", "sv_SE", "sw", "th", "tr", "uk", "ur_IN", "ur_PK", "vi", "zh_CN", "zh_TW"]
default = "fr"
[install.admin]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "user"
[install.password]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "password"
[resources]
[resources.sources]
[resources.sources.plugin-autocloser]
url = "https://github.com/clonemeagain/plugin-autocloser/archive/cc986b6a6c687144dca258e42dea6e00eca126df.tar.gz"
sha256 = "ba4dbdddaa340b8cf457cb3b04beb510565c411cca19d67dbab764b562c47b65"
[resources.sources.plugin-preventautoscroll]
url = "https://github.com/clonemeagain/osticket-plugin-preventautoscroll/archive/2b5c51200d0f64da15d1f504e9294d877577fc46.tar.gz"
sha256 = "0e31ea961668097e739de0da4aaf41b36ebf71a56508642500ec3f5ec59ede19"
[resources.sources.plugin-microsoft-teams]
url = "https://github.com/ipavlovi/osTicket-Microsoft-Teams-plugin/archive/183a4248e9c605ee403a0054dbf076616b0459d2.tar.gz"
sha256 = "f53388328d6647ba11a0586dfc46ca8f42e418688098a9ea0e9e7c8ec4f1e255"
[resources.sources.core-plugins]
url = "https://github.com/osTicket/osTicket-plugins/archive/fc089b9339c2a89e293b99be878252f03276cdc7.tar.gz"
sha256 = "227dd80a42cd9b66f45b0c60779bba4a1d1d7b71e59311f472960fdf1293ec9f"
[resources.sources.plugin-mentioner]
url = "https://github.com/clonemeagain/osticket-plugin-mentioner/archive/c2a8bcd93a8d559b783871a7843903ce2d1a9ff2.tar.gz"
sha256 = "6c72a2a86599e3109e5e02194e4202a36e2326b25f916333f134a02cc8061196"
[resources.sources.plugin-fwd-rewriter]
url = "https://github.com/clonemeagain/plugin-fwd-rewriter/archive/2c5e3bad0f0cb94a1b51a33a854cfd551ea67e30.tar.gz"
sha256 = "c12f1757110ef5141f274b5dc10be186c1d608d2bed74d48f41bce956abc98a3"
[resources.sources.main]
url = "https://github.com/osTicket/osTicket/releases/download/v1.17.3/osTicket-v1.17.3.zip"
sha256 = "be3ade536a19b875e16fe0d9716e07f3897f5c0cdbd4efe4ff17ab262d98bed3"
[resources.sources.plugin-attachment_preview]
url = "https://github.com/clonemeagain/attachment_preview/archive/0a3e293f4c296981e9eb7252f29ebbea173fcf9f.tar.gz"
sha256 = "4258cdd2781d84e0329aaa95938fb4c2baff2606c15b0faec85bd18be790f11e"
[resources.sources.plugin-fetch-note]
url = "https://github.com/bkonetzny/osticket-fetch-note/archive/7bd28052a33d448db68e0393ca5d92f1b1744283.tar.gz"
sha256 = "d95c8c744cdad20b25fe4053ca795d118e82c36a5f0b86973da47209b5ac9cc0"
[resources.sources.plugin-slack]
url = "https://github.com/clonemeagain/osticket-slack/archive/235436a8fb92168f01fa4d4e55336d203c6eded4.tar.gz"
sha256 = "c97024c86688ba73b38fa4fa4d2329076dd7a912dca5f2aea042d6b095e6ab3e"
[resources.sources.plugin-field-radiobuttons]
url = "https://github.com/Micke1101/OSTicket-plugin-field-radiobuttons/archive/5e5173b5b15f25a8f681f6df767ecd7f6d413530.tar.gz"
sha256 = "cfd135076710cf4eaeb4966af73009bc20618ed8cc9d618f1ddf6499b381c348"
[resources.sources.plugin-mattermost]
url = "https://github.com/pberndro/osticket-mattermost/archive/8ac5224c121e765f22237818da1b8c189a9bd647.tar.gz"
sha256 = "d18e2c796bd96c1016334195e816445d684a10e933f997a789d340eee75c7db7"
[resources.sources.plugin-archiver]
url = "https://github.com/clonemeagain/osticket-plugin-archiver/archive/df6eab6bb6a65d6aa02215b1becb01238883c62f.tar.gz"
sha256 = "c3fa4416853fe2eb918cd68a6f0965c4b66dd411b79993614a47eea5baa095f2"
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"
[resources.database]
type = "mysql"

View file

@ -4,11 +4,11 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
YNH_PHP_VERSION="8.0" #REMOVEME? YNH_PHP_VERSION="8.0"
php_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-gd php-php-gettext php${YNH_PHP_VERSION}-imap php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-curl" #REMOVEME? php_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-gd php-php-gettext php${YNH_PHP_VERSION}-imap php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-curl"
pkg_dependencies="curl $php_dependencies" #REMOVEME? pkg_dependencies="curl $php_dependencies"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -14,23 +14,23 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
true true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info --message="Loading installation settings..." #REMOVEME? ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
domain=$(ynh_app_setting_get --app=$app --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) #REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
@ -41,7 +41,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$final_path" ynh_backup --src_path="$install_dir"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION

View file

@ -13,53 +13,53 @@ source /usr/share/yunohost/helpers
# RETRIEVE ARGUMENTS # RETRIEVE ARGUMENTS
#================================================= #=================================================
old_domain=$YNH_APP_OLD_DOMAIN #REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH #REMOVEME? old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN #REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH #REMOVEME? new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 #REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config" #REMOVEME? # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#================================================= #=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 #REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade #REMOVEME? ynh_backup_before_upgrade
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" #REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup #REMOVEME? ynh_restore_upgradebackup
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED # CHECK WHICH PARTS SHOULD BE CHANGED
#================================================= #=================================================
change_domain=0 #REMOVEME? change_domain=0
if [ "$old_domain" != "$new_domain" ] #REMOVEME? if [ "$old_domain" != "$new_domain" ]
then then
change_domain=1 #REMOVEME? change_domain=1
fi fi
change_path=0 #REMOVEME? change_path=0
if [ "$old_path" != "$new_path" ] #REMOVEME? if [ "$old_path" != "$new_path" ]
then then
change_path=1 #REMOVEME? change_path=1
fi fi
#================================================= #=================================================
@ -69,28 +69,30 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf ynh_change_url_nginx_config
#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the NGINX config file # Change the path in the NGINX config file
if [ $change_path -eq 1 ] if [ $change_path -eq 1 ]
then then
# Make a backup of the original NGINX config file if modified # Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path" #REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper # Set global variables for NGINX helper
domain="$old_domain" #REMOVEME? domain="$old_domain"
path_url="$new_path" #REMOVEME? path="$new_path"
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config #REMOVEME? ynh_add_nginx_config
fi fi
# Change the domain for NGINX # Change the domain for NGINX
if [ $change_domain -eq 1 ] if [ $change_domain -eq 1 ]
then then
# Delete file checksum for the old conf file location # Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path" #REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf #REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location # Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" #REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi fi
#================================================= #=================================================
@ -98,9 +100,9 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1 #REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload #REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -13,99 +13,99 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
true true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
domain=$YNH_APP_ARG_DOMAIN #REMOVEME? domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH #REMOVEME? path=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC #REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE #REMOVEME? language=$YNH_APP_ARG_LANGUAGE
admin=$YNH_APP_ARG_ADMIN #REMOVEME? admin=$YNH_APP_ARG_ADMIN
password=$YNH_APP_ARG_PASSWORD #REMOVEME? password=$YNH_APP_ARG_PASSWORD
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1 #REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app #REMOVEME? install_dir=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" #REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
# Register (book) web path # Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1 #REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain #REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url #REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=admin --value=$admin #REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1 #REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies #REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Configuring system user..." --weight=1 #REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user # Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path" #REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Creating a MySQL database..." --weight=1 #REMOVEME? ynh_script_progression --message="Creating a MySQL database..." --weight=1
db_name=$(ynh_sanitize_dbid --db_name=$app) #REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name #REMOVEME? db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name #REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=1 ynh_script_progression --message="Setting up source files..." --weight=1
ynh_app_setting_set --app=$app --key=final_path --value=$final_path #REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$install_dir"
ynh_setup_source --dest_dir="$final_path/include/plugins/build" --source_id="core-plugins" ynh_setup_source --dest_dir="$install_dir/include/plugins/build" --source_id="core-plugins"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/archiver" --source_id="plugin-archiver" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/archiver" --source_id="plugin-archiver"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/attachment_preview" --source_id="plugin-attachment_preview" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/attachment_preview" --source_id="plugin-attachment_preview"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/autocloser" --source_id="plugin-autocloser" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/autocloser" --source_id="plugin-autocloser"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/fetch-note" --source_id="plugin-fetch-note" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/fetch-note" --source_id="plugin-fetch-note"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/field-radiobuttons" --source_id="plugin-field-radiobuttons" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/field-radiobuttons" --source_id="plugin-field-radiobuttons"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/fwd-rewriter" --source_id="plugin-fwd-rewriter" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/fwd-rewriter" --source_id="plugin-fwd-rewriter"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/mattermost" --source_id="plugin-mattermost" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/mattermost" --source_id="plugin-mattermost"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/mentioner" --source_id="plugin-mentioner" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/mentioner" --source_id="plugin-mentioner"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/microsoft-teams" --source_id="plugin-microsoft-teams" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/microsoft-teams" --source_id="plugin-microsoft-teams"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/slack" --source_id="plugin-slack" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/slack" --source_id="plugin-slack"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/preventautoscroll" --source_id="plugin-preventautoscroll" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/preventautoscroll" --source_id="plugin-preventautoscroll"
rsync -a "../conf/i18n" "$final_path/include/." rsync -a "../conf/i18n" "$install_dir/include/."
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
@ -114,7 +114,7 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
# Create a dedicated PHP-FPM config # Create a dedicated PHP-FPM config
ynh_add_fpm_config ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -138,20 +138,20 @@ ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
cp -f "../conf/ost-sampleconfig.php" "$final_path/include/ost-config.php" cp -f "../conf/ost-sampleconfig.php" "$install_dir/include/ost-config.php"
chmod 666 "$final_path/include/ost-config.php" chmod 666 "$install_dir/include/ost-config.php"
chown $app:www-data "$final_path/include/ost-config.php" chown $app:www-data "$install_dir/include/ost-config.php"
#================================================= #=================================================
# BUILD PLUGINS # BUILD PLUGINS
#================================================= #=================================================
ynh_script_progression --message="Building plugins..." --weight=1 ynh_script_progression --message="Building plugins..." --weight=1
ynh_exec_as $app mkdir -p "$final_path/include/plugins/build/.config/composer" ynh_exec_as $app mkdir -p "$install_dir/include/plugins/build/.config/composer"
export COMPOSER_HOME="$final_path/include/plugins/build/.config/composer" export COMPOSER_HOME="$install_dir/include/plugins/build/.config/composer"
pushd "$final_path/include/plugins/build" pushd "$install_dir/include/plugins/build"
ynh_exec_warn_less ynh_exec_as $app php$phpversion make.php hydrate ynh_exec_warn_less ynh_exec_as $app php$phpversion make.php hydrate
ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build auth-cas ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build auth-cas
ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build auth-ldap ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build auth-ldap
@ -170,10 +170,10 @@ pushd "$final_path/include/plugins/build"
ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build microsoft-teams ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build microsoft-teams
ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build slack ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build slack
ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build preventautoscroll ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build preventautoscroll
ynh_exec_warn_less ynh_exec_as $app cp *.phar $final_path/include/plugins/. ynh_exec_warn_less ynh_exec_as $app cp *.phar $install_dir/include/plugins/.
popd popd
ynh_secure_remove --file="$final_path/include/plugins/build" #REMOVEME? ynh_secure_remove --file="$install_dir/include/plugins/build"
#================================================= #=================================================
# SETUP APPLICATION WITH CURL # SETUP APPLICATION WITH CURL
@ -183,7 +183,7 @@ ynh_script_progression --message="Setuping application with CURL..." --weight=1
# Set the app as temporarily public for curl call # Set the app as temporarily public for curl call
ynh_script_progression --message="Configuring SSOwat..." --weight=1 ynh_script_progression --message="Configuring SSOwat..." --weight=1
# Making the app public for curl # Making the app public for curl
ynh_permission_update --permission="main" --add="visitors" #REMOVEME? ynh_permission_update --permission="main" --add="visitors"
admin_fname=$(ynh_user_get_info $admin 'firstname') admin_fname=$(ynh_user_get_info $admin 'firstname')
admin_lname=$(ynh_user_get_info $admin 'lastname') admin_lname=$(ynh_user_get_info $admin 'lastname')
@ -194,36 +194,36 @@ ynh_script_progression --message="Finalizing installation..." --weight=1
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" 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 # Remove the public access
ynh_permission_update --permission="main" --remove="visitors" #REMOVEME? ynh_permission_update --permission="main" --remove="visitors"
ynh_secure_remove --file="$final_path/setup" #REMOVEME? ynh_secure_remove --file="$install_dir/setup"
chmod 400 "$final_path/include/ost-config.php" chmod 400 "$install_dir/include/ost-config.php"
chown $app:www-data "$final_path/include/ost-config.php" chown $app:www-data "$install_dir/include/ost-config.php"
ynh_store_file_checksum --file="$final_path/include/ost-config.php" ynh_store_file_checksum --file="$install_dir/include/ost-config.php"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1 #REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] #REMOVEME? if [ $is_public -eq 1 ]
then then
# Everyone can access the app. # Everyone can access the app.
# The "main" permission is automatically created before the install script. # The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors" #REMOVEME? ynh_permission_update --permission="main" --add="visitors"
fi fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1 #REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -12,32 +12,32 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 #REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) #REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name #REMOVEME? db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#================================================= #=================================================
# REMOVE THE MYSQL DATABASE # REMOVE THE MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Removing the MySQL database..." --weight=1 #REMOVEME? ynh_script_progression --message="Removing the MySQL database..." --weight=1
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name #REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1 #REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" #REMOVEME? ynh_secure_remove --file="$install_dir"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
@ -58,10 +58,10 @@ ynh_remove_fpm_config
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1 #REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies #REMOVEME? ynh_remove_app_dependencies
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
@ -78,10 +78,10 @@ ynh_secure_remove --file="/etc/cron.d/$app"
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1 #REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user # Delete a system user
ynh_system_user_delete --username=$app #REMOVEME? ynh_system_user_delete --username=$app
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -14,64 +14,64 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
true true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 #REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) #REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) #REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name #REMOVEME? db_user=$db_name
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1 #REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \ #REMOVEME? test ! -d $install_dir \
|| ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $install_dir "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 #REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path" #REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$install_dir"
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1 #REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies #REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
@ -90,10 +90,10 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=1 #REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." --weight=1
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) #REMOVEME? 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 #REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#================================================= #=================================================

View file

@ -12,16 +12,16 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 #REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) #REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
language=$(ynh_app_setting_get --app=$app --key=language) #REMOVEME? language=$(ynh_app_setting_get --app=$app --key=language)
admin=$(ynh_app_setting_get --app=$app --key=admin) #REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) #REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -33,16 +33,16 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 #REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade #REMOVEME? ynh_backup_before_upgrade
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
# Restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup #REMOVEME? ynh_restore_upgradebackup
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
@ -52,8 +52,8 @@ ynh_abort_if_errors
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Cleaning legacy permissions # Cleaning legacy permissions
if ynh_legacy_permissions_exists; then #REMOVEME? if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all #REMOVEME? ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public ynh_app_setting_delete --app=$app --key=is_public
fi fi
@ -61,10 +61,10 @@ fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 #REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path" #REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -77,42 +77,42 @@ then
tmpdir="$(mktemp -d)" tmpdir="$(mktemp -d)"
mkdir $tmpdir/plugins mkdir $tmpdir/plugins
rsync -a "$final_path/include/plugins" "$tmpdir/." rsync -a "$install_dir/include/plugins" "$tmpdir/."
rsync -a "$final_path/include/ost-config.php" "$tmpdir/." rsync -a "$install_dir/include/ost-config.php" "$tmpdir/."
ynh_secure_remove --file="$final_path" #REMOVEME? ynh_secure_remove --file="$install_dir"
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$install_dir"
ynh_setup_source --dest_dir="$final_path/include/plugins/build" --source_id="core-plugins" ynh_setup_source --dest_dir="$install_dir/include/plugins/build" --source_id="core-plugins"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/archiver" --source_id="plugin-archiver" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/archiver" --source_id="plugin-archiver"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/attachment_preview" --source_id="plugin-attachment_preview" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/attachment_preview" --source_id="plugin-attachment_preview"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/autocloser" --source_id="plugin-autocloser" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/autocloser" --source_id="plugin-autocloser"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/fetch-note" --source_id="plugin-fetch-note" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/fetch-note" --source_id="plugin-fetch-note"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/field-radiobuttons" --source_id="plugin-field-radiobuttons" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/field-radiobuttons" --source_id="plugin-field-radiobuttons"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/fwd-rewriter" --source_id="plugin-fwd-rewriter" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/fwd-rewriter" --source_id="plugin-fwd-rewriter"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/mattermost" --source_id="plugin-mattermost" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/mattermost" --source_id="plugin-mattermost"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/mentioner" --source_id="plugin-mentioner" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/mentioner" --source_id="plugin-mentioner"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/microsoft-teams" --source_id="plugin-microsoft-teams" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/microsoft-teams" --source_id="plugin-microsoft-teams"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/slack" --source_id="plugin-slack" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/slack" --source_id="plugin-slack"
ynh_setup_source --dest_dir="$final_path/include/plugins/build/preventautoscroll" --source_id="plugin-preventautoscroll" ynh_setup_source --dest_dir="$install_dir/include/plugins/build/preventautoscroll" --source_id="plugin-preventautoscroll"
rsync -a "$tmpdir/plugins" "$final_path/include/." rsync -a "$tmpdir/plugins" "$install_dir/include/."
rsync -a "$tmpdir/ost-config.php" "$final_path/include/." rsync -a "$tmpdir/ost-config.php" "$install_dir/include/."
ynh_secure_remove --file="$tmpdir" ynh_secure_remove --file="$tmpdir"
fi fi
rsync -a "../conf/i18n" "$final_path/include/." rsync -a "../conf/i18n" "$install_dir/include/."
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1 #REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies #REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
@ -121,7 +121,7 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
# Create a dedicated PHP-FPM config # Create a dedicated PHP-FPM config
ynh_add_fpm_config ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -138,10 +138,10 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1 ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_store_file_checksum --file="$final_path/include/ost-config.php" ynh_store_file_checksum --file="$install_dir/include/ost-config.php"
chmod 400 "$final_path/include/ost-config.php" chmod 400 "$install_dir/include/ost-config.php"
chown $app:www-data "$final_path/include/ost-config.php" chown $app:www-data "$install_dir/include/ost-config.php"
#================================================= #=================================================
# BUILD PLUGINS # BUILD PLUGINS
@ -150,9 +150,9 @@ chown $app:www-data "$final_path/include/ost-config.php"
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Building plugins..." --weight=1 ynh_script_progression --message="Building plugins..." --weight=1
ynh_exec_as $app mkdir -p "$final_path/include/plugins/build/.config/composer" ynh_exec_as $app mkdir -p "$install_dir/include/plugins/build/.config/composer"
COMPOSER_HOME="$final_path/include/plugins/build/.config/composer" COMPOSER_HOME="$install_dir/include/plugins/build/.config/composer"
pushd "$final_path/include/plugins/build" pushd "$install_dir/include/plugins/build"
ynh_exec_warn_less ynh_exec_as $app php$phpversion make.php hydrate ynh_exec_warn_less ynh_exec_as $app php$phpversion make.php hydrate
ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build auth-cas ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build auth-cas
ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build auth-ldap ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build auth-ldap
@ -171,10 +171,10 @@ then
ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build microsoft-teams ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build microsoft-teams
ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build slack ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build slack
ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build preventautoscroll ynh_exec_warn_less ynh_exec_as $app php$phpversion -dphar.readonly=0 make.php build preventautoscroll
ynh_exec_warn_less ynh_exec_as $app cp -f *.phar $final_path/include/plugins/. ynh_exec_warn_less ynh_exec_as $app cp -f *.phar $install_dir/include/plugins/.
popd popd
ynh_secure_remove --file="$final_path/include/plugins/build" #REMOVEME? ynh_secure_remove --file="$install_dir/include/plugins/build"
ynh_secure_remove --file="$final_path/setup" #REMOVEME? ynh_secure_remove --file="$install_dir/setup"
fi fi
#================================================= #=================================================
@ -182,7 +182,7 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Upgrading the application..." --weight=1 ynh_script_progression --message="Upgrading the application..." --weight=1
pushd "$final_path" pushd "$install_dir"
php$phpversion manage.php upgrade php$phpversion manage.php upgrade
popd popd
@ -198,9 +198,9 @@ ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1 #REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT