mirror of
https://github.com/YunoHost-Apps/radicale_ynh.git
synced 2024-09-03 20:16:14 +02:00
commit
0bef4b1801
9 changed files with 115 additions and 48 deletions
|
@ -40,7 +40,8 @@ Supported, with LDAP and SSO only with radicale, not for InfCloud.
|
||||||
|
|
||||||
#### Supported architectures
|
#### Supported architectures
|
||||||
|
|
||||||
* Tested on x86_64
|
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/jenkins/job/radicale%20(Community)/badge/icon)](https://ci-apps.yunohost.org/jenkins/job/radicale%20(Community)/)
|
||||||
|
* ARMv8-A - [![Build Status](https://ci-apps.yunohost.org/jenkins/job/radicale%20(Community)%20(%7EARM%7E)/badge/icon)](https://ci-apps.yunohost.org/jenkins/job/radicale%20(Community)%20(%7EARM%7E)/)
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,8 @@ Supportée, avec LDAP et SSO seulement avec radicale, pas pour InfCloud.
|
||||||
|
|
||||||
#### Architectures supportées.
|
#### Architectures supportées.
|
||||||
|
|
||||||
* Testé sur x86_64
|
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/jenkins/job/radicale%20(Community)/badge/icon)](https://ci-apps.yunohost.org/jenkins/job/radicale%20(Community)/)
|
||||||
|
* ARMv8-A - [![Build Status](https://ci-apps.yunohost.org/jenkins/job/radicale%20(Community)%20(%7EARM%7E)/badge/icon)](https://ci-apps.yunohost.org/jenkins/job/radicale%20(Community)%20(%7EARM%7E)/)
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "CalDAV (calendar) and CardDAV (contact) synchronization server",
|
"en": "CalDAV (calendar) and CardDAV (contact) synchronization server",
|
||||||
"fr": "Serveur de synchronisation CalDAV et CardDAV"
|
"fr": "Serveur de synchronisation CalDAV et CardDAV"
|
||||||
},
|
},
|
||||||
"version": "1.1.6~ynh1",
|
"version": "1.1.6~ynh2",
|
||||||
"url": "http://radicale.org",
|
"url": "http://radicale.org",
|
||||||
"license": "GPL-3.0,AGPL-3.0",
|
"license": "GPL-3.0,AGPL-3.0",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
|
|
@ -212,15 +212,17 @@ EOF
|
||||||
|
|
||||||
# Start or restart a service and follow its booting
|
# Start or restart a service and follow its booting
|
||||||
#
|
#
|
||||||
# usage: ynh_check_starting "Line to match" [Log file] [Timeout]
|
# usage: ynh_check_starting "Line to match" [Log file] [Timeout] [Service name]
|
||||||
#
|
#
|
||||||
# | arg: Line to match - The line to find in the log to attest the service have finished to boot.
|
# | arg: Line to match - The line to find in the log to attest the service have finished to boot.
|
||||||
# | arg: Log file - The log file to watch
|
# | arg: Log file - The log file to watch
|
||||||
|
# | arg: Service name
|
||||||
# /var/log/$app/$app.log will be used if no other log is defined.
|
# /var/log/$app/$app.log will be used if no other log is defined.
|
||||||
# | arg: Timeout - The maximum time to wait before ending the watching. Defaut 300 seconds.
|
# | arg: Timeout - The maximum time to wait before ending the watching. Defaut 300 seconds.
|
||||||
ynh_check_starting () {
|
ynh_check_starting () {
|
||||||
local line_to_match="$1"
|
local line_to_match="$1"
|
||||||
local app_log="${2:-/var/log/$app/$app.log}"
|
local service_name="${4:-$app}"
|
||||||
|
local app_log="${2:-/var/log/$service_name/$service_name.log}"
|
||||||
local timeout=${3:-300}
|
local timeout=${3:-300}
|
||||||
|
|
||||||
ynh_clean_check_starting () {
|
ynh_clean_check_starting () {
|
||||||
|
@ -229,13 +231,14 @@ ynh_check_starting () {
|
||||||
ynh_secure_remove "$templog" 2>&1
|
ynh_secure_remove "$templog" 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Starting of $app" >&2
|
echo "Starting of $service_name" >&2
|
||||||
systemctl restart $app
|
systemctl stop $service_name
|
||||||
local templog="$(mktemp)"
|
local templog="$(mktemp)"
|
||||||
# Following the starting of the app in its log
|
# Following the starting of the app in its log
|
||||||
tail -f -n1 "$app_log" > "$templog" &
|
tail -F -n0 "$app_log" > "$templog" &
|
||||||
# Get the PID of the tail command
|
# Get the PID of the tail command
|
||||||
local pid_tail=$!
|
local pid_tail=$!
|
||||||
|
systemctl start $service_name
|
||||||
|
|
||||||
local i=0
|
local i=0
|
||||||
for i in `seq 1 $timeout`
|
for i in `seq 1 $timeout`
|
||||||
|
@ -243,7 +246,7 @@ ynh_check_starting () {
|
||||||
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
|
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
|
||||||
if grep --quiet "$line_to_match" "$templog"
|
if grep --quiet "$line_to_match" "$templog"
|
||||||
then
|
then
|
||||||
echo "The service $app has correctly started." >&2
|
echo "The service $service_name has correctly started." >&2
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
echo -n "." >&2
|
echo -n "." >&2
|
||||||
|
@ -251,7 +254,7 @@ ynh_check_starting () {
|
||||||
done
|
done
|
||||||
if [ $i -eq $timeout ]
|
if [ $i -eq $timeout ]
|
||||||
then
|
then
|
||||||
echo "The service $app didn't fully started before the timeout." >&2
|
echo "The service $service_name didn't fully started before the timeout." >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -343,6 +346,23 @@ ynh_exec_fully_quiet () {
|
||||||
eval $@ > /dev/null 2>&1
|
eval $@ > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Remove any logs for all the following commands.
|
||||||
|
#
|
||||||
|
# usage: ynh_print_OFF
|
||||||
|
# WARNING: You should be careful with this helper, and never forgot to use ynh_print_ON as soon as possible to restore the logging.
|
||||||
|
ynh_print_OFF () {
|
||||||
|
set +x
|
||||||
|
}
|
||||||
|
|
||||||
|
# Restore the logging after ynh_print_OFF
|
||||||
|
#
|
||||||
|
# usage: ynh_print_ON
|
||||||
|
ynh_print_ON () {
|
||||||
|
set -x
|
||||||
|
# Print an echo only for the log, to be able to know that ynh_print_ON has been called.
|
||||||
|
echo ynh_print_ON > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Install or update the main directory yunohost.multimedia
|
# Install or update the main directory yunohost.multimedia
|
||||||
|
@ -422,7 +442,7 @@ enabled = true
|
||||||
port = $ports
|
port = $ports
|
||||||
filter = $app
|
filter = $app
|
||||||
logpath = $logpath
|
logpath = $logpath
|
||||||
maxretry = $max_retry"
|
maxretry = $max_retry
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
sudo tee $finalfail2banfilterconf <<EOF
|
sudo tee $finalfail2banfilterconf <<EOF
|
||||||
|
@ -430,13 +450,19 @@ EOF
|
||||||
before = common.conf
|
before = common.conf
|
||||||
[Definition]
|
[Definition]
|
||||||
failregex = $failregex
|
failregex = $failregex
|
||||||
ignoreregrex ="
|
ignoreregex =
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
ynh_store_file_checksum "$finalfail2banjailconf"
|
ynh_store_file_checksum "$finalfail2banjailconf"
|
||||||
ynh_store_file_checksum "$finalfail2banfilterconf"
|
ynh_store_file_checksum "$finalfail2banfilterconf"
|
||||||
|
|
||||||
sudo systemctl restart fail2ban
|
systemctl restart fail2ban
|
||||||
|
local fail2ban_error="$(journalctl -u fail2ban | tail -n50 | grep "WARNING.*$app.*")"
|
||||||
|
if [ -n "$fail2ban_error" ]
|
||||||
|
then
|
||||||
|
echo "[ERR] Fail2ban failed to load the jail for $app" >&2
|
||||||
|
echo "WARNING${fail2ban_error#*WARNING}" >&2
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove the dedicated fail2ban config (jail and filter conf files)
|
# Remove the dedicated fail2ban config (jail and filter conf files)
|
||||||
|
@ -458,7 +484,7 @@ ynh_remove_fail2ban_config () {
|
||||||
ynh_read_manifest () {
|
ynh_read_manifest () {
|
||||||
manifest="$1"
|
manifest="$1"
|
||||||
key="$2"
|
key="$2"
|
||||||
python3 -c "import sys, json;print(json.load(open('$manifest'))['$key'])"
|
python3 -c "import sys, json;print(json.load(open('$manifest', encoding='utf-8'))['$key'])"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Exit without error if the package is up to date
|
# Exit without error if the package is up to date
|
||||||
|
@ -503,7 +529,7 @@ ynh_abort_if_up_to_date () {
|
||||||
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
|
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
|
||||||
# example: "root admin@domain user1 user2"
|
# example: "root admin@domain user1 user2"
|
||||||
ynh_send_readme_to_admin() {
|
ynh_send_readme_to_admin() {
|
||||||
local app_message="${1:-...No specific informations...}"
|
local app_message="${1:-...No specific information...}"
|
||||||
local recipients="${2:-root}"
|
local recipients="${2:-root}"
|
||||||
|
|
||||||
# Retrieve the email of users
|
# Retrieve the email of users
|
||||||
|
@ -534,7 +560,7 @@ ynh_send_readme_to_admin() {
|
||||||
|
|
||||||
local mail_message="This is an automated message from your beloved YunoHost server.
|
local mail_message="This is an automated message from your beloved YunoHost server.
|
||||||
|
|
||||||
Specific informations for the application $app.
|
Specific information for the application $app.
|
||||||
|
|
||||||
$app_message
|
$app_message
|
||||||
|
|
||||||
|
@ -547,6 +573,45 @@ $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
|
||||||
echo "$mail_message" | mail -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
|
echo "$mail_message" | mail -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Reload (or other actions) a service and print a log in case of failure.
|
||||||
|
#
|
||||||
|
# usage: ynh_system_reload service_name [action]
|
||||||
|
# | arg: service_name - Name of the service to reload
|
||||||
|
# | arg: action - Action to perform with systemctl. Default: reload
|
||||||
|
ynh_system_reload () {
|
||||||
|
local service_name=$1
|
||||||
|
local action=${2:-reload}
|
||||||
|
|
||||||
|
# Reload, restart or start and print the log if the service fail to start or reload
|
||||||
|
systemctl $action $service_name || ( journalctl --lines=20 -u $service_name >&2 && false)
|
||||||
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
#============= FUTURE YUNOHOST HELPER ============
|
#============= FUTURE YUNOHOST HELPER ============
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -126,7 +126,7 @@ fi
|
||||||
# RESTART UWSGI
|
# RESTART UWSGI
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
systemctl restart uwsgi
|
ynh_system_reload uwsgi restart
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
|
@ -134,4 +134,4 @@ systemctl restart uwsgi
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
systemctl reload nginx
|
ynh_system_reload nginx
|
||||||
|
|
|
@ -222,7 +222,7 @@ done <<< "$(yunohost user list | grep username | cut -d ":" -f 2 | cut -c 2-)" #
|
||||||
# ENABLE UWSGI SERVICE IN ADMIN PANEL
|
# ENABLE UWSGI SERVICE IN ADMIN PANEL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
systemctl restart uwsgi
|
ynh_system_reload uwsgi restart
|
||||||
# Ajoute le service au monitoring de Yunohost.
|
# Ajoute le service au monitoring de Yunohost.
|
||||||
yunohost service add uwsgi --log "/var/log/uwsgi/app/radicale.log"
|
yunohost service add uwsgi --log "/var/log/uwsgi/app/radicale.log"
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ fi
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
systemctl reload nginx
|
ynh_system_reload nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SEND A README FOR THE ADMIN
|
# SEND A README FOR THE ADMIN
|
||||||
|
|
|
@ -24,7 +24,7 @@ domain=$(ynh_app_setting_get $app domain)
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Suppression de la configuration uwsgi
|
# Suppression de la configuration uwsgi
|
||||||
systemctl stop uwsgi
|
ynh_system_reload uwsgi stop
|
||||||
if [ -h "/etc/uwsgi/apps-enabled/radicale.ini" ]; then
|
if [ -h "/etc/uwsgi/apps-enabled/radicale.ini" ]; then
|
||||||
echo "Delete uwsgi config"
|
echo "Delete uwsgi config"
|
||||||
ynh_secure_remove "/etc/uwsgi/apps-enabled/radicale.ini"
|
ynh_secure_remove "/etc/uwsgi/apps-enabled/radicale.ini"
|
||||||
|
@ -77,7 +77,7 @@ ynh_secure_remove "/etc/$app" # Delete radicale config
|
||||||
if [ -e /etc/init.d/uwsgi ]
|
if [ -e /etc/init.d/uwsgi ]
|
||||||
then
|
then
|
||||||
# Redémarre le service uwsgi si il n'est pas désinstallé.
|
# Redémarre le service uwsgi si il n'est pas désinstallé.
|
||||||
systemctl start uwsgi
|
ynh_system_reload uwsgi start
|
||||||
else
|
else
|
||||||
if yunohost service status | grep -q uwsgi # Test l'existence du service dans Yunohost
|
if yunohost service status | grep -q uwsgi # Test l'existence du service dans Yunohost
|
||||||
then
|
then
|
||||||
|
|
|
@ -126,8 +126,8 @@ ynh_restore_file "/etc/logrotate.d/$app"
|
||||||
# RELOAD NGINX AND UWSGI
|
# RELOAD NGINX AND UWSGI
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
systemctl restart uwsgi
|
ynh_system_reload uwsgi restart
|
||||||
systemctl reload nginx
|
ynh_system_reload nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SEND A README FOR THE ADMIN
|
# SEND A README FOR THE ADMIN
|
||||||
|
|
|
@ -230,7 +230,7 @@ cp ../conf/radicale.ini /etc/uwsgi/apps-available/
|
||||||
# RESTART UWSGI
|
# RESTART UWSGI
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
systemctl restart uwsgi
|
ynh_system_reload uwsgi restart
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PREPARE THE HOOKS
|
# PREPARE THE HOOKS
|
||||||
|
@ -260,4 +260,4 @@ fi
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
systemctl reload nginx
|
ynh_system_reload nginx
|
||||||
|
|
Loading…
Reference in a new issue