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

Apply example_ynh

This commit is contained in:
yalh76 2022-07-07 00:37:03 +02:00
parent 728daca58e
commit d542b694c8
7 changed files with 24 additions and 42 deletions

View file

@ -1,9 +1,9 @@
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
admin="john"
is_public=1 is_public=1
password="pass" admin="john"
password="1Strong-Password"
single_user=1 single_user=1
; Checks ; Checks
pkg_linter=1 pkg_linter=1
@ -34,22 +34,5 @@
port_already_use=0 port_already_use=0
change_url=1 change_url=1
;;; Options ;;; Options
Email=yalh@yahoo.com Email=
Notification=all Notification=none
;;; Upgrade options
; commit=093ec18f9f5282e1a137c0ac5444a414ee2b83bc
name=0.8.1~ynh4
; commit=45584b220e911c573643cb1e213e75fc42547818
name=0.11.2~ynh1
; commit=4b7c851074c4e785c414944905a8cfb2a0d19ff1
name=0.12.0~ynh1
; commit=5ac207e14985bda77dc797353902548696622b41
name=0.12.0~ynh3
; commit=d75ccbc460b04ef95f3d8b1a72ee77fc7815c6a2
name=0.12.0~ynh4
; commit=b387e4186a02c387d734cf25f4fed9283c01d55f
name=0.12.0~ynh6
; commit=06afb5c5a1896185eec6e63ffcb929f0216db2ec
name=0.13.0~ynh1
; commit=e30ec378dc703227fcfe542d19f35e2838192094
name=0.13.1~ynh1

View file

@ -6,7 +6,7 @@
"en": "For starting a minimalist, federated blog or an entire community.", "en": "For starting a minimalist, federated blog or an entire community.",
"fr": "Permet de créer un blog fédéré minimaliste ou une communauté entière." "fr": "Permet de créer un blog fédéré minimaliste ou une communauté entière."
}, },
"version": "0.13.1~ynh2", "version": "0.13.1~ynh3",
"url": "https://writefreely.org", "url": "https://writefreely.org",
"upstream": { "upstream": {
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
@ -33,15 +33,15 @@
"name": "domain", "name": "domain",
"type": "domain" "type": "domain"
}, },
{
"name": "admin",
"type": "user"
},
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"default": true "default": true
}, },
{
"name": "admin",
"type": "user"
},
{ {
"name": "password", "name": "password",
"type": "password" "type": "password"

View file

@ -42,6 +42,7 @@ ynh_script_progression --message="Backing up the app before changing its URL (ma
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup () { ynh_clean_setup () {
ynh_clean_check_starting
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. # 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" ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"

View file

@ -25,14 +25,11 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url="/" path_url="/"
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
admin=$YNH_APP_ARG_ADMIN
password=$YNH_APP_ARG_PASSWORD password=$YNH_APP_ARG_PASSWORD
single_user=$YNH_APP_ARG_SINGLE_USER single_user=$YNH_APP_ARG_SINGLE_USER
architecture=$YNH_ARCH
# Bypass package_checker name not compatible with writefreely # Bypass package_checker name not compatible with writefreely
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
admin="test" admin="test"
@ -45,6 +42,7 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." ynh_script_progression --message="Validating installation parameters..."
architecture=$YNH_ARCH
# Check machine architecture, we don't support 32bit machines # Check machine architecture, we don't support 32bit machines
if [ $architecture = "i386" ] if [ $architecture = "i386" ]
then then
@ -84,7 +82,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port
ynh_script_progression --message="Configuring system user..." ynh_script_progression --message="Configuring system user..."
# Create a system user # Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
@ -126,7 +124,7 @@ ynh_script_progression --message="Adding a configuration file..."
ynh_add_config --template="../conf/config.ini" --destination="$final_path/config.ini" ynh_add_config --template="../conf/config.ini" --destination="$final_path/config.ini"
chmod 400 "$final_path/config.ini" chmod 600 "$final_path/config.ini"
chown $app:$app "$final_path/config.ini" chown $app:$app "$final_path/config.ini"
#================================================= #=================================================

View file

@ -43,20 +43,13 @@ test ! -d $final_path \
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#=================================================
# 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"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
@ -71,6 +64,13 @@ chown -R $app:www-data "$final_path"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#=================================================
# 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"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================

View file

@ -100,7 +100,7 @@ fi
ynh_script_progression --message="Making sure dedicated system user exists..." 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 --home_dir=$final_path ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -147,7 +147,7 @@ ynh_script_progression --message="Updating a configuration file..."
ynh_add_config --template="../conf/config.ini" --destination="$final_path/config.ini" ynh_add_config --template="../conf/config.ini" --destination="$final_path/config.ini"
chmod 400 "$final_path/config.ini" chmod 600 "$final_path/config.ini"
chown $app:$app "$final_path/config.ini" chown $app:$app "$final_path/config.ini"
#================================================= #=================================================