1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cheky_ynh.git synced 2024-09-03 18:16:00 +02:00
This commit is contained in:
ericgaspar 2021-07-19 09:12:22 +02:00
parent a635dc8131
commit 5e3c21f542
5 changed files with 16 additions and 92 deletions

View file

@ -1,17 +1,12 @@
# See here for more informations
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld"
path="/path" (PATH) path="/path"
admin="john" (USER) admin="john"
#language="fr" #language="fr"
is_public=1 (PUBLIC|public=1|private=0) is_public=1
password="pass" password="pass"
#port="666" (PORT) #port="666"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=1
@ -26,19 +21,6 @@
incorrect_path=1 incorrect_path=1
port_already_use=0 port_already_use=0
change_url=0 change_url=0
;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
# Level 4:
Level 4=0
# Level 5:
Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none

View file

@ -27,12 +27,12 @@
} }
], ],
"requirements": { "requirements": {
"yunohost": ">= 3.4" "yunohost": ">= 4.2.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
"php7.0-fpm", "php7.3-fpm",
"mysql" "mysql"
], ],
"arguments": { "arguments": {
@ -40,29 +40,17 @@
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
"ask": {
"en": "Choose a domain name for Cheky",
"fr": "Choisissez un nom de domaine pour Cheky"
},
"example": "example.com" "example": "example.com"
}, },
{ {
"name": "path", "name": "path",
"type": "path", "type": "path",
"ask": {
"en": "Choose a path for Cheky",
"fr": "Choisissez un chemin pour Cheky"
},
"example": "/cheky", "example": "/cheky",
"default": "/cheky" "default": "/cheky"
}, },
{ {
"name": "password", "name": "password",
"type": "password", "type": "password",
"ask": {
"en": "Password for admin account",
"fr": "Mot de passe compte admin"
},
"example": "password" "example": "password"
}, },
{ {

View file

@ -25,16 +25,6 @@ path_url=$YNH_APP_ARG_PATH
password=$YNH_APP_ARG_PASSWORD password=$YNH_APP_ARG_PASSWORD
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
### If it's 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 interests you 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
#================================================= #=================================================
@ -59,19 +49,12 @@ ynh_print_info "Storing installation settings..."
ynh_app_setting_set $app domain $domain ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url ynh_app_setting_set $app path $path_url
ynh_app_setting_set $app password $password ynh_app_setting_set $app password $password
ynh_app_setting_set $app is_public $is_public
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
#================================================= #=================================================
ynh_print_info "Creating a MySQL database..." ynh_print_info "Creating a MySQL database..."
### Use these lines if you need a database for the application.
### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password.
### The password will be stored as 'mysqlpwd' into the app settings,
### and will be available as $db_pwd
db_name=$(ynh_sanitize_dbid $app) db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name ynh_app_setting_set $app db_name $db_name
ynh_mysql_setup_db $db_name $db_name ynh_mysql_setup_db $db_name $db_name
@ -130,7 +113,6 @@ chmod 644 "$cron_path"
ynh_replace_string "__USER__" "$app" "$cron_path" ynh_replace_string "__USER__" "$app" "$cron_path"
ynh_replace_string "__FINALPATH__" "$final_path" "$cron_path" ynh_replace_string "__FINALPATH__" "$final_path" "$cron_path"
#================================================= #=================================================
# SETUP APPLICATION WITH CURL # SETUP APPLICATION WITH CURL
#================================================= #=================================================
@ -180,8 +162,7 @@ ynh_print_info "Configuring SSOwat..."
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
# unprotected_uris allows SSO credentials to be passed anyway. ynh_permission_update --permission="main" --add="visitors"
ynh_app_setting_set $app unprotected_uris "/"
fi fi
#================================================= #=================================================

View file

@ -97,7 +97,7 @@ ynh_restore_file "/etc/cron.d/$app"
#================================================= #=================================================
ynh_print_info "Reloading nginx web server and php-fpm..." ynh_print_info "Reloading nginx web server and php-fpm..."
systemctl reload php7.0-fpm systemctl reload php7.3-fpm
systemctl reload nginx systemctl reload nginx
#================================================= #=================================================

View file

@ -19,7 +19,6 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path) path_url=$(ynh_app_setting_get $app path)
admin=$(ynh_app_setting_get $app admin) admin=$(ynh_app_setting_get $app admin)
is_public=$(ynh_app_setting_get $app is_public)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get $app final_path)
db_name=$(ynh_app_setting_get $app db_name) db_name=$(ynh_app_setting_get $app db_name)
@ -28,15 +27,6 @@ db_name=$(ynh_app_setting_get $app db_name)
#================================================= #=================================================
ynh_print_info "Ensuring downward compatibility..." ynh_print_info "Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set $app is_public 1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set $app is_public 0
is_public=0
fi
# If db_name doesn't exist, create it # If db_name doesn't exist, create it
if [ -z $db_name ]; then if [ -z $db_name ]; then
db_name=$(ynh_sanitize_dbid $app) db_name=$(ynh_sanitize_dbid $app)
@ -49,6 +39,13 @@ if [ -z $final_path ]; then
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set $app final_path $final_path
fi fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -63,13 +60,6 @@ ynh_clean_setup () {
# 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
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
path_url=$(ynh_normalize_url_path $path_url)
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -109,11 +99,6 @@ ynh_add_fpm_config
#================================================= #=================================================
ynh_print_info "Running specific upgrade..." ynh_print_info "Running specific upgrade..."
# Needed so no manual operation has to be done by user while upgrading
# If missing, Cheky is stuck in an "upgrade" state and the config file
# needs to be edited with latest version
# Also avoid to make file "$final_path/version.php" writable
# Give full access to "$app" so php script can do "its own magic stuff" # Give full access to "$app" so php script can do "its own magic stuff"
chown -R $app: $final_path chown -R $app: $final_path
@ -134,18 +119,6 @@ chown -R root: $final_path
chown -R $app: $final_path/var # requirement in official documentation chown -R $app: $final_path/var # requirement in official documentation
chown -R $app: $final_path/static/media/annonce # needed for "Mes annonces sauvegardées" tab chown -R $app: $final_path/static/media/annonce # needed for "Mes annonces sauvegardées" tab
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info "Upgrading SSOwat configuration..."
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway
ynh_app_setting_set $app unprotected_uris "/"
fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================