mirror of
https://github.com/YunoHost-Apps/radicale_ynh.git
synced 2024-09-03 20:16:14 +02:00
commit
21b5079179
7 changed files with 34 additions and 144 deletions
|
@ -1,8 +1,8 @@
|
||||||
;; Test complet avec Infcloud
|
;; Test complet avec Infcloud
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld"
|
||||||
path="/path" (PATH)
|
path="/path"
|
||||||
admin="john" (USER)
|
admin="john"
|
||||||
infcloud=1
|
infcloud=1
|
||||||
language="French"
|
language="French"
|
||||||
; Checks
|
; Checks
|
||||||
|
@ -21,9 +21,9 @@
|
||||||
change_url=0
|
change_url=0
|
||||||
;; Test sans Infcloud
|
;; Test sans Infcloud
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld"
|
||||||
path="/path" (PATH)
|
path="/path"
|
||||||
admin="john" (USER)
|
admin="john"
|
||||||
infcloud=0
|
infcloud=0
|
||||||
language="French"
|
language="French"
|
||||||
; Checks
|
; Checks
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
location __PATH__ {
|
location __PATH__ {
|
||||||
if ($scheme = http) {
|
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
|
||||||
}
|
|
||||||
try_files $uri @radicale;
|
try_files $uri @radicale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
"email": "maniackc_dev@crudelis.fr"
|
"email": "maniackc_dev@crudelis.fr"
|
||||||
}],
|
}],
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 3.8.1"
|
"yunohost": ">= 4.3.0"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
|
@ -29,31 +29,17 @@
|
||||||
"install" : [
|
"install" : [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain"
|
||||||
"ask": {
|
|
||||||
"en": "Choose a domain for Radicale",
|
|
||||||
"fr": "Choisissez un domaine pour Radicale"
|
|
||||||
},
|
|
||||||
"example": "domain.org"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"ask": {
|
|
||||||
"en": "Choose a path for Radicale",
|
|
||||||
"fr": "Choisissez un chemin pour Radicale"
|
|
||||||
},
|
|
||||||
"example": "/radicale",
|
"example": "/radicale",
|
||||||
"default": "/radicale"
|
"default": "/radicale"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user",
|
"type": "user"
|
||||||
"ask": {
|
|
||||||
"en": "Choose the administrator (must be an existing YunoHost user)",
|
|
||||||
"fr": "Choisissez un administrateur (doit être un utilisateur YunoHost)"
|
|
||||||
},
|
|
||||||
"example": "john"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "infcloud",
|
"name": "infcloud",
|
||||||
|
|
|
@ -38,83 +38,6 @@ bool_to_true_false () {
|
||||||
# FUTUR OFFICIAL HELPERS
|
# FUTUR OFFICIAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Install or update the main directory yunohost.multimedia
|
|
||||||
#
|
|
||||||
# usage: ynh_multimedia_build_main_dir
|
|
||||||
ynh_multimedia_build_main_dir () {
|
|
||||||
local ynh_media_release="v1.2"
|
|
||||||
local checksum="806a827ba1902d6911095602a9221181"
|
|
||||||
|
|
||||||
# Download yunohost.multimedia scripts
|
|
||||||
wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz 2>&1
|
|
||||||
|
|
||||||
# Check the control sum
|
|
||||||
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \
|
|
||||||
|| ynh_die "Corrupt source"
|
|
||||||
|
|
||||||
# Check if the package acl is installed. Or install it.
|
|
||||||
ynh_package_is_installed 'acl' \
|
|
||||||
|| ynh_package_install acl
|
|
||||||
|
|
||||||
# Extract
|
|
||||||
mkdir yunohost.multimedia-master
|
|
||||||
tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1
|
|
||||||
./yunohost.multimedia-master/script/ynh_media_build.sh
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add a directory in yunohost.multimedia
|
|
||||||
# This "directory" will be a symbolic link to a existing directory.
|
|
||||||
#
|
|
||||||
# usage: ynh_multimedia_addfolder "Source directory" "Destination directory"
|
|
||||||
#
|
|
||||||
# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias.
|
|
||||||
# | arg: -d, --dest_dir= - Destination directory - The name and the place of the symbolic link, relative to "/home/yunohost.multimedia"
|
|
||||||
ynh_multimedia_addfolder () {
|
|
||||||
# Declare an array to define the options of this helper.
|
|
||||||
declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= )
|
|
||||||
local source_dir
|
|
||||||
local dest_dir
|
|
||||||
# Manage arguments with getopts
|
|
||||||
ynh_handle_getopts_args "$@"
|
|
||||||
|
|
||||||
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --source="$source_dir" --dest="$dest_dir"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Move a directory in yunohost.multimedia, and replace by a symbolic link
|
|
||||||
#
|
|
||||||
# usage: ynh_multimedia_movefolder "Source directory" "Destination directory"
|
|
||||||
#
|
|
||||||
# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias.
|
|
||||||
# It will be moved to "Destination directory"
|
|
||||||
# A symbolic link will replace it.
|
|
||||||
# | arg: -d, --dest_dir= - Destination directory - The new name and place of the directory, relative to "/home/yunohost.multimedia"
|
|
||||||
ynh_multimedia_movefolder () {
|
|
||||||
# Declare an array to define the options of this helper.
|
|
||||||
declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= )
|
|
||||||
local source_dir
|
|
||||||
local dest_dir
|
|
||||||
# Manage arguments with getopts
|
|
||||||
ynh_handle_getopts_args "$@"
|
|
||||||
|
|
||||||
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --inv --source="$source_dir" --dest="$dest_dir"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Allow an user to have an write authorisation in multimedia directories
|
|
||||||
#
|
|
||||||
# usage: ynh_multimedia_addaccess user_name
|
|
||||||
#
|
|
||||||
# | arg: -u, --user_name= - The name of the user which gain this access.
|
|
||||||
ynh_multimedia_addaccess () {
|
|
||||||
# Declare an array to define the options of this helper.
|
|
||||||
declare -Ar args_array=( [u]=user_name=)
|
|
||||||
local user_name
|
|
||||||
# Manage arguments with getopts
|
|
||||||
ynh_handle_getopts_args "$@"
|
|
||||||
|
|
||||||
groupadd -f multimedia
|
|
||||||
usermod -a -G multimedia $user_name
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
|
@ -261,30 +184,6 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_debian_release () {
|
|
||||||
lsb_release --codename --short
|
|
||||||
}
|
|
||||||
|
|
||||||
is_stretch () {
|
|
||||||
if [ "$(ynh_debian_release)" == "stretch" ]
|
|
||||||
then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
is_jessie () {
|
|
||||||
if [ "$(ynh_debian_release)" == "jessie" ]
|
|
||||||
then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_maintenance_mode_ON () {
|
ynh_maintenance_mode_ON () {
|
||||||
# Load value of $path_url and $domain from the config if their not set
|
# Load value of $path_url and $domain from the config if their not set
|
||||||
if [ -z $path_url ]; then
|
if [ -z $path_url ]; then
|
||||||
|
|
|
@ -81,7 +81,7 @@ then
|
||||||
# Add InfCloud in NGINX config
|
# Add InfCloud in NGINX config
|
||||||
ynh_replace_string "#INFCLOUD#" "" /etc/nginx/conf.d/$domain.d/$app.conf
|
ynh_replace_string "#INFCLOUD#" "" /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
fi
|
fi
|
||||||
ynh_store_file_checksum "$finalnginxconf"
|
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
|
|
|
@ -34,8 +34,6 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_webpath_available $domain $path_url \
|
|
||||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
|
||||||
test ! -d $final_path \
|
test ! -d $final_path \
|
||||||
|| ynh_die "There is already a directory: $final_path "
|
|| ynh_die "There is already a directory: $final_path "
|
||||||
test ! -d "/opt/yunohost/$app" \
|
test ! -d "/opt/yunohost/$app" \
|
||||||
|
|
|
@ -43,6 +43,20 @@ defaulteventduration=$(ynh_app_setting_get --app=$app --key=defaulteventduration
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backup the app before upgrading"
|
||||||
|
|
||||||
|
# Backup the current version of the app
|
||||||
|
ynh_backup_before_upgrade
|
||||||
|
ynh_clean_setup () {
|
||||||
|
# restore it if the upgrade fails
|
||||||
|
ynh_restore_upgradebackup
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -103,18 +117,14 @@ if [ -z "$overwrite_phpfpm" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# Migrate legacy permissions to new system
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backup the app before upgrading" --weight=9
|
if ynh_legacy_permissions_exists
|
||||||
|
then
|
||||||
|
ynh_legacy_permissions_delete_all
|
||||||
|
|
||||||
# Backup the current version of the app
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
ynh_backup_before_upgrade
|
fi
|
||||||
ynh_clean_setup () {
|
|
||||||
# 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 THE PATH
|
# CHECK THE PATH
|
||||||
|
@ -128,7 +138,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# ACTIVATE MAINTENANCE MODE
|
# ACTIVATE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Activate maintenance mode"
|
ynh_script_progression --message="Activate maintenance mode" --weight=1
|
||||||
|
|
||||||
ynh_maintenance_mode_ON
|
ynh_maintenance_mode_ON
|
||||||
|
|
||||||
|
@ -137,7 +147,7 @@ ynh_maintenance_mode_ON
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrade dependencies"
|
ynh_script_progression --message="Upgrade dependencies" --weight=5
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
@ -155,13 +165,13 @@ then
|
||||||
# Add InfCloud in NGINX config
|
# Add InfCloud in NGINX config
|
||||||
ynh_replace_string "#INFCLOUD#" "" /etc/nginx/conf.d/$domain.d/$app.conf
|
ynh_replace_string "#INFCLOUD#" "" /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
fi
|
fi
|
||||||
ynh_store_file_checksum "$finalnginxconf"
|
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Create a dedicated user"
|
ynh_script_progression --message="Create a dedicated user" --weight=2
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create $app
|
||||||
|
|
Loading…
Reference in a new issue