1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/bludit_ynh.git synced 2024-09-03 18:06:13 +02:00
* Update README.md

* Use SVG badge

* Smaal fixes

* Cleaning up

* [autopatch] Missing ynh_abort_if_errors in change_url scripts (#6)

Co-authored-by: Yunohost-Bot <>

* Update manifest.json

* Update manifest.json

* Fix

* [autopatch] Update issue and PR templates (#8)

Co-authored-by: Yunohost-Bot <>

* Add templates

* Update check_process

* Add templates

* Add screenshots

* Post max size

* Auto-update README

* Update manifest.json

* Auto-update README

* Create updater.yml

* Fix

* Cleaning up

* Fix

* Update manifest.json

* Update manifest.json

* Auto-update README

* Update manifest.json

* Auto-update README

* Upgrade to version 4.0.0-beta2 (#16)

* Upgrade to v4.0.0-beta2

* Auto-update README

Co-authored-by: yunohost-bot <yunohost-bot@users.noreply.github.com>
Co-authored-by: Yunohost-Bot <>

* 4.3 (#15)

* Upgrade to v4.0.0-beta3

* Auto-update README

* rc3

* Auto-update README

* php8

* Update check_process

* Fix demo link

* Auto-update README

* reorder

* Auto-update README

* Upgrade to bullseye

* Auto-update README

* Update upgrade

* Upgrade (#30)

* Testing (#17)

* Update README.md

* Use SVG badge

* Smaal fixes

* Cleaning up

* [autopatch] Missing ynh_abort_if_errors in change_url scripts (#6)

Co-authored-by: Yunohost-Bot <>

* Update manifest.json

* Update manifest.json

* Fix

* [autopatch] Update issue and PR templates (#8)

Co-authored-by: Yunohost-Bot <>

* Add templates

* Update check_process

* Add templates

* Add screenshots

* Post max size

* Auto-update README

* Update manifest.json

* Auto-update README

* Create updater.yml

* Fix

* Cleaning up

* Fix

* Update manifest.json

* Update manifest.json

* Auto-update README

* Update manifest.json

* Auto-update README

* Upgrade to version 4.0.0-beta2 (#16)

* Upgrade to v4.0.0-beta2

* Auto-update README

Co-authored-by: yunohost-bot <yunohost-bot@users.noreply.github.com>
Co-authored-by: Yunohost-Bot <>

* 4.3 (#15)

* Upgrade to v4.0.0-beta3

* Auto-update README

* rc3

* Auto-update README

* php8

* Update check_process

* Fix demo link

* Auto-update README

* reorder

* Auto-update README

* Upgrade to bullseye

* Auto-update README

Co-authored-by: YunoHost Bot <yunohost-bot@users.noreply.github.com>
Co-authored-by: Yunohost-Bot <>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: tituspijean <tituspijean@outlook.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Revert "Testing (#17)" (#25)

This reverts commit 64a84a3dc7.

* 3.14.1 (#28)

* 3.14.1

* Auto-update README

* Update upgrade

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Apply example_ynh

* Auto-update README

Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: YunoHost Bot <yunohost-bot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: tituspijean <tituspijean@outlook.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Auto-update README

* Update manifest.json

Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>

* Auto-update README

Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: ericgaspar <junk.eg@free.fr>
Co-authored-by: YunoHost Bot <yunohost-bot@users.noreply.github.com>
Co-authored-by: Yunohost-Bot <>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: tituspijean <tituspijean@outlook.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
This commit is contained in:
yalh76 2022-09-24 07:36:40 +02:00 committed by GitHub
parent b9c7815d16
commit 62ecaef4af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 166 additions and 119 deletions

View file

@ -9,9 +9,6 @@
# Since each app is different, maintainers can adapt its contents so as to perform # Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected. # automatic actions when a new upstream release is detected.
# Remove this exit command when you are ready to run this Action
#exit 1
#================================================= #=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS # FETCHING LATEST RELEASE AND ITS ASSETS
#================================================= #=================================================
@ -20,59 +17,44 @@
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions) # Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1) version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .tag_name | contains("rc") or contains("beta") or contains("alpha") | not ) | .tag_name' | sort -V | tail -1)
assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'")) assets="https://github.com/bludit/bludit/archive/$version.tar.gz"
# if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then # Later down the script, we assume the version has only digits and dots
# version=${version:1} # Sometimes the release name starts with a "v", so let's filter it out.
# fi # You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables # Setting up the environment variables
echo "Current version: $current_version" echo "Current version: $current_version"
echo "Latest release from upstream: $version" echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV echo "VERSION=$version" >> $GITHUB_ENV
echo "REPO=$repo" >> $GITHUB_ENV
# For the time being, let's assume the script will fail # For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one # Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available" echo "::warning ::No new version available"
exit 0 exit 0
# Proceed only if a PR for this new version does not already exist # Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update" echo "::warning ::A branch already exists for this update"
exit 0 exit 0
fi fi
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
echo "${#assets[@]} available asset(s)"
#================================================= #=================================================
# UPDATE SOURCE FILES # UPDATE SOURCE FILES
#================================================= #=================================================
# Here we use the $assets variable to get the resources published in the upstream release. # Let's download source tarball
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like. asset_url=$assets
# Let's loop over the array of assets URLs
for asset_url in ${assets[@]}; do
echo "Handling asset at $asset_url" echo "Handling asset at $asset_url"
# Assign the asset to a source file in conf/ directory src="app"
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
# Leave $src empty to ignore the asset
case $asset_url in
*".tar.gz")
src="app"
;;
*)
src=""
;;
esac
# If $src is not empty, let's process the asset
if [ ! -z "$src" ]; then
# Create the temporary directory # Create the temporary directory
tempdir="$(mktemp -d)" tempdir="$(mktemp -d)"
@ -99,15 +81,11 @@ SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=$extension SOURCE_FORMAT=$extension
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true
EOT EOT
echo "... conf/$src.src updated" echo "... conf/$src.src updated"
else
echo "... asset ignored"
fi
done
#================================================= #=================================================
# SPECIFIC UPDATE STEPS # SPECIFIC UPDATE STEPS
#================================================= #=================================================

View file

@ -40,6 +40,7 @@ jobs:
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>' committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>' author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false signoff: false
base: testing
branch: ci-auto-update-v${{ env.VERSION }} branch: ci-auto-update-v${{ env.VERSION }}
delete-branch: true delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}' title: 'Upgrade to version ${{ env.VERSION }}'

View file

@ -15,10 +15,16 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview ## Overview
Simple, Fast, Secure, Flat-File CMS Bludit is a web application to build your own website or blog in seconds, it's completely free and open source. Bludit uses files in JSON format to store the content, you don't need to install or configure a database. You only need a web server with PHP support.
**Shipped version:** 3.14.1~ynh1 Bludit is a Flat-File CMS.
Bludit supports Markdown and HTML code for the content.
**Shipped version:** 3.14.1~ynh2
**Demo:** https://demo.bludit.com
## Screenshots ## Screenshots

View file

@ -15,10 +15,16 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
## Vue d'ensemble ## Vue d'ensemble
CMS simple, rapide, sécurisé et à fichier plat Bludit is a web application to build your own website or blog in seconds, it's completely free and open source. Bludit uses files in JSON format to store the content, you don't need to install or configure a database. You only need a web server with PHP support.
**Version incluse :** 3.14.1~ynh1 Bludit is a Flat-File CMS.
Bludit supports Markdown and HTML code for the content.
**Version incluse :** 3.14.1~ynh2
**Démo :** https://demo.bludit.com
## Captures d'écran ## Captures d'écran

View file

@ -11,13 +11,15 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
upgrade=1 from_commit=c619ee29991f96e53e5dfb91ad9eb2a6003359f0
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0
change_url=1 change_url=1
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none
;;; Upgrade options ;;; Upgrade options
; commit=CommitHash ; commit=c619ee29991f96e53e5dfb91ad9eb2a6003359f0
name=Name and date of the commit. name=Testing (#12)
manifest_arg=domain=DOMAIN&path=PATH&is_public=1& manifest_arg=domain=DOMAIN&path=PATH&is_public=1&

View file

@ -3,3 +3,5 @@ SOURCE_SUM=27f96c1cd478c0885d402ccd5192ee5c227e5293ea23f53f92d652b9e46bf7af
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -2,10 +2,11 @@
location __PATH__/ { location __PATH__/ {
# Path to source # Path to source
alias __FINALPATH__/ ; alias __FINALPATH__/;
index index.php; index index.php;
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
client_max_body_size 10M; client_max_body_size 10M;
if (!-e $request_filename) { rewrite ^ __PATH__/index.php last; } if (!-e $request_filename) { rewrite ^ __PATH__/index.php last; }
@ -21,6 +22,7 @@ location __PATH__/ {
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_index index.php; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user; fastcgi_param REMOTE_USER $remote_user;

5
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1,5 @@
Bludit is a web application to build your own website or blog in seconds, it's completely free and open source. Bludit uses files in JSON format to store the content, you don't need to install or configure a database. You only need a web server with PHP support.
Bludit is a Flat-File CMS.
Bludit supports Markdown and HTML code for the content.

View file

@ -1,53 +1,54 @@
{ {
"name": "Bludit", "name": "Bludit",
"id": "bludit", "id": "bludit",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Simple, Fast, Secure, Flat-File CMS", "en": "Simple, Fast, Secure, Flat-File CMS",
"fr": "CMS simple, rapide, sécurisé et à fichier plat" "fr": "CMS simple, rapide, sécurisé et à fichier plat"
}, },
"version": "3.14.1~ynh1", "version": "3.14.1~ynh2",
"url": "www.bludit.com", "url": "www.bludit.com",
"upstream": { "upstream": {
"license": "MIT", "license": "MIT",
"website": "www.bludit.com", "website": "www.bludit.com",
"demo": "https://demo.bludit.com",
"admindoc": "https://docs.bludit.com/en/", "admindoc": "https://docs.bludit.com/en/",
"code": "https://github.com/bludit/bludit" "code": "https://github.com/bludit/bludit"
}, },
"license": "MIT", "license": "MIT",
"maintainer": { "maintainer": {
"name": "eric_G", "name": "eric_G",
"email": "" "email": ""
},
"requirements": {
"yunohost": ">= 11.0.9"
},
"multi_instance": true,
"services": [
"nginx",
"php7.4-fpm"
],
"arguments": {
"install" : [
{
"name": "domain",
"type": "domain"
}, },
{ "requirements": {
"name": "path", "yunohost": ">= 11.0.9"
"type": "path", },
"example": "/bludit", "multi_instance": true,
"default": "/bludit" "services": [
}, "nginx",
{ "php8.0-fpm"
"name": "is_public", ],
"type": "boolean", "arguments": {
"help": { "install": [
"en": "If enabled, Bludit will be accessible by people who do not have an account. This can be changed later via the webadmin.", {
"fr": "Si cette case est cochée, Bludit sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." "name": "domain",
}, "type": "domain"
"default": true },
} {
] "name": "path",
} "type": "path",
"example": "/bludit",
"default": "/bludit"
},
{
"name": "is_public",
"type": "boolean",
"help": {
"en": "If enabled, Bludit will be accessible by people who do not have an account. This can be changed later via the webadmin.",
"fr": "Si cette case est cochée, Bludit sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
},
"default": true
}
]
}
} }

View file

@ -3,10 +3,14 @@
#================================================= #=================================================
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
# PHP APP SPECIFIC
#=================================================
YNH_PHP_VERSION="7.4" YNH_PHP_VERSION="8.0"
php_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-dom"
pkg_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-dom" # dependencies used by the app (must be on a single line)
pkg_dependencies="$php_dependencies"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -1,9 +1,12 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # 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 ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -11,6 +14,10 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#================================================= #=================================================
@ -51,4 +58,4 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Backup script completed for Bludit. (YunoHost will then actually copy those files to the archive)." ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -8,7 +8,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS # RETRIEVE ARGUMENTS
@ -27,8 +26,26 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED # CHECK WHICH PARTS SHOULD BE CHANGED
#================================================= #=================================================
@ -76,6 +93,8 @@ then
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi fi
#=================================================
# GENERIC FINALISATION
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
@ -87,4 +106,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Change of URL completed for Bludit" --last ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
@ -32,7 +35,7 @@ app=$YNH_APP_INSTANCE_NAME
ynh_script_progression --message="Validating installation parameters..." --weight=1 ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path # Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
@ -90,14 +93,18 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1 ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary or protect it # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors" ynh_permission_update --permission="main" --add="visitors"
fi fi
@ -112,4 +119,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of Bludit completed" --last ynh_script_progression --message="Installation of $app completed" --last

View file

@ -20,12 +20,14 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# STANDARD REMOVE
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing Bludit main directory..." --weight=4 ynh_script_progression --message="Removing app main directory..." --weight=4
# Remove Bludit directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
#================================================= #=================================================
@ -64,4 +66,4 @@ ynh_system_user_delete --username=$app
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of Bludit completed" --last ynh_script_progression --message="Removal of $app completed" --last

View file

@ -6,6 +6,7 @@
# IMPORT GENERIC HELPERS # 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 ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -13,12 +14,16 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading settings..." --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -48,7 +53,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring Bludit main directory..." --weight=2 ynh_script_progression --message="Restoring the app main directory..." --weight=2
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$final_path"
@ -56,10 +61,9 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"
#=================================================
# SPECIFIC RESTORATION
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1 ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies # Define and install dependencies
@ -79,8 +83,6 @@ ynh_script_progression --message="Restoring the NGINX web server configuration..
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
@ -93,4 +95,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for Bludit" --last ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -24,23 +24,26 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..." --weight=1
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up Bludit before upgrading..." --weight=7 ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=7
# Backup the current version of Bludit # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup () { ynh_clean_setup () {
# restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
@ -68,17 +71,15 @@ ynh_script_progression --message="Making sure dedicated system user exists..." -
ynh_system_user_create --username=$app --home_dir="$final_path" ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# SPECIFIC UPGRADE # DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
# UPGRADING BLUDIT
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading Bludit..." --weight=2 ynh_script_progression --message="Upgrading source files..." --weight=2
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir=$final_path ynh_setup_source --dest_dir="$final_path"
fi fi
chmod 750 "$final_path" chmod 750 "$final_path"
@ -108,6 +109,8 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
@ -119,4 +122,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of Bludit completed" --last ynh_script_progression --message="Upgrade of $app completed" --last