1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/prettynoemiecms_ynh.git synced 2024-09-03 20:06:36 +02:00

Apply last example_ynh

This commit is contained in:
yalh76 2022-06-26 18:01:41 +02:00
parent fb3e67f476
commit a4b0e66dfb
13 changed files with 117 additions and 86 deletions

View file

@ -2,9 +2,9 @@
; Manifest
domain="domain.tld"
path="/path"
admin="john"
language="fr_FR"
is_public=1
language="fr_FR"
admin="john"
password="pass"
; Checks
pkg_linter=1
@ -14,14 +14,12 @@
setup_private=1
setup_public=1
upgrade=1
# 2020.01.07~ynh1
upgrade=1 from_commit=a2309f4c622bab3b728e765b125245ebf55f3f59
backup_restore=1
multi_instance=1
port_already_use=0
change_url=1
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=a2309f4c622bab3b728e765b125245ebf55f3f59
name=Merge pull request #13 from YunoHost-Apps/testing
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&

View file

@ -1,6 +1,7 @@
SOURCE_URL=https://framagit.org/framasoft/PrettyNoemieCMS/-/archive/96754fa446c41fe4cc30aefb4c5feed641a6ec93/PrettyNoemieCMS-96754fa446c41fe4cc30aefb4c5feed641a6ec93.tar.gz
SOURCE_SUM=a70d9b265fc7f45b34523958a050d84174d58f74abcfc3ee118b823e0aa6d10d
SOURCE_URL=https://framagit.org/framasoft/PrettyNoemieCMS/-/archive/2cc12314388c06f2194b07ee7204bc213fb65230/PrettyNoemieCMS-2cc12314388c06f2194b07ee7204bc213fb65230.tar.gz
SOURCE_SUM=a873d7abf5325bef70156d669872cb78ab6f15716c5edcc59015ab88540a6723
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

9
conf/config.json Normal file
View file

@ -0,0 +1,9 @@
{
"siteDomain":"__DOMAIN__",
"siteLabel":"__DOMAIN__",
"admins":[
],
"siteLang":"__LANGUAGE__",
"siteDescription":"",
"siteKeywords":""
}

View file

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

View file

@ -6,11 +6,10 @@
"en": "Ergonomic, simple and elegant CMS to build in no time landpage websites with modern design",
"fr": "CMS ergonomique, simple et élégant pour construire en un rien de temps des sites vitrines avec un design moderne"
},
"version": "2020.01.07~ynh2",
"version": "2022.06.26~ynh1",
"url": "https://framagit.org/framasoft/PrettyNoemieCMS",
"upstream": {
"license": "AGPL-3.0",
"demo": "https://demo-pretty-noemie.frama.site",
"userdoc": "https://framagit.org/framasoft/PrettyNoemieCMS",
"code": "https://framagit.org/framasoft/PrettyNoemieCMS"
},
@ -28,7 +27,7 @@
"php7.3-fpm"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"
@ -39,10 +38,6 @@
"example": "/prettynoemiecms",
"default": "/prettynoemiecms"
},
{
"name": "admin",
"type": "user"
},
{
"name": "is_public",
"type": "boolean",
@ -58,6 +53,10 @@
"choices": ["fr_FR", "en_EN"],
"default": "fr_FR"
},
{
"name": "admin",
"type": "user"
},
{
"name": "password",
"type": "password"

View file

@ -6,6 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -32,8 +33,6 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================

View file

@ -45,6 +45,7 @@ ynh_clean_setup () {
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
@ -70,19 +71,19 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the nginx config file
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original nginx config file if modified
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for nginx helper
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for nginx
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location

View file

@ -22,9 +22,9 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
admin=$YNH_APP_ARG_ADMIN
password=$YNH_APP_ARG_PASSWORD
app=$YNH_APP_INSTANCE_NAME
@ -47,8 +47,8 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=admin --value=$admin
#=================================================
# STANDARD MODIFICATIONS
@ -76,13 +76,9 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# PHP-FPM CONFIGURATION
@ -93,6 +89,14 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
@ -101,16 +105,15 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
ynh_script_progression --message="Installing composer..." --weight=6
# Install composer
ynh_install_composer
ynh_install_composer --phpversion="$phpversion" --workdir="$final_path"
#=================================================
# CREATE FILES AND DIRECTORIES
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..."
mkdir -p "$final_path/sites/$domain"
echo "{\"siteDomain\":\"$domain\",\"siteLabel\":\"$domain\",\"admins\":[],\"siteLang\":\"$language\",\
\"siteDescription\":\"Site r\u00e9alis\u00e9 avec FramaSite\",\"siteKeywords\":\"\"}" > "$final_path/sites/$domain/config.json"
ynh_add_config --template="../conf/config.json" --destination="$final_path/sites/$domain/config.json"
# Set permissions to app files
chmod 750 "$final_path"
@ -120,13 +123,13 @@ chown -R $app:www-data "$final_path"
#=================================================
# SETUP APPLICATION WITH CURL
#=================================================
ynh_script_progression --message="Setuping application with CURL..."
# Set the app as temporarily public for cURL call
# Set the app as temporarily public for curl call
ynh_script_progression --message="Configuring SSOwat..."
# Making the app public for curl
ynh_permission_update --permission="main" --add="visitors"
# Reload NGINX
ynh_systemd_action --service_name=nginx --action=reload
# Installation with curl
ynh_script_progression --message="Finalizing installation..." --weight=2
ynh_local_curl "/signIn" "username=$admin" "password=$password" "repeatPassword=$password"
@ -134,16 +137,9 @@ ynh_local_curl "/signIn" "username=$admin" "password=$password" "repeatPassword=
# Remove the public access
ynh_permission_update --permission="main" --remove="visitors"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$final_path/sites/$domain/config.json"
# Fix a bug where images can't be uploaded
ynh_replace_string --match_string="isMediaPathModified = true" --replace_string="" --target_file="$final_path/app/config/config.ini"
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -154,6 +150,8 @@ ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
# Only the admin can access the admin panel of the app (if the app has an admin panel)
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin

View file

@ -33,7 +33,7 @@ ynh_secure_remove --file="$final_path"
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated nginx config
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
@ -41,7 +41,7 @@ ynh_remove_nginx_config
#=================================================
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
# Remove the dedicated php-fpm config
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================

View file

@ -6,6 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -19,7 +20,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --weight=1
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -38,12 +39,6 @@ test ! -d $final_path \
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
@ -63,15 +58,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=2
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_add_fpm_config
#=================================================
# SPECIFIC RESTORATION
#=================================================
@ -82,6 +68,20 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=9
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=2
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -18,14 +18,15 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
language=$(ynh_app_setting_get --app=$app --key=language)
admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
@ -37,12 +38,14 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -74,8 +77,6 @@ ynh_script_progression --message="Making sure dedicated system user exists..." -
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -85,21 +86,13 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=4
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
ynh_setup_source --dest_dir="$final_path" --keep="sites/"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
@ -112,22 +105,36 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
# Create a dedicated php-fpm config
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
# STORE THE CONFIG FILE CHECKSUM
# UPDATE DEPENDENCIES WITH COMPOSER
#=================================================
ynh_script_progression --message="Upgrading Composer depedencies..." --weight=6
# Install composer
ynh_install_composer --phpversion="$phpversion" --workdir="$final_path"
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
ynh_backup_if_checksum_is_different --file="$final_path/sites/$domain/config.json"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/sites/$domain/config.json"
# Fix a bug where images can't be uploaded
ynh_replace_string --match_string="isMediaPathModified = true" --replace_string="" --target_file="$final_path/app/config/config.ini"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================

View file

@ -0,0 +1,8 @@
--- a/app/config/config.ini
+++ a/app/config/config.ini
@@ -3,5 +3,4 @@
UI=app/views/
AUTOLOAD=app/controllers/;app/fixtures/
SitesFolder = sites/
-isMediaPathModified = true

View file

@ -0,0 +1,11 @@
--- a/app/views/base/footer/footer.htm
+++ b/app/views/base/footer/footer.htm
@@ -40,7 +40,7 @@
<div class="" style="background-color: rgba(0,0,0,0.28)">
<div class="footer-copyright grey-text text-lighten-2 " >
<div class="container" style="font-size: 0.9em" >
- Hébergé par <a class="grey-text text-lighten-2" href="https://framasoft.org"><b>Framasoft</b></a>. Créé grâce à <a class="grey-text text-lighten-2" href="https://framagit.org/framasoft/PrettyNoemieCMS" > <img src="public/img/logo-final-white.png" class="responsive-img" style="height: 1.6em; margin: auto 0 -1px 5px" alt=""><b>oemieCMS</b></a>. Créez librement et gratuitement votre <a class="grey-text text-lighten-2" href="https://frama.site/"><b>Page Framasite ici</b></a>.
+ Créé grâce à <a class="grey-text text-lighten-2" href="https://framagit.org/framasoft/PrettyNoemieCMS" > <img src="public/img/logo-final-white.png" class="responsive-img" style="height: 1.6em; margin: auto 0 -1px 5px" alt=""><b>oemieCMS</b></a>.
</div>
</div>
</div>