mirror of
https://github.com/YunoHost-Apps/framaforms_ynh.git
synced 2024-09-03 18:36:12 +02:00
Merge pull request #7 from YunoHost-Apps/testing
Apply new example_ynh template
This commit is contained in:
commit
777619302c
5 changed files with 63 additions and 49 deletions
|
@ -4,19 +4,22 @@
|
|||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
password="password"
|
||||
is_public=1 (PUBLIC|public=1|private=0)
|
||||
password="password"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=0
|
||||
setup_public=0
|
||||
upgrade=0
|
||||
backup_restore=0
|
||||
multi_instance=0
|
||||
change_url=0
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
# This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version.
|
||||
# incorrect_path=1
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Levels
|
||||
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
|
||||
Level 5=auto
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
* Set the root and site_path values to point to your local site
|
||||
*/
|
||||
$aliases['__APP__'] = array(
|
||||
'root' => '__FINALPATH__/__APP__/',
|
||||
'root' => '__FINALPATH__/',
|
||||
'uri' => 'https://__DOMAIN____PATH_URL__',
|
||||
'path-aliases' => array(
|
||||
'%dump-dir' => '/tmp',
|
||||
|
|
|
@ -73,10 +73,6 @@ ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
|||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=9
|
||||
|
||||
### `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.
|
||||
### `ynh_setup_source` use the file conf/app.src
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
|
@ -85,8 +81,6 @@ ynh_setup_source --dest_dir="$final_path"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring nginx web server..." --weight=1
|
||||
|
||||
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
|
@ -96,7 +90,8 @@ ynh_add_nginx_config
|
|||
ynh_script_progression --message="Configuring system user..." --weight=3
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
|
||||
#=================================================
|
||||
# INSTALL PHP 7.2
|
||||
|
@ -140,6 +135,8 @@ cp -f "../conf/composer.json" "$final_path/.composer/composer.json"
|
|||
|
||||
ynh_install_composer --phpversion="7.2" --workdir="$final_path/.composer"
|
||||
|
||||
export PATH="$final_path/.composer/vendor/bin:$PATH"
|
||||
|
||||
#=================================================
|
||||
# Database initialization
|
||||
#=================================================
|
||||
|
@ -190,27 +187,32 @@ ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path"
|
|||
ynh_script_progression --message="Changing admin password..." --weight=19
|
||||
|
||||
chown -R $app: $final_path
|
||||
drush="$final_path/.composer/vendor/bin/drush --quiet"
|
||||
pushd $final_path
|
||||
ynh_exec_as $app $drush upwd --password="$password" "admin" --verbose --debug
|
||||
ynh_exec_as $app $drush variable-set site_name "Framaforms" --verbose --debug
|
||||
ynh_exec_as $app $drush variable-set site_mail "no-reply@$domain" --verbose --debug
|
||||
ynh_exec_as $app $drush variable-set file_private_path "/home/yunohost.app/$app/data" --verbose --debug
|
||||
#ynh_exec_as $app $drush @$app pm-download ldap
|
||||
#ynh_exec_as $app $drush @$app pm-enable -y ldap_servers ldap_user ldap_authentication ldap_authorization ldap_authorization_drupal_role
|
||||
#ynh_exec_as $app $drush @$app core-cron
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
update-alternatives --set php /usr/bin/php7.2
|
||||
|
||||
ynh_exec_as $app env PATH=$PATH drush @$app upwd --password="$password" "admin" 2>&1
|
||||
ynh_exec_as $app env PATH=$PATH drush @$app variable-set site_name "Framaforms" 2>&1
|
||||
ynh_exec_as $app env PATH=$PATH drush @$app variable-set site_mail "no-reply@$domain" 2>&1
|
||||
ynh_exec_as $app env PATH=$PATH drush @$app variable-set file_private_path "/home/yunohost.app/$app/data" 2>&1
|
||||
|
||||
# Remove some Framasoft branding
|
||||
ynh_exec_as $app env PATH=$PATH drush @$app sql-query "UPDATE block_custom SET body='' WHERE bid=12" 2>&1
|
||||
|
||||
# Fix some link if install on subpath
|
||||
ynh_exec_as $app env PATH=$PATH drush @$app sql-query "UPDATE block_custom SET body=REPLACE(body, 'href=\"/', 'href=\"')" 2>&1
|
||||
ynh_exec_as $app env PATH=$PATH drush @$app sql-query "UPDATE field_data_body SET body_value=REPLACE(body_value, 'src=\"/', 'src=\"')" 2>&1
|
||||
ynh_exec_as $app env PATH=$PATH drush @$app sql-query "UPDATE field_data_body SET body_value=REPLACE(body_value, 'href=\"/', 'href=\"')" 2>&1
|
||||
ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all 2>&1
|
||||
#ynh_exec_as $app env PATH=$PATH drush @$app pm-download ldap
|
||||
#ynh_exec_as $app env PATH=$PATH drush @$app pm-enable -y ldap_servers ldap_user ldap_authentication ldap_authorization ldap_authorization_drupal_role
|
||||
#ynh_exec_as $app env PATH=$PATH drush @$app core-cron
|
||||
|
||||
update-alternatives --set php /usr/bin/php7.0
|
||||
|
||||
#=================================================
|
||||
# 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 --file="$config_file"
|
||||
|
||||
|
|
|
@ -67,8 +67,10 @@ ynh_restore
|
|||
# Restore permissions on app files
|
||||
chown -R root: $final_path
|
||||
chmod 2775 "$final_path/sites/default/files"
|
||||
chown -R $app: "${final_path}_private"
|
||||
chmod 775 "${final_path}_private"
|
||||
|
||||
mkdir -p "/home/yunohost.app/$app/data"
|
||||
chown -R $app: "/home/yunohost.app/$app/data"
|
||||
chmod 775 "/home/yunohost.app/$app/data"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
|
|
|
@ -30,12 +30,6 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|||
# CHECK VERSION
|
||||
#=================================================
|
||||
|
||||
### This helper will compare the version of the currently installed app and the version of the upstream package.
|
||||
### $upgrade_type can have 2 different values
|
||||
### - UPGRADE_APP if the upstream app version has changed
|
||||
### - UPGRADE_PACKAGE if only the YunoHost package has changed
|
||||
### ynh_check_app_version_changed will stop the upgrade if the app is up to date.
|
||||
### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
|
@ -113,7 +107,7 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE PHP
|
||||
|
@ -146,15 +140,25 @@ ynh_script_progression --message="Upgrading Drupal..." --time --weight=30
|
|||
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/$app/sites/default/settings.php"
|
||||
|
||||
drush="$final_path/.composer/vendor/bin/drush --quiet"
|
||||
pushd $final_path
|
||||
ynh_exec_as $app $drush
|
||||
ynh_exec_as $app $drush variable-set --exact maintenance_mode 1
|
||||
ynh_exec_as $app $drush cache-clear all
|
||||
ynh_exec_as $app $drush pm-update -y drupal
|
||||
ynh_exec_as $app $drush vset --exact maintenance_mode 0
|
||||
ynh_exec_as $app $drush cache-clear all
|
||||
popd
|
||||
export PATH="$final_path/.composer/vendor/bin:$PATH"
|
||||
|
||||
update-alternatives --set php /usr/bin/php7.2
|
||||
|
||||
ynh_exec_as $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 1
|
||||
ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all
|
||||
ynh_exec_as $app env PATH=$PATH drush @$app pm-update -y drupal
|
||||
ynh_exec_as $app env PATH=$PATH drush @$app vset --exact maintenance_mode 0
|
||||
ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all
|
||||
|
||||
update-alternatives --set php /usr/bin/php7.0
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
config_file=$final_path/sites/default/settings.php
|
||||
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$config_file"
|
||||
|
||||
#=================================================
|
||||
|
||||
|
@ -173,7 +177,10 @@ ynh_store_file_checksum --file="$config_file"
|
|||
|
||||
# Set permissions on app files
|
||||
chown -R $app: $final_path
|
||||
chown -R $app: "${final_path}_private"
|
||||
|
||||
mkdir -p "/home/yunohost.app/$app/data"
|
||||
chown -R $app: "/home/yunohost.app/$app/data"
|
||||
chmod 775 "/home/yunohost.app/$app/data"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
Loading…
Reference in a new issue