mirror of
https://github.com/YunoHost-Apps/phplicensewatcher_ynh.git
synced 2024-09-03 19:56:32 +02:00
update
This commit is contained in:
parent
789fd5dca1
commit
0d9d065f02
11 changed files with 761 additions and 0 deletions
42
check_process
Normal file
42
check_process
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
# See here for more informations
|
||||||
|
# https://github.com/YunoHost/package_check#syntax-check_process-file
|
||||||
|
|
||||||
|
# Move this file from check_process.default to check_process when you have filled it.
|
||||||
|
|
||||||
|
;; Test complet
|
||||||
|
; Manifest
|
||||||
|
domain="domain.tld" (DOMAIN)
|
||||||
|
path="/" (PATH)
|
||||||
|
is_public=1 (PUBLIC|public=1|private=0)
|
||||||
|
# password="pass"
|
||||||
|
# nextclouddomain="domain.tld"
|
||||||
|
port="9980" (PORT)
|
||||||
|
; Checks
|
||||||
|
pkg_linter=1
|
||||||
|
setup_sub_dir=0
|
||||||
|
setup_root=1
|
||||||
|
setup_nourl=0
|
||||||
|
setup_private=0
|
||||||
|
setup_public=1
|
||||||
|
upgrade=1
|
||||||
|
backup_restore=1
|
||||||
|
multi_instance=1
|
||||||
|
incorrect_path=1
|
||||||
|
port_already_use=0
|
||||||
|
change_url=0
|
||||||
|
;;; Levels
|
||||||
|
Level 1=auto
|
||||||
|
Level 2=auto
|
||||||
|
Level 3=auto
|
||||||
|
# Level 4:
|
||||||
|
Level 4=1 (This app supports the Nextcloud LDAP auth)
|
||||||
|
# Level 5:
|
||||||
|
Level 5=auto
|
||||||
|
Level 6=auto
|
||||||
|
Level 7=auto
|
||||||
|
Level 8=0
|
||||||
|
Level 9=0
|
||||||
|
Level 10=0
|
||||||
|
;;; Options
|
||||||
|
Email=
|
||||||
|
Notification=none
|
7
conf/app.src
Normal file
7
conf/app.src
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
SOURCE_URL=https://freefr.dl.sourceforge.net/project/mantisbt/mantis-stable/2.19.0/mantisbt-2.19.0.tar.gz
|
||||||
|
SOURCE_SUM=5d074bc3605a9aae3c4b738e0ea667c3687e97a04e2702941158301ab9c86c14e8bc83fe8d5b9d34d5d011f5b5041d37b1bd44ea40815c2d1ae91f6130b5a987
|
||||||
|
SOURCE_SUM_PRG=sha512sum
|
||||||
|
SOURCE_FORMAT=tar.gz
|
||||||
|
SOURCE_IN_SUBDIR=true
|
||||||
|
SOURCE_EXTRACT=true
|
||||||
|
SOURCE_FILENAME=mantisbt.tar.gz
|
83
conf/config_inc.php.sample
Normal file
83
conf/config_inc.php.sample
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
<?php
|
||||||
|
# MantisBT - A PHP based bugtracking system
|
||||||
|
|
||||||
|
# MantisBT is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# MantisBT is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package MantisBT
|
||||||
|
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
|
||||||
|
* @copyright Copyright (C) 2002 MantisBT Team - mantisbt-dev@lists.sourceforge.net
|
||||||
|
* @link http://www.mantisbt.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
# This sample file contains the essential files that you MUST
|
||||||
|
# configure to your specific settings. You may override settings
|
||||||
|
# from config_defaults_inc.php by uncommenting the config option
|
||||||
|
# and setting its value in this file.
|
||||||
|
|
||||||
|
# Rename this file to config_inc.php after configuration.
|
||||||
|
|
||||||
|
# In general the value OFF means the feature is disabled and ON means the
|
||||||
|
# feature is enabled. Any other cases will have an explanation.
|
||||||
|
|
||||||
|
# Look in http://www.mantisbt.org/docs/ or config_defaults_inc.php for more
|
||||||
|
# detailed comments.
|
||||||
|
|
||||||
|
# --- Database Configuration ---
|
||||||
|
$g_hostname = 'localhost';
|
||||||
|
$g_db_username = 'yunouser';
|
||||||
|
$g_db_password = 'yunopass';
|
||||||
|
$g_database_name = 'yunobase';
|
||||||
|
$g_db_type = 'mysqli';
|
||||||
|
|
||||||
|
# --- Security ---
|
||||||
|
$g_crypto_master_salt = ''; # Random string of at least 16 chars, unique to the installation
|
||||||
|
|
||||||
|
# --- Anonymous Access / Signup ---
|
||||||
|
$g_allow_signup = ON;
|
||||||
|
$g_allow_anonymous_login = OFF;
|
||||||
|
$g_anonymous_account = '';
|
||||||
|
|
||||||
|
# --- Email Configuration ---
|
||||||
|
$g_phpMailer_method = PHPMAILER_METHOD_MAIL; # or PHPMAILER_METHOD_SMTP, PHPMAILER_METHOD_SENDMAIL
|
||||||
|
$g_smtp_host = 'localhost'; # used with PHPMAILER_METHOD_SMTP
|
||||||
|
$g_smtp_username = ''; # used with PHPMAILER_METHOD_SMTP
|
||||||
|
$g_smtp_password = ''; # used with PHPMAILER_METHOD_SMTP
|
||||||
|
$g_webmaster_email = 'webmaster@example.com';
|
||||||
|
$g_from_email = 'noreply@example.com'; # the "From: " field in emails
|
||||||
|
$g_return_path_email = 'admin@example.com'; # the return address for bounced mail
|
||||||
|
# $g_from_name = 'Mantis Bug Tracker';
|
||||||
|
# $g_email_receive_own = OFF;
|
||||||
|
# $g_email_send_using_cronjob = OFF;
|
||||||
|
|
||||||
|
# --- Attachments / File Uploads ---
|
||||||
|
# $g_allow_file_upload = ON;
|
||||||
|
# $g_file_upload_method = DATABASE; # or DISK
|
||||||
|
# $g_absolute_path_default_upload_folder = ''; # used with DISK, must contain trailing \ or /.
|
||||||
|
# $g_max_file_size = 5000000; # in bytes
|
||||||
|
# $g_preview_attachments_inline_max_size = 256 * 1024;
|
||||||
|
# $g_allowed_files = ''; # extensions comma separated, e.g. 'php,html,java,exe,pl'
|
||||||
|
# $g_disallowed_files = ''; # extensions comma separated
|
||||||
|
|
||||||
|
# --- Branding ---
|
||||||
|
# $g_window_title = 'MantisBT';
|
||||||
|
# $g_logo_image = 'images/mantis_logo.png';
|
||||||
|
# $g_favicon_image = 'images/favicon.ico';
|
||||||
|
|
||||||
|
# --- Real names ---
|
||||||
|
# $g_show_realname = OFF;
|
||||||
|
# $g_show_user_realname_threshold = NOBODY; # Set to access level (e.g. VIEWER, REPORTER, DEVELOPER, MANAGER, etc)
|
||||||
|
|
||||||
|
# --- Others ---
|
||||||
|
# $g_default_home_page = 'my_view_page.php'; # Set to name of page to go to after login
|
11
conf/nginx.conf
Normal file
11
conf/nginx.conf
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
root __FINALPATH__/;
|
||||||
|
index index.php;
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
try_files $uri =404;
|
||||||
|
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
include /etc/nginx/fastcgi_params;
|
||||||
|
|
||||||
|
}
|
58
manifest.json
Normal file
58
manifest.json
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
{
|
||||||
|
"name": "PHPLicenseWatcher",
|
||||||
|
"id": "phplicensewatcher",
|
||||||
|
"packaging_format": 1,
|
||||||
|
"description": {
|
||||||
|
"en": "A license manager",
|
||||||
|
"fr": "Un gestionnaire de licences"
|
||||||
|
},
|
||||||
|
"version": "1.9.2",
|
||||||
|
"url": "http://phplicensewatch.sourceforge.net",
|
||||||
|
"license": "GPL-3.0",
|
||||||
|
"maintainer": {
|
||||||
|
"name": "liberodark",
|
||||||
|
"email": "liberodark@gmail.com"
|
||||||
|
},
|
||||||
|
"requirements": {
|
||||||
|
"yunohost": ">= 2.7.2"
|
||||||
|
},
|
||||||
|
"multi_instance": false,
|
||||||
|
"services": [
|
||||||
|
"nginx",
|
||||||
|
"php5-fpm",
|
||||||
|
"mysql"
|
||||||
|
],
|
||||||
|
"arguments": {
|
||||||
|
"install": [{
|
||||||
|
"name": "domain",
|
||||||
|
"type": "domain",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a domain name for Mantis",
|
||||||
|
"fr": "Choisissez un nom de domaine pour Mantis"
|
||||||
|
},
|
||||||
|
"example": "example.com"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "path",
|
||||||
|
"type": "path",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a path for Mantis /plw is accepted",
|
||||||
|
"fr": "Choisissez un chemin pour Mantis /plw est accepté"
|
||||||
|
},
|
||||||
|
"example": "/plw",
|
||||||
|
"default": "/plw"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "is_public",
|
||||||
|
"type": "boolean",
|
||||||
|
"ask": {
|
||||||
|
"en": "Is it a public site ?",
|
||||||
|
"fr": "Est-ce un site public ?"
|
||||||
|
},
|
||||||
|
"default": "true"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
112
scripts/_common.sh
Normal file
112
scripts/_common.sh
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# YUNOHOST 2.7 FORTHCOMING HELPERS
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
# Create a dedicated nginx config
|
||||||
|
#
|
||||||
|
# usage: ynh_add_nginx_config
|
||||||
|
ynh_add_nginx_config () {
|
||||||
|
finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
ynh_backup_if_checksum_is_different "$finalnginxconf"
|
||||||
|
sudo cp ../conf/nginx.conf "$finalnginxconf"
|
||||||
|
|
||||||
|
# To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable.
|
||||||
|
# Substitute in a nginx config file only if the variable is not empty
|
||||||
|
if test -n "${path_url:-}"; then
|
||||||
|
ynh_replace_string "__PATH__" "$path_url" "$finalnginxconf"
|
||||||
|
fi
|
||||||
|
if test -n "${domain:-}"; then
|
||||||
|
ynh_replace_string "__DOMAIN__" "$domain" "$finalnginxconf"
|
||||||
|
fi
|
||||||
|
if test -n "${port:-}"; then
|
||||||
|
ynh_replace_string "__PORT__" "$port" "$finalnginxconf"
|
||||||
|
fi
|
||||||
|
if test -n "${app:-}"; then
|
||||||
|
ynh_replace_string "__NAME__" "$app" "$finalnginxconf"
|
||||||
|
fi
|
||||||
|
if test -n "${final_path:-}"; then
|
||||||
|
ynh_replace_string "__FINALPATH__" "$final_path" "$finalnginxconf"
|
||||||
|
fi
|
||||||
|
ynh_store_file_checksum "$finalnginxconf"
|
||||||
|
|
||||||
|
sudo systemctl reload nginx
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove the dedicated nginx config
|
||||||
|
#
|
||||||
|
# usage: ynh_remove_nginx_config
|
||||||
|
ynh_remove_nginx_config () {
|
||||||
|
ynh_secure_remove "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
sudo systemctl reload nginx
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create a dedicated php-fpm config
|
||||||
|
#
|
||||||
|
# usage: ynh_add_fpm_config
|
||||||
|
ynh_add_fpm_config () {
|
||||||
|
finalphpconf="/etc/php5/fpm/pool.d/$app.conf"
|
||||||
|
ynh_backup_if_checksum_is_different "$finalphpconf"
|
||||||
|
sudo cp ../conf/php-fpm.conf "$finalphpconf"
|
||||||
|
ynh_replace_string "__NAMETOCHANGE__" "$app" "$finalphpconf"
|
||||||
|
ynh_replace_string "__FINALPATH__" "$final_path" "$finalphpconf"
|
||||||
|
ynh_replace_string "__USER__" "$app" "$finalphpconf"
|
||||||
|
sudo chown root: "$finalphpconf"
|
||||||
|
ynh_store_file_checksum "$finalphpconf"
|
||||||
|
|
||||||
|
if [ -e "../conf/php-fpm.ini" ]
|
||||||
|
then
|
||||||
|
finalphpini="/etc/php5/fpm/conf.d/20-$app.ini"
|
||||||
|
ynh_backup_if_checksum_is_different "$finalphpini"
|
||||||
|
sudo cp ../conf/php-fpm.ini "$finalphpini"
|
||||||
|
sudo chown root: "$finalphpini"
|
||||||
|
ynh_store_file_checksum "$finalphpini"
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo systemctl reload php5-fpm
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove the dedicated php-fpm config
|
||||||
|
#
|
||||||
|
# usage: ynh_remove_fpm_config
|
||||||
|
ynh_remove_fpm_config () {
|
||||||
|
ynh_secure_remove "/etc/php5/fpm/pool.d/$app.conf"
|
||||||
|
ynh_secure_remove "/etc/php5/fpm/conf.d/20-$app.ini" 2>&1
|
||||||
|
sudo systemctl reload php5-fpm
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create a dedicated systemd config
|
||||||
|
#
|
||||||
|
# usage: ynh_add_systemd_config
|
||||||
|
ynh_add_systemd_config () {
|
||||||
|
finalsystemdconf="/etc/systemd/system/$app.service"
|
||||||
|
ynh_backup_if_checksum_is_different "$finalsystemdconf"
|
||||||
|
sudo cp ../conf/systemd.service "$finalsystemdconf"
|
||||||
|
|
||||||
|
# To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable.
|
||||||
|
# Substitute in a nginx config file only if the variable is not empty
|
||||||
|
if test -n "${final_path:-}"; then
|
||||||
|
ynh_replace_string "__FINALPATH__" "$final_path" "$finalsystemdconf"
|
||||||
|
fi
|
||||||
|
if test -n "${app:-}"; then
|
||||||
|
ynh_replace_string "__APP__" "$app" "$finalsystemdconf"
|
||||||
|
fi
|
||||||
|
ynh_store_file_checksum "$finalsystemdconf"
|
||||||
|
|
||||||
|
sudo chown root: "$finalsystemdconf"
|
||||||
|
sudo systemctl enable $app
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove the dedicated systemd config
|
||||||
|
#
|
||||||
|
# usage: ynh_remove_systemd_config
|
||||||
|
ynh_remove_systemd_config () {
|
||||||
|
finalsystemdconf="/etc/systemd/system/$app.service"
|
||||||
|
if [ -e "$finalsystemdconf" ]; then
|
||||||
|
sudo systemctl stop $app
|
||||||
|
sudo systemctl disable $app
|
||||||
|
ynh_secure_remove "$finalsystemdconf"
|
||||||
|
fi
|
||||||
|
}
|
33
scripts/backup
Normal file
33
scripts/backup
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Exit on command errors and treat unset variables as an error
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# See comments in install script
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
# Source YunoHost helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# Backup sources & data
|
||||||
|
# Note: the last argument is where to save this path, see the restore script.
|
||||||
|
ynh_backup "/var/www/${app}" "sources"
|
||||||
|
|
||||||
|
### MySQL (remove if not used) ###
|
||||||
|
# If a MySQL database is used:
|
||||||
|
# # Dump the database
|
||||||
|
# dbname=$app
|
||||||
|
# dbuser=$app
|
||||||
|
# dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||||
|
# mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql
|
||||||
|
### MySQL end ###
|
||||||
|
|
||||||
|
# Copy NGINX configuration
|
||||||
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
|
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
|
||||||
|
|
||||||
|
### PHP (remove if not used) ###
|
||||||
|
# If a dedicated php-fpm process is used:
|
||||||
|
# # Copy PHP-FPM pool configuration
|
||||||
|
# ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf"
|
||||||
|
### PHP end ###
|
174
scripts/install
Normal file
174
scripts/install
Normal file
|
@ -0,0 +1,174 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
### Remove this function if there's nothing to clean before calling the remove script.
|
||||||
|
true
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
|
path_url=$YNH_APP_ARG_PATH
|
||||||
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
|
||||||
|
### If it's a multi-instance app, meaning it can be installed several times independently
|
||||||
|
### The id of the app as stated in the manifest is available as $YNH_APP_ID
|
||||||
|
### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
|
||||||
|
### The app instance name is available as $YNH_APP_INSTANCE_NAME
|
||||||
|
### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
|
||||||
|
### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
|
||||||
|
### - ynhexample__{N} for the subsequent installations, with N=3,4, ...
|
||||||
|
### The app instance name is probably what interests you most, since this is
|
||||||
|
### guaranteed to be unique. This is a good unique identifier to define installation path,
|
||||||
|
### db names, ...
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
|
||||||
|
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
|
||||||
|
final_path=/var/www/$app
|
||||||
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
|
|
||||||
|
# Normalize the url path syntax
|
||||||
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
|
|
||||||
|
# Check web path availability
|
||||||
|
ynh_webpath_available $domain $path_url
|
||||||
|
# Register (book) web path
|
||||||
|
ynh_webpath_register $app $domain $path_url
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STORE SETTINGS FROM MANIFEST
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_app_setting_set $app domain $domain
|
||||||
|
ynh_app_setting_set $app path $path_url
|
||||||
|
ynh_app_setting_set $app is_public $is_public
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Installing dependencies..."
|
||||||
|
|
||||||
|
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
|
||||||
|
### Those deb packages will be installed as dependencies of this package.
|
||||||
|
### If you're not using this helper:
|
||||||
|
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
|
||||||
|
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
||||||
|
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
||||||
|
|
||||||
|
ynh_install_app_dependencies php7.0-mbstring
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE A MYSQL DATABASE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Creating a MySQL database..."
|
||||||
|
|
||||||
|
### Use these lines if you need a database for the application.
|
||||||
|
### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password.
|
||||||
|
### The password will be stored as 'mysqlpwd' into the app settings,
|
||||||
|
### and will be available as $db_pwd
|
||||||
|
### If you're not using these lines:
|
||||||
|
### - Remove the section "BACKUP THE MYSQL DATABASE" in the backup script
|
||||||
|
### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script
|
||||||
|
### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script
|
||||||
|
|
||||||
|
db_name=$(ynh_sanitize_dbid $app)
|
||||||
|
ynh_app_setting_set $app db_name $db_name
|
||||||
|
ynh_mysql_setup_db $db_name $db_name
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_app_setting_set $app final_path $final_path
|
||||||
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
ynh_setup_source "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Create a dedicated nginx config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Create a system user
|
||||||
|
ynh_system_user_create $app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MODIFY A CONFIG FILE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
cp -a ../conf/config_inc.php.sample $final_path/config/config_inc.php.sample
|
||||||
|
|
||||||
|
ynh_replace_string "yunouser" "$db_name" "$final_path/config/config_inc.php.sample"
|
||||||
|
ynh_replace_string "yunopass" "$db_pwd" "$final_path/config/config_inc.php.sample"
|
||||||
|
ynh_replace_string "yunobase" "$db_name" "$final_path/config/config_inc.php.sample"
|
||||||
|
#ynh_replace_string "yunomail" "$email" "$final_path/config_inc.php.sample"
|
||||||
|
#ynh_replace_string "yunodomain" "$domain" "$final_path/config_inc.php.sample"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
### `ynh_store_file_checksum` is used to store the checksum of a file.
|
||||||
|
### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`,
|
||||||
|
### you can make a backup of this file before modifying it again if the admin had modified it.
|
||||||
|
|
||||||
|
# Calculate and store the config file checksum into the app settings
|
||||||
|
#ynh_store_file_checksum "/etc/onlyoffice/documentserver/nginx/onlyoffice-documentserver.conf"
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# SECURE FILES AND DIRECTORIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
### For security reason, any app should set the permissions to root: before anything else.
|
||||||
|
### Then, if write authorization is needed, any access should be given only to directories
|
||||||
|
### that really need such authorization.
|
||||||
|
|
||||||
|
# Set permissions to app files
|
||||||
|
chown -R www-data:www-data $final_path
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SSOWAT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# If app is public, add url to SSOWat conf as skipped_uris
|
||||||
|
if [ $is_public -eq 1 ]; then
|
||||||
|
# unprotected_uris allows SSO credentials to be passed anyway.
|
||||||
|
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Reload services
|
||||||
|
systemctl reload nginx
|
133
scripts/remove
Normal file
133
scripts/remove
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
port=$(ynh_app_setting_get $app port)
|
||||||
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
|
db_user=$db_name
|
||||||
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD REMOVE
|
||||||
|
#=================================================
|
||||||
|
# REMOVE SERVICE FROM ADMIN PANEL
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Remove a service from the admin panel, added by `yunohost service add`
|
||||||
|
if yunohost service status $app >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
ynh_print_info "Removing $app service"
|
||||||
|
yunohost service remove $app
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STOP AND REMOVE SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Stopping and removing the systemd service"
|
||||||
|
|
||||||
|
# Remove the dedicated systemd config
|
||||||
|
ynh_remove_systemd_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE THE MYSQL DATABASE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Removing the MySQL database"
|
||||||
|
|
||||||
|
# Remove a database if it exists, along with the associated user
|
||||||
|
ynh_mysql_remove_db $db_user $db_name
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Removing dependencies"
|
||||||
|
|
||||||
|
# Remove metapackage and its dependencies
|
||||||
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Removing app main directory"
|
||||||
|
|
||||||
|
# Remove the app directory securely
|
||||||
|
ynh_secure_remove "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Removing nginx web server configuration"
|
||||||
|
|
||||||
|
# Remove the dedicated nginx config
|
||||||
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
#ynh_print_info "Removing php-fpm configuration"
|
||||||
|
|
||||||
|
# Remove the dedicated php-fpm config
|
||||||
|
#ynh_remove_fpm_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE LOGROTATE CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Removing logrotate configuration"
|
||||||
|
|
||||||
|
# Remove the app-specific logrotate config
|
||||||
|
ynh_remove_logrotate
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CLOSE A PORT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if yunohost firewall list | grep -q "\- $port$"
|
||||||
|
then
|
||||||
|
ynh_print_info "Closing port $port"
|
||||||
|
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC REMOVE
|
||||||
|
#=================================================
|
||||||
|
# REMOVE THE CRON FILE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Remove a cron file
|
||||||
|
ynh_secure_remove "/etc/cron.d/$app"
|
||||||
|
|
||||||
|
# Remove a directory securely
|
||||||
|
ynh_secure_remove "/etc/$app/"
|
||||||
|
|
||||||
|
# Remove the log files
|
||||||
|
ynh_secure_remove "/var/log/$app/"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# REMOVE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Removing the dedicated system user"
|
||||||
|
|
||||||
|
# Delete a system user
|
||||||
|
ynh_system_user_delete $app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Removal of $app completed"
|
52
scripts/restore
Normal file
52
scripts/restore
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Note: each files and directories you've saved using the ynh_backup helper
|
||||||
|
# will be located in the current directory, regarding the last argument.
|
||||||
|
|
||||||
|
# Exit on command errors and treat unset variables as an error
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# See comments in install script
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
# Source YunoHost helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# Retrieve old app settings
|
||||||
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
|
path_url=$(ynh_app_setting_get "$app" path_url)
|
||||||
|
|
||||||
|
# Check domain/path availability
|
||||||
|
sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \
|
||||||
|
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||||
|
|
||||||
|
# Restore sources & data
|
||||||
|
src_path="/var/www/${app}"
|
||||||
|
sudo cp -a ./sources "$src_path"
|
||||||
|
|
||||||
|
# Restore permissions to app files
|
||||||
|
# you may need to make some file and/or directory writeable by www-data (nginx user)
|
||||||
|
sudo chown -R root: "$src_path"
|
||||||
|
|
||||||
|
### MySQL (remove if not used) ###
|
||||||
|
# If a MySQL database is used:
|
||||||
|
# # Create and restore the database
|
||||||
|
# dbname=$app
|
||||||
|
# dbuser=$app
|
||||||
|
# dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||||
|
# ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
|
||||||
|
# ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./dump.sql
|
||||||
|
### MySQL end ###
|
||||||
|
|
||||||
|
# Restore NGINX configuration
|
||||||
|
sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||||
|
|
||||||
|
### PHP (remove if not used) ###
|
||||||
|
# If a dedicated php-fpm process is used:
|
||||||
|
# # Copy PHP-FPM pool configuration and reload the service
|
||||||
|
# sudo cp -a ./php-fpm.conf "/etc/php5/fpm/pool.d/${app}.conf"
|
||||||
|
# sudo service php5-fpm reload
|
||||||
|
### PHP end ###
|
||||||
|
|
||||||
|
# Restart webserver
|
||||||
|
sudo service nginx reload
|
56
scripts/upgrade
Normal file
56
scripts/upgrade
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Exit on command errors and treat unset variables as an error
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# See comments in install script
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
final_path=/opt/yunohost/$app
|
||||||
|
|
||||||
|
# Source YunoHost helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# Stop emby-server service
|
||||||
|
systemctl stop emby-server
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_app_setting_set $app final_path $final_path
|
||||||
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
ynh_setup_source "$final_path"
|
||||||
|
|
||||||
|
#==============================================
|
||||||
|
# INSTALL PLEX
|
||||||
|
#==============================================
|
||||||
|
|
||||||
|
dpkg --install $final_path/emby-server-deb*
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Create a dedicated nginx config
|
||||||
|
#ynh_add_nginx_config
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE CONFIG
|
||||||
|
#=================================================
|
||||||
|
#cp -a ../conf/loolwsd.xml /etc/loolwsd
|
||||||
|
#ynh_replace_string "__NEXTCLOUDDOMAIN__" "$nextcloud_domain" "/etc/loolwsd/loolwsd.xml"
|
||||||
|
#ynh_replace_string "__PASSWORD__" "$password" "/etc/loolwsd/loolwsd.xml"
|
||||||
|
#systemctl restart loolwsd
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# If app is public, add url to SSOWat conf as skipped_uris
|
||||||
|
#if [[ $is_public -eq 1 ]]; then
|
||||||
|
# See install script
|
||||||
|
# ynh_app_setting_set "$app" unprotected_uris "/"
|
||||||
|
#fi
|
||||||
|
|
||||||
|
# Start emby-server service
|
||||||
|
systemctl start emby-server
|
||||||
|
|
Loading…
Reference in a new issue