mirror of
https://github.com/YunoHost-Apps/framaforms_ynh.git
synced 2024-09-03 18:36:12 +02:00
[enh] Installation work
This commit is contained in:
parent
37195bb9fc
commit
5b967abc89
21 changed files with 869 additions and 95 deletions
|
@ -4,7 +4,7 @@
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld" (DOMAIN)
|
||||||
path="/path" (PATH)
|
path="/path" (PATH)
|
||||||
admin="jibec" (USER)
|
password="bibopP5" (PASSWORD)
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
is_public=1 (PUBLIC|public=1|private=0)
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
SOURCE_URL=https://framagit.org/framasoft/framaforms/-/archive/ad53d1a6f3d78ec0748a35a4e82bb013cad22f00/framaforms-ad53d1a6f3d78ec0748a35a4e82bb013cad22f00.tar.gz
|
SOURCE_URL=https://framagit.org/ljf/framaforms/-/archive/19ef353c7d88813d9c404e965b3f86bc8905d06d/framaforms-19ef353c7d88813d9c404e965b3f86bc8905d06d.tar.gz
|
||||||
SOURCE_SUM=0272127cfe4e307ce2b824446fab1dfacba54071dcf06cdf48bc265da6719362
|
SOURCE_SUM=7df7a449a36bb60059b5642cfd86b44422e0bd8bdc182ba71621d90c74bc0967
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FILENAME=framaforms-0.0.0+190614.tar.gz
|
SOURCE_FILENAME=framaforms-1.0.0+190618.tar.gz
|
||||||
|
|
5
conf/composer.json
Normal file
5
conf/composer.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"require": {
|
||||||
|
"drush/drush": "8.*"
|
||||||
|
}
|
||||||
|
}
|
7
conf/cron
Normal file
7
conf/cron
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
SHELL=/bin/sh
|
||||||
|
PATH=__FINALPATH__/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
|
|
||||||
|
# m h dom mon dow user command
|
||||||
|
30 * * * * __APP__ drush --quiet @__APP__ core-cron
|
||||||
|
00 22 * * * __APP__ drush --quiet @__APP__ pm-update -y
|
||||||
|
#
|
|
@ -1,28 +1,78 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
$databases = array (
|
* @file
|
||||||
'default' =>
|
* Drupal site-specific configuration file.
|
||||||
array (
|
*
|
||||||
'default' =>
|
* IMPORTANT NOTE:
|
||||||
array (
|
* This file may have been set to read-only by the Drupal installation program.
|
||||||
'database' => '__DB_NAME__',
|
* If you make changes to this file, be sure to protect it again after making
|
||||||
'username' => '__DB_USER__',
|
* your modifications. Failure to remove write permissions to this file is a
|
||||||
'password' => '__DB_PWD__',
|
* security risk.
|
||||||
'host' => 'localhost',
|
*
|
||||||
'port' => '5432',
|
* The configuration file to be loaded is based upon the rules below. However
|
||||||
'driver' => 'pgsql',
|
* if the multisite aliasing file named sites/sites.php is present, it will be
|
||||||
'prefix' => '',
|
* loaded, and the aliases in the array $sites will override the default
|
||||||
),
|
* directory rules below. See sites/example.sites.php for more information about
|
||||||
),
|
* aliases.
|
||||||
);
|
*
|
||||||
|
* The configuration directory will be discovered by stripping the website's
|
||||||
|
* hostname from left to right and pathname from right to left. The first
|
||||||
|
* configuration file found will be used and any others will be ignored. If no
|
||||||
|
* other configuration file is found then the default configuration file at
|
||||||
|
* 'sites/default' will be used.
|
||||||
|
*
|
||||||
|
* For example, for a fictitious site installed at
|
||||||
|
* http://www.drupal.org:8080/mysite/test/, the 'settings.php' file is searched
|
||||||
|
* for in the following directories:
|
||||||
|
*
|
||||||
|
* - sites/8080.www.drupal.org.mysite.test
|
||||||
|
* - sites/www.drupal.org.mysite.test
|
||||||
|
* - sites/drupal.org.mysite.test
|
||||||
|
* - sites/org.mysite.test
|
||||||
|
*
|
||||||
|
* - sites/8080.www.drupal.org.mysite
|
||||||
|
* - sites/www.drupal.org.mysite
|
||||||
|
* - sites/drupal.org.mysite
|
||||||
|
* - sites/org.mysite
|
||||||
|
*
|
||||||
|
* - sites/8080.www.drupal.org
|
||||||
|
* - sites/www.drupal.org
|
||||||
|
* - sites/drupal.org
|
||||||
|
* - sites/org
|
||||||
|
*
|
||||||
|
* - sites/default
|
||||||
|
*
|
||||||
|
* Note that if you are installing on a non-standard port number, prefix the
|
||||||
|
* hostname with that number. For example,
|
||||||
|
* http://www.drupal.org:8080/mysite/test/ could be loaded from
|
||||||
|
* sites/8080.www.drupal.org.mysite.test/.
|
||||||
|
*
|
||||||
|
* @see example.sites.php
|
||||||
|
* @see conf_path()
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn off the X-Frame-Options header entirely, to restore the previous
|
* Database settings:
|
||||||
* behavior of allowing the site to be embedded in a frame on another site.
|
*
|
||||||
*/
|
* The $databases array specifies the database connection or
|
||||||
$conf['x_frame_options'] = '';
|
* connections that Drupal may use. Drupal is able to connect
|
||||||
|
* to multiple databases, including multiple types of databases,
|
||||||
/*
|
* during the same request.
|
||||||
|
*
|
||||||
|
* Each database connection is specified as an array of settings,
|
||||||
|
* similar to the following:
|
||||||
|
* @code
|
||||||
|
* array(
|
||||||
|
* 'driver' => 'mysql',
|
||||||
|
* 'database' => 'databasename',
|
||||||
|
* 'username' => 'username',
|
||||||
|
* 'password' => 'password',
|
||||||
|
* 'host' => 'localhost',
|
||||||
|
* 'port' => 3306,
|
||||||
|
* 'prefix' => 'myprefix_',
|
||||||
|
* 'collation' => 'utf8_general_ci',
|
||||||
|
* );
|
||||||
|
* @endcode
|
||||||
*
|
*
|
||||||
* The "driver" property indicates what Drupal database driver the
|
* The "driver" property indicates what Drupal database driver the
|
||||||
* connection should use. This is usually the same as the name of the
|
* connection should use. This is usually the same as the name of the
|
||||||
|
@ -75,6 +125,38 @@ $conf['x_frame_options'] = '';
|
||||||
* );
|
* );
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
|
* For handling full UTF-8 in MySQL, including multi-byte characters such as
|
||||||
|
* emojis, Asian symbols, and mathematical symbols, you may set the collation
|
||||||
|
* and charset to "utf8mb4" prior to running install.php:
|
||||||
|
* @code
|
||||||
|
* $databases['default']['default'] = array(
|
||||||
|
* 'driver' => 'mysql',
|
||||||
|
* 'database' => 'databasename',
|
||||||
|
* 'username' => 'username',
|
||||||
|
* 'password' => 'password',
|
||||||
|
* 'host' => 'localhost',
|
||||||
|
* 'charset' => 'utf8mb4',
|
||||||
|
* 'collation' => 'utf8mb4_general_ci',
|
||||||
|
* );
|
||||||
|
* @endcode
|
||||||
|
* When using this setting on an existing installation, ensure that all existing
|
||||||
|
* tables have been converted to the utf8mb4 charset, for example by using the
|
||||||
|
* utf8mb4_convert contributed project available at
|
||||||
|
* https://www.drupal.org/project/utf8mb4_convert, so as to prevent mixing data
|
||||||
|
* with different charsets.
|
||||||
|
* Note this should only be used when all of the following conditions are met:
|
||||||
|
* - In order to allow for large indexes, MySQL must be set up with the
|
||||||
|
* following my.cnf settings:
|
||||||
|
* [mysqld]
|
||||||
|
* innodb_large_prefix=true
|
||||||
|
* innodb_file_format=barracuda
|
||||||
|
* innodb_file_per_table=true
|
||||||
|
* These settings are available as of MySQL 5.5.14, and are defaults in
|
||||||
|
* MySQL 5.7.7 and up.
|
||||||
|
* - The PHP MySQL driver must support the utf8mb4 charset (libmysqlclient
|
||||||
|
* 5.5.3 and up, as well as mysqlnd 5.0.9 and up).
|
||||||
|
* - The MySQL server must support the utf8mb4 charset (5.5.3 and up).
|
||||||
|
*
|
||||||
* You can optionally set prefixes for some or all database table names
|
* You can optionally set prefixes for some or all database table names
|
||||||
* by using the 'prefix' setting. If a prefix is specified, the table
|
* by using the 'prefix' setting. If a prefix is specified, the table
|
||||||
* name will be prepended with its value. Be sure to use valid database
|
* name will be prepended with its value. Be sure to use valid database
|
||||||
|
@ -161,6 +243,21 @@ $conf['x_frame_options'] = '';
|
||||||
* );
|
* );
|
||||||
* @endcode
|
* @endcode
|
||||||
*/
|
*/
|
||||||
|
$databases = array (
|
||||||
|
'default' =>
|
||||||
|
array (
|
||||||
|
'default' =>
|
||||||
|
array (
|
||||||
|
'database' => '__DB_NAME__',
|
||||||
|
'username' => '__DB_USER__',
|
||||||
|
'password' => '__DB_PWD__',
|
||||||
|
'host' => 'localhost',
|
||||||
|
'port' => '5432',
|
||||||
|
'driver' => 'pgsql',
|
||||||
|
'prefix' => '',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access control for update.php script.
|
* Access control for update.php script.
|
||||||
|
@ -394,6 +491,23 @@ ini_set('session.cookie_lifetime', 2000000);
|
||||||
*/
|
*/
|
||||||
# $conf['block_cache_bypass_node_grants'] = TRUE;
|
# $conf['block_cache_bypass_node_grants'] = TRUE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expiration of cache_form entries:
|
||||||
|
*
|
||||||
|
* Drupal's Form API stores details of forms in cache_form and these entries are
|
||||||
|
* kept for at least 6 hours by default. Expired entries are cleared by cron.
|
||||||
|
* Busy sites can encounter problems with the cache_form table becoming very
|
||||||
|
* large. It's possible to mitigate this by setting a shorter expiration for
|
||||||
|
* cached forms. In some cases it may be desirable to set a longer cache
|
||||||
|
* expiration, for example to prolong cache_form entries for Ajax forms in
|
||||||
|
* cached HTML.
|
||||||
|
*
|
||||||
|
* @see form_set_cache()
|
||||||
|
* @see system_cron()
|
||||||
|
* @see ajax_get_form()
|
||||||
|
*/
|
||||||
|
# $conf['form_cache_expiration'] = 21600;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String overrides:
|
* String overrides:
|
||||||
*
|
*
|
||||||
|
@ -532,3 +646,37 @@ $conf['404_fast_html'] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
|
||||||
* Remove the leading hash sign to enable.
|
* Remove the leading hash sign to enable.
|
||||||
*/
|
*/
|
||||||
# $conf['theme_debug'] = TRUE;
|
# $conf['theme_debug'] = TRUE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CSS identifier double underscores allowance:
|
||||||
|
*
|
||||||
|
* To allow CSS identifiers to contain double underscores (.example__selector)
|
||||||
|
* for Drupal's BEM-style naming standards, uncomment the line below.
|
||||||
|
* Note that if you change this value in existing sites, existing page styles
|
||||||
|
* may be broken.
|
||||||
|
*
|
||||||
|
* @see drupal_clean_css_identifier()
|
||||||
|
*/
|
||||||
|
# $conf['allow_css_double_underscores'] = TRUE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default list of directories that will be ignored by Drupal's file API.
|
||||||
|
*
|
||||||
|
* By default ignore node_modules and bower_components folders to avoid issues
|
||||||
|
* with common frontend tools and recursive scanning of directories looking for
|
||||||
|
* extensions.
|
||||||
|
*
|
||||||
|
* @see file_scan_directory()
|
||||||
|
*/
|
||||||
|
$conf['file_scan_ignore_directories'] = array(
|
||||||
|
'node_modules',
|
||||||
|
'bower_components',
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn off the X-Frame-Options header entirely, to restore the previous
|
||||||
|
* behavior of allowing the site to be embedded in a frame on another site.
|
||||||
|
*/
|
||||||
|
$conf['x_frame_options'] = '';
|
||||||
|
|
||||||
|
$conf['file_temporary_path'] = '__FINALPATH__/sites/default/files/tmp';
|
||||||
|
|
|
@ -3,22 +3,62 @@ location __PATH__/ {
|
||||||
|
|
||||||
# Path to source
|
# Path to source
|
||||||
alias __FINALPATH__/ ;
|
alias __FINALPATH__/ ;
|
||||||
|
index index.php;
|
||||||
|
if (!-e $request_filename)
|
||||||
|
{
|
||||||
|
rewrite ^__PATH__/(.+)$ __PATH__/index.php?q=$1 last;
|
||||||
|
}
|
||||||
|
|
||||||
# Force usage of https
|
# Force usage of https
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
### Example PHP configuration (remove it if not used)
|
|
||||||
index index.php;
|
index index.php;
|
||||||
|
|
||||||
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
|
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
|
||||||
#client_max_body_size 50M;
|
#client_max_body_size 50M;
|
||||||
|
|
||||||
try_files $uri $uri/ index.php;
|
try_files $uri $uri/ index.php;
|
||||||
location ~ [^/]\.php(/|$) {
|
|
||||||
|
location ~ /favicon.ico {
|
||||||
|
log_not_found off;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /robots.txt {
|
||||||
|
allow all;
|
||||||
|
log_not_found off;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Very rarely should these ever be accessed outside of your lan
|
||||||
|
location ~* \.(txt|log)$ {
|
||||||
|
allow 192.168.0.0/16;
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Allow "Well-Known URIs" as per RFC 5785
|
||||||
|
location ~* ^/.well-known/ {
|
||||||
|
allow all;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Block access to "hidden" files and directories whose names begin with a
|
||||||
|
# period. This includes directories used by version control systems such
|
||||||
|
# as Subversion or Git to store control files.
|
||||||
|
location ~ (^|/)\. {
|
||||||
|
return 403;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Don't allow direct access to PHP files in the vendor directory.
|
||||||
|
location ~ /vendor/.*\.php$ {
|
||||||
|
deny all;
|
||||||
|
return 404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ '[^/]\.php$|^/update.php' {
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php/php7.2-fpm-__NAME__.sock;
|
||||||
|
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
|
@ -26,8 +66,28 @@ location __PATH__/ {
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||||
}
|
}
|
||||||
### End of PHP configuration part
|
|
||||||
|
# Fighting with Styles? This little gem is amazing.
|
||||||
|
location ~ ^/sites/.*/files/styles/ {
|
||||||
|
try_files $uri @rewrite;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Handle private files through Drupal. Private file's path can come
|
||||||
|
# with a language prefix.
|
||||||
|
location ~ ^(/[a-z\-]+)?/system/files/ {
|
||||||
|
try_files $uri /index.php?$query_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||||||
|
try_files $uri @rewrite;
|
||||||
|
expires max;
|
||||||
|
log_not_found off;
|
||||||
|
}
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location @rewrite {
|
||||||
|
rewrite ^/(.*)$ /index.php?q=$1;
|
||||||
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ group = __USER__
|
||||||
; (IPv6 and IPv4-mapped) on a specific port;
|
; (IPv6 and IPv4-mapped) on a specific port;
|
||||||
; '/path/to/unix/socket' - to listen on a unix socket.
|
; '/path/to/unix/socket' - to listen on a unix socket.
|
||||||
; Note: This value is mandatory.
|
; Note: This value is mandatory.
|
||||||
listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock
|
listen = /var/run/php/php7.2-fpm-__NAMETOCHANGE__.sock
|
||||||
|
|
||||||
; Set listen(2) backlog.
|
; Set listen(2) backlog.
|
||||||
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
|
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
|
||||||
|
|
37
conf/yoursite.aliases.drushrc.php
Normal file
37
conf/yoursite.aliases.drushrc.php
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @file yoursite.aliases.drushrc.php
|
||||||
|
* Site aliases for [your site domain]
|
||||||
|
* Place this file at ~/.drush/ (~/ means your home path)
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* To copy the development database to your local site:
|
||||||
|
* $ drush sql-sync @yoursite.dev @yoursite.local
|
||||||
|
* To copy your local database to the development site:
|
||||||
|
* $ drush sql-sync @yoursite.local @yoursite.dev --structure-tables-key=common --no-ordered-dump --sanitize=0 --no-cache
|
||||||
|
* To copy the production database to your local site:
|
||||||
|
* $ drush sql-sync @yoursite.prod @yoursite.local
|
||||||
|
* To copy all files in development site to your local site:
|
||||||
|
* $ drush rsync @yoursite.dev:%files @yoursite.local:%files
|
||||||
|
* Clear the cache in production:
|
||||||
|
* $ drush @yoursite.prod clear-cache all
|
||||||
|
*
|
||||||
|
* You can copy the site alias configuration of an existing site into a file
|
||||||
|
* with the following commands:
|
||||||
|
* $ cd /path/to/settings.php/of/the/site/
|
||||||
|
* $ drush site-alias @self --full --with-optional >> ~/.drush/mysite.aliases.drushrc.php
|
||||||
|
* Then edit that file to wrap the code in <?php ?> tags.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local alias
|
||||||
|
* Set the root and site_path values to point to your local site
|
||||||
|
*/
|
||||||
|
$aliases['__APP__'] = array(
|
||||||
|
'root' => '__FINALPATH__/__APP__/',
|
||||||
|
'uri' => 'https://__DOMAIN____PATH_URL__',
|
||||||
|
'path-aliases' => array(
|
||||||
|
'%dump-dir' => '/tmp',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
?>
|
|
@ -42,12 +42,13 @@
|
||||||
"default": "/poll"
|
"default": "/poll"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "password",
|
||||||
|
"type": "password",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose an admin user"
|
"en": "Set the administrator password",
|
||||||
|
"fr": "Définissez le mot de passe administrateur"
|
||||||
},
|
},
|
||||||
"type": "user",
|
"example": "Choose a password"
|
||||||
"example": "johndoe"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# dependencies used by the app
|
# dependencies used by the app
|
||||||
pkg_dependencies="postgresql php-pgsql php-mbstring"
|
pkg_dependencies="postgresql curl libzip-dev"
|
||||||
|
extra_pkg_dependencies="php7.2-fpm php7.2-cli php7.2-gd php7.2-mysql php7.2-xml php7.2-ldap php7.2-mbstring php7.2-uploadprogress php7.2-pgsql"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
|
@ -42,3 +43,6 @@ ynh_save_args () {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
source ynh_add_extra_apt_repos__3
|
||||||
|
source ynh_install_php__3
|
||||||
|
source ynh_composer__2
|
||||||
|
|
|
@ -81,7 +81,16 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC MODIFICATIONS
|
# SPECIFIC MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# ...
|
# UPDATE DRUSH ALIAS
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info --message="Updating Drush alias..."
|
||||||
|
|
||||||
|
cp -f "../conf/yoursite.aliases.drushrc.php" "$final_path/.drush/$app.aliases.drushrc.php"
|
||||||
|
|
||||||
|
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
|
||||||
|
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
|
||||||
|
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$new_domain" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
|
||||||
|
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$new_path" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
135
scripts/install
135
scripts/install
|
@ -20,35 +20,15 @@ ynh_abort_if_errors
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_export domain path_url admin is_public
|
ynh_export domain path_url password is_public
|
||||||
|
|
||||||
# This is 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 you are interested the 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
|
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
|
||||||
#=================================================
|
#=================================================
|
||||||
### About --weight and --time
|
|
||||||
### ynh_script_progression will show to your final users the progression of each scripts.
|
|
||||||
### In order to do that, --weight will represent the relative time of execution compared to the other steps in the script.
|
|
||||||
### --time is a packager option, it will show you the execution time since the previous call.
|
|
||||||
### This option should be removed before releasing your app.
|
|
||||||
### Use the execution time, given by --time, to estimate the weight of a step.
|
|
||||||
### A common way to do it is to set a weight equal to the execution time in second +1.
|
|
||||||
### The execution time is given for the duration since the previous call. So the weight should be applied to this previous call.
|
|
||||||
ynh_script_progression --message="Validating installation parameters..." --time --weight=1
|
ynh_script_progression --message="Validating installation parameters..." --time --weight=1
|
||||||
|
|
||||||
### 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
|
final_path=/var/www/$app
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||||
|
|
||||||
|
@ -58,9 +38,9 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..." --time --weight=1
|
ynh_script_progression --message="Storing installation settings..." --time --weight=2
|
||||||
|
|
||||||
ynh_save_args domain path_url admin is_public final_path
|
ynh_save_args domain path_url password is_public final_path
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -68,22 +48,14 @@ ynh_save_args domain path_url admin is_public final_path
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installing dependencies..." --time --weight=1
|
ynh_script_progression --message="Installing dependencies..." --time --weight=7
|
||||||
|
|
||||||
### `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
|
|
||||||
### - Remove the variable "pkg_dependencies" in _common.sh
|
|
||||||
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
|
||||||
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A PostgreSQL DATABASE
|
# CREATE A PostgreSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a PostgreSQL database..." --time --weight=1
|
ynh_script_progression --message="Creating a PostgreSQL database..." --time --weight=2
|
||||||
|
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run
|
||||||
|
|
||||||
|
@ -95,7 +67,7 @@ ynh_psql_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..." --time --weight=1
|
ynh_script_progression --message="Setting up source files..." --time --weight=12
|
||||||
|
|
||||||
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
|
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
|
||||||
### downloaded from an upstream source, like a git repository.
|
### downloaded from an upstream source, like a git repository.
|
||||||
|
@ -107,7 +79,7 @@ ynh_setup_source --dest_dir="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring nginx web server..." --time --weight=1
|
ynh_script_progression --message="Configuring nginx web server..." --time --weight=2
|
||||||
|
|
||||||
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
||||||
|
|
||||||
|
@ -117,41 +89,84 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring system user..." --time --weight=1
|
ynh_script_progression --message="Configuring system user..." --time --weight=2
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create --username=$app
|
ynh_system_user_create --username=$app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL PHP 7.2
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installing PHP 7.2..." --time --weight=10
|
||||||
|
|
||||||
|
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring php-fpm..." --time --weight=1
|
ynh_script_progression --message="Configuring php-fpm..." --time --weight=2
|
||||||
|
|
||||||
### `ynh_add_fpm_config` is used to set up a PHP config.
|
|
||||||
### You can remove it if your app doesn't use PHP.
|
|
||||||
### `ynh_add_fpm_config` will use the files conf/php-fpm.conf
|
|
||||||
### If you're not using these lines:
|
|
||||||
### - You can remove these files in conf/.
|
|
||||||
### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script
|
|
||||||
### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script
|
|
||||||
### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script
|
|
||||||
### With the reload at the end of the script.
|
|
||||||
### - And the section "PHP-FPM CONFIGURATION" in the upgrade script
|
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config --phpversion="7.2"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
|
#=================================================
|
||||||
|
# CREATE DRUSH ALIAS
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Creating Drush alias..." --time --weight=2
|
||||||
|
|
||||||
|
mkdir -p "$final_path/.drush"
|
||||||
|
|
||||||
|
cp -f "../conf/yoursite.aliases.drushrc.php" "$final_path/.drush/$app.aliases.drushrc.php"
|
||||||
|
|
||||||
|
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
|
||||||
|
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
|
||||||
|
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
|
||||||
|
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL COMPOSER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installing Composer..." --time --weight=8
|
||||||
|
|
||||||
|
mkdir -p "$final_path/.composer"
|
||||||
|
|
||||||
|
cp -f "../conf/composer.json" "$final_path/.composer/composer.json"
|
||||||
|
|
||||||
|
ynh_install_composer --phpversion="7.2" --workdir="$final_path/.composer"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Database initialization
|
# Database initialization
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Initializing PostgreSQL database..." --time --weight=1
|
ynh_script_progression --message="Initializing PostgreSQL database..." --time --weight=8
|
||||||
|
|
||||||
ynh_replace_string "betaforms" "$db_user" "$final_path/framaforms.sql"
|
ynh_replace_string "betaforms" "$db_user" "$final_path/framaforms.sql"
|
||||||
|
|
||||||
ynh_psql_execute_file_as_root "$final_path/framaforms.sql" "$db_name"
|
ynh_psql_execute_file_as_root "$final_path/framaforms.sql" "$db_name"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
# Initialize tmp and private directory
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Initializing tmp and private directory..." --time --weight=8
|
||||||
|
|
||||||
|
mkdir -p "$final_path/sites/default/files"
|
||||||
|
chmod 2775 "$final_path/sites/default/files"
|
||||||
|
mkdir -p "$final_path/sites/default/files/tmp"
|
||||||
|
|
||||||
|
mkdir -p "${final_path}_private"
|
||||||
|
chown -R $app: "${final_path}_private"
|
||||||
|
chmod 775 "${final_path}_private"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# Missing images
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Adding missing images..." --time --weight=2
|
||||||
|
|
||||||
|
mkdir -p "$final_path/sites/default/files/imgforms"
|
||||||
|
|
||||||
|
cp ../sources/anim_analyse.gif "$final_path/sites/default/files/imgforms/"
|
||||||
|
cp ../sources/anim_creation.gif "$final_path/sites/default/files/imgforms/"
|
||||||
|
cp ../sources/partager.png "$final_path/sites/default/files/imgforms/"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY CONFIG FILES
|
# MODIFY CONFIG FILES
|
||||||
|
@ -163,6 +178,24 @@ cp ../conf/default.settings.php "$config_file"
|
||||||
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config_file"
|
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config_file"
|
||||||
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$config_file"
|
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$config_file"
|
||||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config_file"
|
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config_file"
|
||||||
|
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$config_file"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# Change admin password and apply custom conf
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Changing admin password..." --time --weight=2
|
||||||
|
|
||||||
|
chown -R $app: $final_path
|
||||||
|
pushd $final_path
|
||||||
|
sudo -u $app $final_path/.composer/vendor/bin/drush upwd --password="$password" "admin"
|
||||||
|
sudo -u $app $final_path/.composer/vendor/bin/drush variable-set site_name "Framaforms"
|
||||||
|
sudo -u $app $final_path/.composer/vendor/bin/drush variable-set site_mail "no-reply@$domain"
|
||||||
|
#sudo -u $app $final_path/.composer/vendor/bin/drush @$app pm-download ldap
|
||||||
|
#sudo -u $app $final_path/.composer/vendor/bin/drush @$app pm-enable -y ldap_servers ldap_user ldap_authentication ldap_authorization ldap_authorization_drupal_role
|
||||||
|
#sudo -u $app $final_path/.composer/vendor/bin/drush @$app core-cron
|
||||||
|
popd
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
|
|
|
@ -66,6 +66,19 @@ ynh_remove_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC REMOVE
|
# SPECIFIC REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
# REMOVE THE CRON FILE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing the cron file..." --weight=1
|
||||||
|
|
||||||
|
# Remove a cron file
|
||||||
|
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE PHP
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing php..." --weight=1
|
||||||
|
|
||||||
|
ynh_remove_php
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
|
@ -43,6 +43,15 @@ test ! -d $final_path \
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
# RECREATE THE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info --message="Recreating the dedicated system user..."
|
||||||
|
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE ALL FILES
|
||||||
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring all files..." --time --weight=1
|
ynh_script_progression --message="Restoring all files..." --time --weight=1
|
||||||
|
|
||||||
ynh_restore
|
ynh_restore
|
||||||
|
@ -64,6 +73,14 @@ ynh_script_progression --message="Reinstalling dependencies..." --time --weight=
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REINSTALL PHP
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info --message="Reinstalling php..."
|
||||||
|
|
||||||
|
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE DATABASE
|
# RESTORE THE DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -71,7 +88,7 @@ ynh_script_progression --message="Restoring the database..." --time --weight=1
|
||||||
|
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||||
ynh_psql_execute_file_as_root ./db.sql "$db_name"
|
ynh_psql_execute_file_as_root ./db.sql "$db_name"
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
|
||||||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
@ -124,18 +123,45 @@ ynh_script_progression --message="Making sure dedicated system user exists..." -
|
||||||
# Create a dedicated user (if not existing)
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$app
|
ynh_system_user_create --username=$app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE PHP
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading PHP..." --weight=1
|
||||||
|
|
||||||
|
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading php-fpm configuration..." --time --weight=1
|
ynh_script_progression --message="Upgrading php-fpm configuration..." --time --weight=1
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config --phpversion="7.2"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
# ...
|
# UPGRADE COMPOSER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading Composer..." --weight=1
|
||||||
|
|
||||||
|
ynh_install_composer --phpversion="7.2" --workdir="$final_path/.composer"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE DRUPAL
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading Drupal..." --weight=1
|
||||||
|
|
||||||
|
ynh_backup_if_checksum_is_different --file="$final_path/$app/sites/default/settings.php"
|
||||||
|
|
||||||
|
sudo -u $app $final_path/.composer/vendor/bin/drush @$app variable-set --exact maintenance_mode 1
|
||||||
|
sudo -u $app $final_path/.composer/vendor/bin/drush @$app cache-clear all
|
||||||
|
sudo -u $app $final_path/.composer/vendor/bin/drush @$app pm-update -y drupal
|
||||||
|
sudo -u $app $final_path/.composer/vendor/bin/drush @$app vset --exact maintenance_mode 0
|
||||||
|
sudo -u $app $final_path/.composer/vendor/bin/drush @$app cache-clear all
|
||||||
|
sudo -u $app $final_path/.composer/vendor/bin/drush @$app l10n-update-refresh
|
||||||
|
sudo -u $app $final_path/.composer/vendor/bin/drush @$app l10n-update
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -143,9 +169,6 @@ ynh_add_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
config_file=$final_path/sites/default/settings.php
|
config_file=$final_path/sites/default/settings.php
|
||||||
|
|
||||||
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
|
||||||
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
|
||||||
ynh_backup_if_checksum_is_different --file="$config_file"
|
|
||||||
# Recalculate and store the checksum of the file for the next upgrade.
|
# Recalculate and store the checksum of the file for the next upgrade.
|
||||||
ynh_store_file_checksum --file="$config_file"
|
ynh_store_file_checksum --file="$config_file"
|
||||||
|
|
||||||
|
|
294
scripts/ynh_add_extra_apt_repos__3
Normal file
294
scripts/ynh_add_extra_apt_repos__3
Normal file
|
@ -0,0 +1,294 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Pin a repository.
|
||||||
|
#
|
||||||
|
# usage: ynh_pin_repo --package=packages --pin=pin_filter [--priority=priority_value] [--name=name] [--append]
|
||||||
|
# | arg: -p, --package - Packages concerned by the pin. Or all, *.
|
||||||
|
# | arg: -i, --pin - Filter for the pin.
|
||||||
|
# | arg: -p, --priority - Priority for the pin
|
||||||
|
# | arg: -n, --name - Name for the files for this repo, $app as default value.
|
||||||
|
# | arg: -a, --append - Do not overwrite existing files.
|
||||||
|
#
|
||||||
|
# See https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html for information about pinning.
|
||||||
|
#
|
||||||
|
ynh_pin_repo () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=pirna
|
||||||
|
declare -Ar args_array=( [p]=package= [i]=pin= [r]=priority= [n]=name= [a]=append )
|
||||||
|
local package
|
||||||
|
local pin
|
||||||
|
local priority
|
||||||
|
local name
|
||||||
|
local append
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
package="${package:-*}"
|
||||||
|
priority=${priority:-50}
|
||||||
|
name="${name:-$app}"
|
||||||
|
append=${append:-0}
|
||||||
|
|
||||||
|
if [ $append -eq 1 ]
|
||||||
|
then
|
||||||
|
append="tee -a"
|
||||||
|
else
|
||||||
|
append="tee"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "/etc/apt/preferences.d"
|
||||||
|
echo "Package: $package
|
||||||
|
Pin: $pin
|
||||||
|
Pin-Priority: $priority" \
|
||||||
|
| $append "/etc/apt/preferences.d/$name"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add a repository.
|
||||||
|
#
|
||||||
|
# usage: ynh_add_repo --uri=uri --suite=suite --component=component [--name=name] [--append]
|
||||||
|
# | arg: -u, --uri - Uri of the repository.
|
||||||
|
# | arg: -s, --suite - Suite of the repository.
|
||||||
|
# | arg: -c, --component - Component of the repository.
|
||||||
|
# | arg: -n, --name - Name for the files for this repo, $app as default value.
|
||||||
|
# | arg: -a, --append - Do not overwrite existing files.
|
||||||
|
#
|
||||||
|
# Example for a repo like deb http://forge.yunohost.org/debian/ stretch stable
|
||||||
|
# uri suite component
|
||||||
|
# ynh_add_repo --uri=http://forge.yunohost.org/debian/ --suite=stretch --component=stable
|
||||||
|
#
|
||||||
|
ynh_add_repo () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=uscna
|
||||||
|
declare -Ar args_array=( [u]=uri= [s]=suite= [c]=component= [n]=name= [a]=append )
|
||||||
|
local uri
|
||||||
|
local suite
|
||||||
|
local component
|
||||||
|
local name
|
||||||
|
local append
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
name="${name:-$app}"
|
||||||
|
append=${append:-0}
|
||||||
|
|
||||||
|
if [ $append -eq 1 ]
|
||||||
|
then
|
||||||
|
append="tee -a"
|
||||||
|
else
|
||||||
|
append="tee"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "/etc/apt/sources.list.d"
|
||||||
|
# Add the new repo in sources.list.d
|
||||||
|
echo "deb $uri $suite $component" \
|
||||||
|
| $append "/etc/apt/sources.list.d/$name.list"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add an extra repository correctly, pin it and get the key.
|
||||||
|
#
|
||||||
|
# usage: ynh_install_extra_repo --repo="repo" [--key=key_url] [--priority=priority_value] [--name=name] [--append]
|
||||||
|
# | arg: -r, --repo - Complete url of the extra repository.
|
||||||
|
# | arg: -k, --key - url to get the public key.
|
||||||
|
# | arg: -p, --priority - Priority for the pin
|
||||||
|
# | arg: -n, --name - Name for the files for this repo, $app as default value.
|
||||||
|
# | arg: -a, --append - Do not overwrite existing files.
|
||||||
|
ynh_install_extra_repo () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=rkpna
|
||||||
|
declare -Ar args_array=( [r]=repo= [k]=key= [p]=priority= [n]=name= [a]=append )
|
||||||
|
local repo
|
||||||
|
local key
|
||||||
|
local priority
|
||||||
|
local name
|
||||||
|
local append
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
name="${name:-$app}"
|
||||||
|
append=${append:-0}
|
||||||
|
key=${key:-0}
|
||||||
|
priority=${priority:-}
|
||||||
|
|
||||||
|
if [ $append -eq 1 ]
|
||||||
|
then
|
||||||
|
append="--append"
|
||||||
|
wget_append="tee -a"
|
||||||
|
else
|
||||||
|
append=""
|
||||||
|
wget_append="tee"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split the repository into uri, suite and components.
|
||||||
|
# Remove "deb " at the beginning of the repo.
|
||||||
|
repo="${repo#deb }"
|
||||||
|
|
||||||
|
# Get the uri
|
||||||
|
local uri="$(echo "$repo" | awk '{ print $1 }')"
|
||||||
|
|
||||||
|
# Get the suite
|
||||||
|
local suite="$(echo "$repo" | awk '{ print $2 }')"
|
||||||
|
|
||||||
|
# Get the components
|
||||||
|
local component="${repo##$uri $suite }"
|
||||||
|
|
||||||
|
# Add the repository into sources.list.d
|
||||||
|
ynh_add_repo --uri="$uri" --suite="$suite" --component="$component" --name="$name" $append
|
||||||
|
|
||||||
|
# Pin the new repo with the default priority, so it won't be used for upgrades.
|
||||||
|
# Build $pin from the uri without http and any sub path
|
||||||
|
local pin="${uri#*://}"
|
||||||
|
pin="${pin%%/*}"
|
||||||
|
# Set a priority only if asked
|
||||||
|
if [ -n "$priority" ]
|
||||||
|
then
|
||||||
|
priority="--priority=$priority"
|
||||||
|
fi
|
||||||
|
ynh_pin_repo --package="*" --pin="origin \"$pin\"" $priority --name="$name" $append
|
||||||
|
|
||||||
|
# Get the public key for the repo
|
||||||
|
if [ -n "$key" ]
|
||||||
|
then
|
||||||
|
mkdir -p "/etc/apt/trusted.gpg.d"
|
||||||
|
wget -q "$key" -O - | gpg --dearmor | $wget_append /etc/apt/trusted.gpg.d/$name.gpg > /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update the list of package with the new repo
|
||||||
|
ynh_package_update
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove an extra repository and the assiociated configuration.
|
||||||
|
#
|
||||||
|
# usage: ynh_remove_extra_repo [--name=name]
|
||||||
|
# | arg: -n, --name - Name for the files for this repo, $app as default value.
|
||||||
|
ynh_remove_extra_repo () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=n
|
||||||
|
declare -Ar args_array=( [n]=name= )
|
||||||
|
local name
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
name="${name:-$app}"
|
||||||
|
|
||||||
|
ynh_secure_remove "/etc/apt/sources.list.d/$name.list"
|
||||||
|
ynh_secure_remove "/etc/apt/preferences.d/$name"
|
||||||
|
ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.gpg"
|
||||||
|
ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.asc"
|
||||||
|
|
||||||
|
# Update the list of package to exclude the old repo
|
||||||
|
ynh_package_update
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install packages from an extra repository properly.
|
||||||
|
#
|
||||||
|
# usage: ynh_install_extra_app_dependencies --repo="repo" --package="dep1 dep2" [--key=key_url] [--name=name]
|
||||||
|
# | arg: -r, --repo - Complete url of the extra repository.
|
||||||
|
# | arg: -p, --package - The packages to install from this extra repository
|
||||||
|
# | arg: -k, --key - url to get the public key.
|
||||||
|
# | arg: -n, --name - Name for the files for this repo, $app as default value.
|
||||||
|
ynh_install_extra_app_dependencies () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=rpkn
|
||||||
|
declare -Ar args_array=( [r]=repo= [p]=package= [k]=key= [n]=name= )
|
||||||
|
local repo
|
||||||
|
local package
|
||||||
|
local key
|
||||||
|
local name
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
name="${name:-$app}"
|
||||||
|
key=${key:-0}
|
||||||
|
|
||||||
|
# Set a key only if asked
|
||||||
|
if [ -n "$key" ]
|
||||||
|
then
|
||||||
|
key="--key=$key"
|
||||||
|
fi
|
||||||
|
# Add an extra repository for those packages
|
||||||
|
ynh_install_extra_repo --repo="$repo" $key --priority=995 --name=$name
|
||||||
|
|
||||||
|
# Install requested dependencies from this extra repository.
|
||||||
|
ynh_add_app_dependencies --package="$package"
|
||||||
|
|
||||||
|
# Remove this extra repository after packages are installed
|
||||||
|
ynh_remove_extra_repo --name=$app
|
||||||
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# patched version of ynh_install_app_dependencies to be used with ynh_add_app_dependencies
|
||||||
|
|
||||||
|
# Define and install dependencies with a equivs control file
|
||||||
|
# This helper can/should only be called once per app
|
||||||
|
#
|
||||||
|
# usage: ynh_install_app_dependencies dep [dep [...]]
|
||||||
|
# | arg: dep - the package name to install in dependence
|
||||||
|
# You can give a choice between some package with this syntax : "dep1|dep2"
|
||||||
|
# Example : ynh_install_app_dependencies dep1 dep2 "dep3|dep4|dep5"
|
||||||
|
# This mean in the dependence tree : dep1 & dep2 & (dep3 | dep4 | dep5)
|
||||||
|
#
|
||||||
|
# Requires YunoHost version 2.6.4 or higher.
|
||||||
|
ynh_install_app_dependencies () {
|
||||||
|
local dependencies=$@
|
||||||
|
dependencies="$(echo "$dependencies" | sed 's/\([^\<=\>]\)\ \([^(]\)/\1, \2/g')"
|
||||||
|
dependencies=${dependencies//|/ | }
|
||||||
|
local manifest_path="../manifest.json"
|
||||||
|
if [ ! -e "$manifest_path" ]; then
|
||||||
|
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
|
||||||
|
fi
|
||||||
|
|
||||||
|
local version=$(grep '\"version\": ' "$manifest_path" | cut -d '"' -f 4) # Retrieve the version number in the manifest file.
|
||||||
|
if [ ${#version} -eq 0 ]; then
|
||||||
|
version="1.0"
|
||||||
|
fi
|
||||||
|
local dep_app=${app//_/-} # Replace all '_' by '-'
|
||||||
|
|
||||||
|
# Handle specific versions
|
||||||
|
if [[ "$dependencies" =~ [\<=\>] ]]
|
||||||
|
then
|
||||||
|
# Replace version specifications by relationships syntax
|
||||||
|
# https://www.debian.org/doc/debian-policy/ch-relationships.html
|
||||||
|
# Sed clarification
|
||||||
|
# [^(\<=\>] ignore if it begins by ( or < = >. To not apply twice.
|
||||||
|
# [\<=\>] matches < = or >
|
||||||
|
# \+ matches one or more occurence of the previous characters, for >= or >>.
|
||||||
|
# [^,]\+ matches all characters except ','
|
||||||
|
# Ex: package>=1.0 will be replaced by package (>= 1.0)
|
||||||
|
dependencies="$(echo "$dependencies" | sed 's/\([^(\<=\>]\)\([\<=\>]\+\)\([^,]\+\)/\1 (\2 \3)/g')"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat > /tmp/${dep_app}-ynh-deps.control << EOF # Make a control file for equivs-build
|
||||||
|
Section: misc
|
||||||
|
Priority: optional
|
||||||
|
Package: ${dep_app}-ynh-deps
|
||||||
|
Version: ${version}
|
||||||
|
Depends: ${dependencies}
|
||||||
|
Architecture: all
|
||||||
|
Description: Fake package for $app (YunoHost app) dependencies
|
||||||
|
This meta-package is only responsible of installing its dependencies.
|
||||||
|
EOF
|
||||||
|
ynh_package_install_from_equivs /tmp/${dep_app}-ynh-deps.control \
|
||||||
|
|| ynh_die --message="Unable to install dependencies" # Install the fake package and its dependencies
|
||||||
|
rm /tmp/${dep_app}-ynh-deps.control
|
||||||
|
ynh_app_setting_set --app=$app --key=apt_dependencies --value="$dependencies"
|
||||||
|
}
|
||||||
|
|
||||||
|
ynh_add_app_dependencies () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=pr
|
||||||
|
declare -Ar args_array=( [p]=package= [r]=replace)
|
||||||
|
local package
|
||||||
|
local replace
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
replace=${replace:-0}
|
||||||
|
|
||||||
|
local current_dependencies=""
|
||||||
|
if [ $replace -eq 0 ]
|
||||||
|
then
|
||||||
|
local dep_app=${app//_/-} # Replace all '_' by '-'
|
||||||
|
if ynh_package_is_installed --package="${dep_app}-ynh-deps"
|
||||||
|
then
|
||||||
|
current_dependencies="$(dpkg-query --show --showformat='${Depends}' ${dep_app}-ynh-deps) "
|
||||||
|
fi
|
||||||
|
|
||||||
|
current_dependencies=${current_dependencies// | /|}
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_install_app_dependencies "${current_dependencies}${package}"
|
||||||
|
}
|
46
scripts/ynh_composer__2
Normal file
46
scripts/ynh_composer__2
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Execute a command with Composer
|
||||||
|
#
|
||||||
|
# usage: ynh_composer_exec --phpversion=phpversion [--workdir=$final_path] --commands="commands"
|
||||||
|
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
|
||||||
|
# | arg: -c, --commands - Commands to execute.
|
||||||
|
ynh_composer_exec () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=vwc
|
||||||
|
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [c]=commands= )
|
||||||
|
local phpversion
|
||||||
|
local workdir
|
||||||
|
local commands
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
workdir="${workdir:-$final_path}"
|
||||||
|
|
||||||
|
COMPOSER_HOME="$workdir/.composer" \
|
||||||
|
php${phpversion} "$workdir/composer.phar" $commands \
|
||||||
|
-d "$workdir" --quiet --no-interaction
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install and initialize Composer in the given directory
|
||||||
|
#
|
||||||
|
# usage: ynh_install_composer --phpversion=phpversion [--workdir=$final_path]
|
||||||
|
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
|
||||||
|
ynh_install_composer () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=vw
|
||||||
|
declare -Ar args_array=( [v]=phpversion= [w]=workdir= )
|
||||||
|
local phpversion
|
||||||
|
local workdir
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
workdir="${workdir:-$final_path}"
|
||||||
|
|
||||||
|
curl -sS https://getcomposer.org/installer \
|
||||||
|
| COMPOSER_HOME="$workdir/.composer" \
|
||||||
|
php${phpversion} -- --quiet --install-dir="$workdir" \
|
||||||
|
|| ynh_die "Unable to install Composer."
|
||||||
|
|
||||||
|
# update dependencies to create composer.lock
|
||||||
|
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev" \
|
||||||
|
|| ynh_die "Unable to update core dependencies with Composer."
|
||||||
|
}
|
77
scripts/ynh_install_php__3
Normal file
77
scripts/ynh_install_php__3
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Install another version of php.
|
||||||
|
#
|
||||||
|
# usage: ynh_install_php --phpversion=phpversion [--package=packages]
|
||||||
|
# | arg: -v, --phpversion - Version of php to install. Can be one of 7.1, 7.2 or 7.3
|
||||||
|
# | arg: -p, --package - Additionnal php packages to install
|
||||||
|
ynh_install_php () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=vp
|
||||||
|
declare -Ar args_array=( [v]=phpversion= [p]=package= )
|
||||||
|
local phpversion
|
||||||
|
local package
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
package=${package:-}
|
||||||
|
|
||||||
|
# Store php_version into the config of this app
|
||||||
|
ynh_app_setting_set $app php_version $phpversion
|
||||||
|
|
||||||
|
if [ "$phpversion" == "7.0" ]
|
||||||
|
then
|
||||||
|
ynh_die "Do not use ynh_install_php to install php7.0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Store the ID of this app and the version of php requested for it
|
||||||
|
echo "$YNH_APP_INSTANCE_NAME:$phpversion" | tee --append "/etc/php/ynh_app_version"
|
||||||
|
|
||||||
|
# Add an extra repository for those packages
|
||||||
|
ynh_install_extra_repo --repo="https://packages.sury.org/php/ $(lsb_release -sc) main" --key="https://packages.sury.org/php/apt.gpg" --priority=995 --name=extra_php_version
|
||||||
|
|
||||||
|
# Install requested dependencies from this extra repository.
|
||||||
|
# Install php-fpm first, otherwise php will install apache as a dependency.
|
||||||
|
ynh_add_app_dependencies --package="php${phpversion}-fpm"
|
||||||
|
ynh_add_app_dependencies --package="php$phpversion php${phpversion}-common $package"
|
||||||
|
|
||||||
|
# Set php7.0 back as the default version for php-cli.
|
||||||
|
update-alternatives --set php /usr/bin/php7.0
|
||||||
|
|
||||||
|
# Remove this extra repository after packages are installed
|
||||||
|
ynh_remove_extra_repo --name=extra_php_version
|
||||||
|
|
||||||
|
# Advertise service in admin panel
|
||||||
|
yunohost service add php${phpversion}-fpm --log "/var/log/php${phpversion}-fpm.log"
|
||||||
|
}
|
||||||
|
|
||||||
|
ynh_remove_php () {
|
||||||
|
# Get the version of php used by this app
|
||||||
|
local phpversion=$(ynh_app_setting_get $app php_version)
|
||||||
|
|
||||||
|
if [ "$phpversion" == "7.0" ] || [ -z "$phpversion" ]
|
||||||
|
then
|
||||||
|
if [ "$phpversion" == "7.0" ]
|
||||||
|
then
|
||||||
|
ynh_print_err "Do not use ynh_remove_php to install php7.0"
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove the line for this app
|
||||||
|
sed --in-place "/$YNH_APP_INSTANCE_NAME:$phpversion/d" "/etc/php/ynh_app_version"
|
||||||
|
|
||||||
|
# If no other app uses this version of php, remove it.
|
||||||
|
if ! grep --quiet "$phpversion" "/etc/php/ynh_app_version"
|
||||||
|
then
|
||||||
|
# Purge php dependences for this version.
|
||||||
|
ynh_package_autopurge "php$phpversion php${phpversion}-fpm php${phpversion}-common"
|
||||||
|
# Remove the service from the admin panel
|
||||||
|
yunohost service remove php${phpversion}-fpm
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If no other app uses alternate php versions, remove the extra repo for php
|
||||||
|
if [ ! -s "/etc/php/ynh_app_version" ]
|
||||||
|
then
|
||||||
|
ynh_secure_remove /etc/php/ynh_app_version
|
||||||
|
fi
|
||||||
|
}
|
BIN
sources/anim_analyse.gif
Normal file
BIN
sources/anim_analyse.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 60 KiB |
BIN
sources/anim_creation.gif
Normal file
BIN
sources/anim_creation.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 150 KiB |
BIN
sources/partager.png
Normal file
BIN
sources/partager.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
Loading…
Reference in a new issue