mirror of
https://github.com/YunoHost-Apps/cinny_ynh.git
synced 2024-09-03 18:16:13 +02:00
Ensure Cinny is always installed on a domain root
This commit is contained in:
parent
2569a7cb89
commit
53d1d56e20
5 changed files with 29 additions and 9 deletions
|
@ -6,15 +6,11 @@
|
||||||
;; Test complet
|
;; Test complet
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld"
|
domain="domain.tld"
|
||||||
path="/path"
|
path="/"
|
||||||
admin="john"
|
|
||||||
language="fr"
|
|
||||||
is_public=1
|
is_public=1
|
||||||
password="1Strong-Password"
|
|
||||||
port="666"
|
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=1
|
setup_sub_dir=0
|
||||||
setup_root=1
|
setup_root=1
|
||||||
setup_nourl=0
|
setup_nourl=0
|
||||||
setup_private=1
|
setup_private=1
|
||||||
|
@ -24,7 +20,7 @@
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
change_url=1
|
change_url=0
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=
|
Email=
|
||||||
Notification=none
|
Notification=none
|
||||||
|
|
|
@ -37,8 +37,12 @@
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"example": "/cinny",
|
"example": "/",
|
||||||
"default": "/cinny"
|
"default": "/",
|
||||||
|
"help": {
|
||||||
|
"en": "Cinny only supports to be installed on / for now.",
|
||||||
|
"fr": "Cinny ne peut être installé que à la racine pour le moment."
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
|
|
|
@ -11,6 +11,14 @@ nodejs_version=14
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_webpath_is_domain_root () {
|
||||||
|
local -A args_array=( [p]=path_url= )
|
||||||
|
local path_url
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
|
[[ "$path_url" != "/" ]] && [[ "$path_url" != "" ]]
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -62,6 +62,12 @@ then
|
||||||
change_path=1
|
change_path=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if ynh_webpath_is_domain_root -p "$new_path"; then
|
||||||
|
ynh_print_err "Cinny can only be installed on a domain root !"
|
||||||
|
ynh_die "Aborting."
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -35,6 +35,12 @@ final_path=/var/www/$app
|
||||||
test ! -e "$final_path" || ynh_die --message="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
|
||||||
|
|
||||||
|
if ynh_webpath_is_domain_root -p "$path_url"; then
|
||||||
|
ynh_print_err "Cinny can only be installed on a domain root !"
|
||||||
|
ynh_die "Aborting."
|
||||||
|
fi
|
||||||
|
|
||||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue