mirror of
https://github.com/YunoHost-Apps/radicale_ynh.git
synced 2024-09-03 20:16:14 +02:00
English translation and typo
This commit is contained in:
parent
979e163760
commit
091a0c70e8
12 changed files with 508 additions and 453 deletions
|
@ -44,9 +44,9 @@ Supported, with LDAP and SSO only with radicale, not for InfCloud.
|
|||
|
||||
#### Supported architectures
|
||||
|
||||
* 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-arm.yunohost.org/jenkins/job/radicale%20(Community)%20(%7EARM%7E)/badge/icon)](https://ci-apps-arm.yunohost.org/jenkins/job/radicale%20(Community)%20(%7EARM%7E)/)
|
||||
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/jenkins/job/radicale%20(Community)/badge/icon)](https://ci-stretch.nohost.me/jenkins/job/radicale%20(Community)/)
|
||||
* x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/radicale%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/radicale/)
|
||||
* ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/radicale%20%28Community%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/radicale/)
|
||||
* Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/radicale%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/radicale/)
|
||||
|
||||
## Limitations
|
||||
|
||||
|
|
|
@ -44,9 +44,9 @@ Supportée, avec LDAP et SSO seulement avec radicale, pas pour InfCloud.
|
|||
|
||||
#### Architectures supportées.
|
||||
|
||||
* 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-arm.yunohost.org/jenkins/job/radicale%20(Community)%20(%7EARM%7E)/badge/icon)](https://ci-apps-arm.yunohost.org/jenkins/job/radicale%20(Community)%20(%7EARM%7E)/)
|
||||
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/jenkins/job/radicale%20(Community)/badge/icon)](https://ci-stretch.nohost.me/jenkins/job/radicale%20(Community)/)
|
||||
* x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/radicale%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/radicale/)
|
||||
* ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/radicale%20%28Community%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/radicale/)
|
||||
* Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/radicale%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/radicale/)
|
||||
|
||||
## Limitations
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
; upload_max_filesize=100M
|
||||
; post_max_size=100M
|
||||
; max_execution_time=60
|
|
@ -49,11 +49,13 @@ bool_to_true_false () {
|
|||
}
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
# FUTUR OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
||||
# Internal helper design to allow helpers to use getopts to manage their arguments
|
||||
#
|
||||
# [internal]
|
||||
#
|
||||
# example: function my_helper()
|
||||
# {
|
||||
# declare -Ar args_array=( [a]=arg1= [b]=arg2= [c]=arg3 )
|
||||
|
@ -103,33 +105,33 @@ ynh_handle_getopts_args () {
|
|||
|
||||
# For each option in the array, reduce to short options for getopts (e.g. for [u]=user, --user will be -u)
|
||||
# And built parameters string for getopts
|
||||
# ${!args_array[@]} is the list of all keys in the array (A key is 'u' in [u]=user, user is a value)
|
||||
# ${!args_array[@]} is the list of all option_flags in the array (An option_flag is 'u' in [u]=user, user is a value)
|
||||
local getopts_parameters=""
|
||||
local key=""
|
||||
for key in "${!args_array[@]}"
|
||||
local option_flag=""
|
||||
for option_flag in "${!args_array[@]}"
|
||||
do
|
||||
# Concatenate each keys of the array to build the string of arguments for getopts
|
||||
# Concatenate each option_flags of the array to build the string of arguments for getopts
|
||||
# Will looks like 'abcd' for -a -b -c -d
|
||||
# If the value of a key finish by =, it's an option with additionnal values. (e.g. --user bob or -u bob)
|
||||
# Check the last character of the value associate to the key
|
||||
if [ "${args_array[$key]: -1}" = "=" ]
|
||||
# If the value of an option_flag finish by =, it's an option with additionnal values. (e.g. --user bob or -u bob)
|
||||
# Check the last character of the value associate to the option_flag
|
||||
if [ "${args_array[$option_flag]: -1}" = "=" ]
|
||||
then
|
||||
# For an option with additionnal values, add a ':' after the letter for getopts.
|
||||
getopts_parameters="${getopts_parameters}${key}:"
|
||||
getopts_parameters="${getopts_parameters}${option_flag}:"
|
||||
else
|
||||
getopts_parameters="${getopts_parameters}${key}"
|
||||
getopts_parameters="${getopts_parameters}${option_flag}"
|
||||
fi
|
||||
# Check each argument given to the function
|
||||
local arg=""
|
||||
# ${#arguments[@]} is the size of the array
|
||||
for arg in `seq 0 $(( ${#arguments[@]} - 1 ))`
|
||||
do
|
||||
# And replace long option (value of the key) by the short option, the key itself
|
||||
# And replace long option (value of the option_flag) by the short option, the option_flag itself
|
||||
# (e.g. for [u]=user, --user will be -u)
|
||||
# Replace long option with =
|
||||
arguments[arg]="${arguments[arg]//--${args_array[$key]}/-${key} }"
|
||||
arguments[arg]="${arguments[arg]//--${args_array[$option_flag]}/-${option_flag} }"
|
||||
# And long option without =
|
||||
arguments[arg]="${arguments[arg]//--${args_array[$key]%=}/-${key}}"
|
||||
arguments[arg]="${arguments[arg]//--${args_array[$option_flag]%=}/-${option_flag}}"
|
||||
done
|
||||
done
|
||||
|
||||
|
@ -148,10 +150,10 @@ ynh_handle_getopts_args () {
|
|||
|
||||
if [ "$parameter" = "?" ]
|
||||
then
|
||||
ynh_die "Invalid argument: -${OPTARG:-}"
|
||||
ynh_die --message="Invalid argument: -${OPTARG:-}"
|
||||
elif [ "$parameter" = ":" ]
|
||||
then
|
||||
ynh_die "-$OPTARG parameter requires an argument."
|
||||
ynh_die --message="-$OPTARG parameter requires an argument."
|
||||
else
|
||||
local shift_value=1
|
||||
# Use the long option, corresponding to the short option read by getopts, as a variable
|
||||
|
@ -179,19 +181,20 @@ ynh_handle_getopts_args () {
|
|||
shift_value=$(( shift_value - 1 ))
|
||||
fi
|
||||
|
||||
# Declare the content of option_var as a variable.
|
||||
eval ${option_var}=""
|
||||
# Then read the array value per value
|
||||
local i
|
||||
for i in `seq 0 $(( ${#all_args[@]} - 1 ))`
|
||||
do
|
||||
# If this argument is an option, end here.
|
||||
if [ "${all_args[$i]:0:1}" == "-" ] || [ -z "${all_args[$i]}" ]
|
||||
if [ "${all_args[$i]:0:1}" == "-" ]
|
||||
then
|
||||
# Ignore the first value of the array, which is the option itself
|
||||
if [ "$i" -ne 0 ]; then
|
||||
break
|
||||
fi
|
||||
else
|
||||
# Declare the content of option_var as a variable.
|
||||
eval ${option_var}=""
|
||||
# Else, add this value to this option
|
||||
# Each value will be separated by ';'
|
||||
if [ -n "${!option_var}" ]
|
||||
|
@ -215,25 +218,33 @@ ynh_handle_getopts_args () {
|
|||
# Check if there's getopts arguments
|
||||
if [ "${arguments[0]:0:1}" != "-" ]
|
||||
then
|
||||
# If not, enter in legacy mode and manage the arguments as positionnal ones.
|
||||
echo "! Helper used in legacy mode !"
|
||||
# If not, enter in legacy mode and manage the arguments as positionnal ones..
|
||||
# Dot not echo, to prevent to go through a helper output. But print only in the log.
|
||||
set -x; echo "! Helper used in legacy mode !" > /dev/null; set +x
|
||||
local i
|
||||
for i in `seq 0 $(( ${#arguments[@]} -1 ))`
|
||||
do
|
||||
# Use getopts_parameters as a list of key of the array args_array
|
||||
# Try to use legacy_args as a list of option_flag of the array args_array
|
||||
# Otherwise, fallback to getopts_parameters to get the option_flag. But an associative arrays isn't always sorted in the correct order...
|
||||
# Remove all ':' in getopts_parameters
|
||||
getopts_parameters=${getopts_parameters//:}
|
||||
# Get the key from getopts_parameters, by using the key according to the position of the argument.
|
||||
key=${getopts_parameters:$i:1}
|
||||
# Use the long option, corresponding to the key, as a variable
|
||||
getopts_parameters=${legacy_args:-${getopts_parameters//:}}
|
||||
# Get the option_flag from getopts_parameters, by using the option_flag according to the position of the argument.
|
||||
option_flag=${getopts_parameters:$i:1}
|
||||
if [ -z "$option_flag" ]; then
|
||||
ynh_print_warn --message="Too many arguments ! \"${arguments[$i]}\" will be ignored."
|
||||
continue
|
||||
fi
|
||||
# Use the long option, corresponding to the option_flag, as a variable
|
||||
# (e.g. for [u]=user, 'user' will be used as a variable)
|
||||
# Also, remove '=' at the end of the long option
|
||||
# The variable name will be stored in 'option_var'
|
||||
local option_var="${args_array[$key]%=}"
|
||||
local option_var="${args_array[$option_flag]%=}"
|
||||
|
||||
# Store each value given as argument in the corresponding variable
|
||||
# The values will be stored in the same order than $args_array
|
||||
eval ${option_var}+=\"${arguments[$i]}\"
|
||||
done
|
||||
unset legacy_args
|
||||
else
|
||||
# END LEGACY MODE
|
||||
# Call parse_arg and pass the modified list of args as an array of arguments.
|
||||
|
@ -245,197 +256,28 @@ ynh_handle_getopts_args () {
|
|||
|
||||
#=================================================
|
||||
|
||||
# Start or restart a service and follow its booting
|
||||
#
|
||||
# usage: ynh_check_starting "Line to match" [Log file] [Timeout] [Service name]
|
||||
#
|
||||
# | arg: -m, --line_to_match= - Line to match - The line to find in the log to attest the service have finished to boot.
|
||||
# | arg: -l, --app_log= - Log file - The log file to watch; specify "systemd" to read systemd journal for specified service
|
||||
# /var/log/$app/$app.log will be used if no other log is defined.
|
||||
# | arg: -t, --timeout= - Timeout - The maximum time to wait before ending the watching. Defaut 300 seconds.
|
||||
# | arg: -n, --service_name= - Service name
|
||||
|
||||
ynh_check_starting () {
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [m]=line_to_match= [l]=app_log= [t]=timeout= [n]=service_name= )
|
||||
local line_to_match
|
||||
local app_log
|
||||
local timeout
|
||||
local service_name
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
local app_log="${app_log:-/var/log/$service_name/$service_name.log}"
|
||||
local timeout=${timeout:-300}
|
||||
local service_name="${service_name:-$app}"
|
||||
|
||||
echo "Starting of $service_name" >&2
|
||||
systemctl stop $service_name
|
||||
local templog="$(mktemp)"
|
||||
# Following the starting of the app in its log
|
||||
if [ "$app_log" == "systemd" ] ; then
|
||||
# Read the systemd journal
|
||||
journalctl -u $service_name -f --since=-45 > "$templog" &
|
||||
else
|
||||
# Read the specified log file
|
||||
tail -F -n0 "$app_log" > "$templog" &
|
||||
fi
|
||||
# Get the PID of the last command
|
||||
local pid_tail=$!
|
||||
systemctl start $service_name
|
||||
|
||||
local i=0
|
||||
for i in `seq 1 $timeout`
|
||||
do
|
||||
# Read the log until the sentence is found, which means the app finished starting. Or run until the timeout.
|
||||
if grep --quiet "$line_to_match" "$templog"
|
||||
then
|
||||
echo "The service $service_name has correctly started." >&2
|
||||
break
|
||||
fi
|
||||
echo -n "." >&2
|
||||
sleep 1
|
||||
done
|
||||
if [ $i -eq $timeout ]
|
||||
then
|
||||
echo "The service $service_name didn't fully start before the timeout." >&2
|
||||
fi
|
||||
|
||||
echo ""
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
|
||||
# Clean temporary process and file used by ynh_check_starting
|
||||
# (usually used in ynh_clean_setup scripts)
|
||||
#
|
||||
# usage: ynh_clean_check_starting
|
||||
ynh_clean_check_starting () {
|
||||
# Stop the execution of tail.
|
||||
kill -s 15 $pid_tail 2>&1
|
||||
ynh_secure_remove "$templog" 2>&1
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
||||
ynh_print_log () {
|
||||
echo "${1}"
|
||||
}
|
||||
|
||||
# Print an info on stdout
|
||||
#
|
||||
# usage: ynh_print_info "Text to print"
|
||||
# | arg: text - The text to print
|
||||
ynh_print_info () {
|
||||
ynh_print_log "[INFO] ${1}"
|
||||
}
|
||||
|
||||
# Print a warning on stderr
|
||||
#
|
||||
# usage: ynh_print_warn "Text to print"
|
||||
# | arg: text - The text to print
|
||||
ynh_print_warn () {
|
||||
ynh_print_log "[WARN] ${1}" >&2
|
||||
}
|
||||
|
||||
# Print a error on stderr
|
||||
#
|
||||
# usage: ynh_print_err "Text to print"
|
||||
# | arg: text - The text to print
|
||||
ynh_print_err () {
|
||||
ynh_print_log "[ERR] ${1}" >&2
|
||||
}
|
||||
|
||||
# Execute a command and print the result as an error
|
||||
#
|
||||
# usage: ynh_exec_err command to execute
|
||||
# usage: ynh_exec_err "command to execute | following command"
|
||||
# In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be send to the next pipe.
|
||||
#
|
||||
# | arg: command - command to execute
|
||||
ynh_exec_err () {
|
||||
ynh_print_err "$(eval $@)"
|
||||
}
|
||||
|
||||
# Execute a command and print the result as a warning
|
||||
#
|
||||
# usage: ynh_exec_warn command to execute
|
||||
# usage: ynh_exec_warn "command to execute | following command"
|
||||
# In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be send to the next pipe.
|
||||
#
|
||||
# | arg: command - command to execute
|
||||
ynh_exec_warn () {
|
||||
ynh_print_warn "$(eval $@)"
|
||||
}
|
||||
|
||||
# Execute a command and force the result to be printed on stdout
|
||||
#
|
||||
# usage: ynh_exec_warn_less command to execute
|
||||
# usage: ynh_exec_warn_less "command to execute | following command"
|
||||
# In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be send to the next pipe.
|
||||
#
|
||||
# | arg: command - command to execute
|
||||
ynh_exec_warn_less () {
|
||||
eval $@ 2>&1
|
||||
}
|
||||
|
||||
# Execute a command and redirect stdout in /dev/null
|
||||
#
|
||||
# usage: ynh_exec_quiet command to execute
|
||||
# usage: ynh_exec_quiet "command to execute | following command"
|
||||
# In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be send to the next pipe.
|
||||
#
|
||||
# | arg: command - command to execute
|
||||
ynh_exec_quiet () {
|
||||
eval $@ > /dev/null
|
||||
}
|
||||
|
||||
# Execute a command and redirect stdout and stderr in /dev/null
|
||||
#
|
||||
# usage: ynh_exec_fully_quiet command to execute
|
||||
# usage: ynh_exec_fully_quiet "command to execute | following command"
|
||||
# In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be send to the next pipe.
|
||||
#
|
||||
# | arg: command - command to execute
|
||||
ynh_exec_fully_quiet () {
|
||||
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
|
||||
#
|
||||
# usage: ynh_multimedia_build_main_dir
|
||||
ynh_multimedia_build_main_dir () {
|
||||
local ynh_media_release="v1.0"
|
||||
local checksum="4852c8607db820ad51f348da0dcf0c88"
|
||||
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
|
||||
# Download yunohost.multimedia scripts
|
||||
wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz
|
||||
|
||||
# Check the control sum
|
||||
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \
|
||||
|| ynh_die "Corrupt source"
|
||||
# Check the control sum
|
||||
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \
|
||||
|| ynh_die "Corrupt source"
|
||||
|
||||
# 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
|
||||
# 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
|
||||
|
@ -496,26 +338,31 @@ ynh_multimedia_addaccess () {
|
|||
# Create a dedicated fail2ban config (jail and filter conf files)
|
||||
#
|
||||
# usage: ynh_add_fail2ban_config log_file filter [max_retry [ports]]
|
||||
# | arg: log_file - Log file to be checked by fail2ban
|
||||
# | arg: failregex - Failregex to be looked for by fail2ban
|
||||
# | arg: max_retry - Maximum number of retries allowed before banning IP address - default: 3
|
||||
# | arg: ports - Ports blocked for a banned IP address - default: http,https
|
||||
# | arg: -l, --logpath= - Log file to be checked by fail2ban
|
||||
# | arg: -r, --failregex= - Failregex to be looked for by fail2ban
|
||||
# | arg: -m, --max_retry= - Maximum number of retries allowed before banning IP address - default: 3
|
||||
# | arg: -p, --ports= - Ports blocked for a banned IP address - default: http,https
|
||||
ynh_add_fail2ban_config () {
|
||||
# Process parameters
|
||||
logpath=$1
|
||||
failregex=$2
|
||||
max_retry=${3:-3}
|
||||
ports=${4:-http,https}
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [l]=logpath= [r]=failregex= [m]=max_retry= [p]=ports= )
|
||||
local logpath
|
||||
local failregex
|
||||
local max_retry
|
||||
local ports
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
max_retry=${max_retry:-3}
|
||||
ports=${ports:-http,https}
|
||||
|
||||
test -n "$logpath" || ynh_die "ynh_add_fail2ban_config expects a logfile path as first argument and received nothing."
|
||||
test -n "$failregex" || ynh_die "ynh_add_fail2ban_config expects a failure regex as second argument and received nothing."
|
||||
test -n "$logpath" || ynh_die "ynh_add_fail2ban_config expects a logfile path as first argument and received nothing."
|
||||
test -n "$failregex" || ynh_die "ynh_add_fail2ban_config expects a failure regex as second argument and received nothing."
|
||||
|
||||
finalfail2banjailconf="/etc/fail2ban/jail.d/$app.conf"
|
||||
finalfail2banfilterconf="/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_backup_if_checksum_is_different "$finalfail2banjailconf" 1
|
||||
ynh_backup_if_checksum_is_different "$finalfail2banfilterconf" 1
|
||||
finalfail2banjailconf="/etc/fail2ban/jail.d/$app.conf"
|
||||
finalfail2banfilterconf="/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_backup_if_checksum_is_different "$finalfail2banjailconf" 1
|
||||
ynh_backup_if_checksum_is_different "$finalfail2banfilterconf" 1
|
||||
|
||||
sudo tee $finalfail2banjailconf <<EOF
|
||||
tee $finalfail2banjailconf <<EOF
|
||||
[$app]
|
||||
enabled = true
|
||||
port = $ports
|
||||
|
@ -524,7 +371,7 @@ logpath = $logpath
|
|||
maxretry = $max_retry
|
||||
EOF
|
||||
|
||||
sudo tee $finalfail2banfilterconf <<EOF
|
||||
tee $finalfail2banfilterconf <<EOF
|
||||
[INCLUDES]
|
||||
before = common.conf
|
||||
[Definition]
|
||||
|
@ -532,25 +379,33 @@ failregex = $failregex
|
|||
ignoreregex =
|
||||
EOF
|
||||
|
||||
ynh_store_file_checksum "$finalfail2banjailconf"
|
||||
ynh_store_file_checksum "$finalfail2banfilterconf"
|
||||
ynh_store_file_checksum "$finalfail2banjailconf"
|
||||
ynh_store_file_checksum "$finalfail2banfilterconf"
|
||||
|
||||
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
|
||||
if [ "$(lsb_release --codename --short)" != "jessie" ]; then
|
||||
systemctl reload fail2ban
|
||||
else
|
||||
systemctl restart fail2ban
|
||||
fi
|
||||
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)
|
||||
#
|
||||
# usage: ynh_remove_fail2ban_config
|
||||
ynh_remove_fail2ban_config () {
|
||||
ynh_secure_remove "/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_secure_remove "/etc/fail2ban/filter.d/$app.conf"
|
||||
systemctl restart fail2ban
|
||||
ynh_secure_remove "/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_secure_remove "/etc/fail2ban/filter.d/$app.conf"
|
||||
if [ "$(lsb_release --codename --short)" != "jessie" ]; then
|
||||
systemctl reload fail2ban
|
||||
else
|
||||
systemctl restart fail2ban
|
||||
fi
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
@ -558,12 +413,17 @@ ynh_remove_fail2ban_config () {
|
|||
# Read the value of a key in a ynh manifest file
|
||||
#
|
||||
# usage: ynh_read_manifest manifest key
|
||||
# | arg: manifest - Path of the manifest to read
|
||||
# | arg: key - Name of the key to find
|
||||
# | arg: -m, --manifest= - Path of the manifest to read
|
||||
# | arg: -k, --key= - Name of the key to find
|
||||
ynh_read_manifest () {
|
||||
manifest="$1"
|
||||
key="$2"
|
||||
python3 -c "import sys, json;print(json.load(open('$manifest', encoding='utf-8'))['$key'])"
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [m]=manifest= [k]=manifest_key= )
|
||||
local manifest
|
||||
local manifest_key
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
|
||||
python3 -c "import sys, json;print(json.load(open('$manifest', encoding='utf-8'))['$manifest_key'])"
|
||||
}
|
||||
|
||||
# Read the upstream version from the manifest
|
||||
|
@ -572,16 +432,21 @@ ynh_read_manifest () {
|
|||
# This include the number before ~ynh
|
||||
# In the last example it return 4.3-2
|
||||
#
|
||||
# usage: ynh_app_upstream_version
|
||||
# usage: ynh_app_upstream_version [-m manifest]
|
||||
# | arg: -m, --manifest= - Path of the manifest to read
|
||||
ynh_app_upstream_version () {
|
||||
manifest_path="../manifest.json"
|
||||
if [ ! -e "$manifest_path" ]; then
|
||||
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
|
||||
fi
|
||||
version_key=$(ynh_read_manifest "$manifest_path" "version")
|
||||
echo "${version_key/~ynh*/}"
|
||||
}
|
||||
declare -Ar args_array=( [m]=manifest= )
|
||||
local manifest
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
|
||||
manifest="${manifest:-../manifest.json}"
|
||||
if [ ! -e "$manifest" ]; then
|
||||
manifest="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
|
||||
fi
|
||||
version_key=$(ynh_read_manifest --manifest="$manifest" --manifest_key="version")
|
||||
echo "${version_key/~ynh*/}"
|
||||
}
|
||||
|
||||
# Read package version from the manifest
|
||||
# The version number in the manifest is defined by <upstreamversion>~ynh<packageversion>
|
||||
|
@ -589,14 +454,20 @@ ynh_app_upstream_version () {
|
|||
# This include the number after ~ynh
|
||||
# In the last example it return 3
|
||||
#
|
||||
# usage: ynh_app_package_version
|
||||
# usage: ynh_app_package_version [-m manifest]
|
||||
# | arg: -m, --manifest= - Path of the manifest to read
|
||||
ynh_app_package_version () {
|
||||
manifest_path="../manifest.json"
|
||||
if [ ! -e "$manifest_path" ]; then
|
||||
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
|
||||
fi
|
||||
version_key=$(ynh_read_manifest "$manifest_path" "version")
|
||||
echo "${version_key/*~ynh/}"
|
||||
declare -Ar args_array=( [m]=manifest= )
|
||||
local manifest
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
|
||||
manifest="${manifest:-../manifest.json}"
|
||||
if [ ! -e "$manifest" ]; then
|
||||
manifest="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
|
||||
fi
|
||||
version_key=$(ynh_read_manifest --manifest="$manifest" --manifest_key="version")
|
||||
echo "${version_key/*~ynh/}"
|
||||
}
|
||||
|
||||
# Checks the app version to upgrade with the existing app version and returns:
|
||||
|
@ -611,37 +482,148 @@ ynh_app_package_version () {
|
|||
# To force an upgrade, even if the package is up to date,
|
||||
# you have to set the variable YNH_FORCE_UPGRADE before.
|
||||
# example: sudo YNH_FORCE_UPGRADE=1 yunohost app upgrade MyApp
|
||||
|
||||
#
|
||||
# usage: ynh_check_app_version_changed
|
||||
ynh_check_app_version_changed () {
|
||||
local force_upgrade=${YNH_FORCE_UPGRADE:-0}
|
||||
local package_check=${PACKAGE_CHECK_EXEC:-0}
|
||||
local force_upgrade=${YNH_FORCE_UPGRADE:-0}
|
||||
local package_check=${PACKAGE_CHECK_EXEC:-0}
|
||||
|
||||
# By default, upstream app version has changed
|
||||
local return_value="UPGRADE_APP"
|
||||
# By default, upstream app version has changed
|
||||
local return_value="UPGRADE_APP"
|
||||
|
||||
local current_version=$(ynh_read_manifest "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" "version" || echo 1.0)
|
||||
local current_upstream_version="${current_version/~ynh*/}"
|
||||
local update_version=$(ynh_read_manifest "../manifest.json" "version" || echo 1.0)
|
||||
local update_upstream_version="${update_version/~ynh*/}"
|
||||
local current_version=$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version" || echo 1.0)
|
||||
local current_upstream_version="$(ynh_app_upstream_version --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json")"
|
||||
local update_version=$(ynh_read_manifest --manifest="../manifest.json" --manifest_key="version" || echo 1.0)
|
||||
local update_upstream_version="$(ynh_app_upstream_version)"
|
||||
|
||||
if [ "$current_version" == "$update_version" ] ; then
|
||||
# Complete versions are the same
|
||||
if [ "$force_upgrade" != "0" ]
|
||||
then
|
||||
echo "Upgrade forced by YNH_FORCE_UPGRADE." >&2
|
||||
unset YNH_FORCE_UPGRADE
|
||||
elif [ "$package_check" != "0" ]
|
||||
then
|
||||
echo "Upgrade forced for package check." >&2
|
||||
else
|
||||
ynh_die "Up-to-date, nothing to do" 0
|
||||
fi
|
||||
elif [ "$current_upstream_version" == "$update_upstream_version" ] ; then
|
||||
# Upstream versions are the same, only YunoHost package versions differ
|
||||
return_value="UPGRADE_PACKAGE"
|
||||
fi
|
||||
echo $return_value
|
||||
if [ "$current_version" == "$update_version" ] ; then
|
||||
# Complete versions are the same
|
||||
if [ "$force_upgrade" != "0" ]
|
||||
then
|
||||
echo "Upgrade forced by YNH_FORCE_UPGRADE." >&2
|
||||
unset YNH_FORCE_UPGRADE
|
||||
elif [ "$package_check" != "0" ]
|
||||
then
|
||||
echo "Upgrade forced for package check." >&2
|
||||
else
|
||||
ynh_die "Up-to-date, nothing to do" 0
|
||||
fi
|
||||
elif [ "$current_upstream_version" == "$update_upstream_version" ] ; then
|
||||
# Upstream versions are the same, only YunoHost package versions differ
|
||||
return_value="UPGRADE_PACKAGE"
|
||||
fi
|
||||
echo $return_value
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
||||
# Delete a file checksum from the app settings
|
||||
#
|
||||
# $app should be defined when calling this helper
|
||||
#
|
||||
# usage: ynh_remove_file_checksum file
|
||||
# | arg: -f, --file= - The file for which the checksum will be deleted
|
||||
ynh_delete_file_checksum () {
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [f]=file= )
|
||||
local file
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
|
||||
local checksum_setting_name=checksum_${file//[\/ ]/_} # Replace all '/' and ' ' by '_'
|
||||
ynh_app_setting_delete $app $checksum_setting_name
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
# Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started
|
||||
#
|
||||
# usage: ynh_systemd_action [-n service_name] [-a action] [ [-l "line to match"] [-p log_path] [-t timeout] [-e length] ]
|
||||
# | arg: -n, --service_name= - Name of the service to reload. Default : $app
|
||||
# | arg: -a, --action= - Action to perform with systemctl. Default: start
|
||||
# | arg: -l, --line_match= - Line to match - The line to find in the log to attest the service have finished to boot.
|
||||
# If not defined it don't wait until the service is completely started.
|
||||
# | arg: -p, --log_path= - Log file - Path to the log file. Default : /var/log/$app/$app.log
|
||||
# | arg: -t, --timeout= - Timeout - The maximum time to wait before ending the watching. Default : 300 seconds.
|
||||
# | arg: -e, --length= - Length of the error log : Default : 20
|
||||
ynh_systemd_action() {
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length= )
|
||||
local service_name
|
||||
local action
|
||||
local line_match
|
||||
local length
|
||||
local log_path
|
||||
local timeout
|
||||
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
|
||||
local service_name="${service_name:-$app}"
|
||||
local action=${action:-start}
|
||||
local log_path="${log_path:-/var/log/$service_name/$service_name.log}"
|
||||
local length=${length:-20}
|
||||
local timeout=${timeout:-300}
|
||||
|
||||
# Start to read the log
|
||||
if [[ -n "${line_match:-}" ]]
|
||||
then
|
||||
local templog="$(mktemp)"
|
||||
# Following the starting of the app in its log
|
||||
if [ "$log_path" == "systemd" ] ; then
|
||||
# Read the systemd journal
|
||||
journalctl -u $service_name -f --since=-45 > "$templog" &
|
||||
else
|
||||
# Read the specified log file
|
||||
tail -F -n0 "$log_path" > "$templog" &
|
||||
fi
|
||||
# Get the PID of the tail command
|
||||
local pid_tail=$!
|
||||
fi
|
||||
|
||||
echo "${action^} the service $service_name" >&2
|
||||
systemctl $action $service_name \
|
||||
|| ( journalctl --lines=$length -u $service_name >&2 \
|
||||
; test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2 \
|
||||
; false )
|
||||
|
||||
# Start the timeout and try to find line_match
|
||||
if [[ -n "${line_match:-}" ]]
|
||||
then
|
||||
local i=0
|
||||
for i in $(seq 1 $timeout)
|
||||
do
|
||||
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
|
||||
if grep --quiet "$line_match" "$templog"
|
||||
then
|
||||
echo "The service $service_name has correctly started." >&2
|
||||
break
|
||||
fi
|
||||
echo -n "." >&2
|
||||
sleep 1
|
||||
done
|
||||
if [ $i -eq $timeout ]
|
||||
then
|
||||
echo "The service $service_name didn't fully started before the timeout." >&2
|
||||
journalctl --lines=$length -u $service_name >&2
|
||||
test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2
|
||||
fi
|
||||
|
||||
echo ""
|
||||
ynh_clean_check_starting
|
||||
fi
|
||||
}
|
||||
|
||||
# Clean temporary process and file used by ynh_check_starting
|
||||
# (usually used in ynh_clean_setup scripts)
|
||||
#
|
||||
# usage: ynh_clean_check_starting
|
||||
ynh_clean_check_starting () {
|
||||
# Stop the execution of tail.
|
||||
kill -s 15 $pid_tail 2>&1
|
||||
ynh_secure_remove "$templog" 2>&1
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
@ -715,26 +697,6 @@ $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
|
|||
|
||||
#=================================================
|
||||
|
||||
# Reload (or other actions) a service and print a log in case of failure.
|
||||
#
|
||||
# usage: ynh_system_reload service_name [action]
|
||||
# | arg: -n, --service_name= - Name of the service to reload
|
||||
# | arg: -a, --action= - Action to perform with systemctl. Default: reload
|
||||
ynh_system_reload () {
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [n]=service_name= [a]=action= )
|
||||
local service_name
|
||||
local action
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
local action=${action:-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
|
||||
}
|
||||
|
@ -759,19 +721,6 @@ is_jessie () {
|
|||
|
||||
#=================================================
|
||||
|
||||
# Delete a file checksum from the app settings
|
||||
#
|
||||
# $app should be defined when calling this helper
|
||||
#
|
||||
# usage: ynh_remove_file_checksum file
|
||||
# | arg: file - The file for which the checksum will be deleted
|
||||
ynh_delete_file_checksum () {
|
||||
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
|
||||
ynh_app_setting_delete $app $checksum_setting_name
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
||||
ynh_maintenance_mode_ON () {
|
||||
# Load value of $path_url and $domain from the config if their not set
|
||||
if [ -z $path_url ]; then
|
||||
|
@ -848,3 +797,63 @@ ynh_maintenance_mode_OFF () {
|
|||
|
||||
systemctl reload nginx
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
||||
# Download and check integrity of a file from app.src_file
|
||||
#
|
||||
# The file conf/app.src_file need to contains:
|
||||
#
|
||||
# FILE_URL=Address to download the file
|
||||
# FILE_SUM=Control sum
|
||||
# # (Optional) Program to check the integrity (sha256sum, md5sum...)
|
||||
# # default: sha256
|
||||
# FILE_SUM_PRG=sha256
|
||||
# # (Optionnal) Name of the local archive (offline setup support)
|
||||
# # default: Name of the downloaded file.
|
||||
# FILENAME=example.deb
|
||||
#
|
||||
# usage: ynh_download_file --dest_dir="/destination/directory" [--source_id=myfile]
|
||||
# | arg: -d, --dest_dir= - Directory where to download the file
|
||||
# | arg: -s, --source_id= - Name of the source file 'app.src_file' if it isn't '$app'
|
||||
ynh_download_file () {
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [d]=dest_dir= [s]=source_id= )
|
||||
local dest_dir
|
||||
local source_id
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
|
||||
source_id=${source_id:-app} # If the argument is not given, source_id equals "$app"
|
||||
|
||||
# Load value from configuration file (see above for a small doc about this file
|
||||
# format)
|
||||
local file_url=$(grep 'FILE_URL=' "$YNH_CWD/../conf/${source_id}.src_file" | cut -d= -f2-)
|
||||
local file_sum=$(grep 'FILE_SUM=' "$YNH_CWD/../conf/${source_id}.src_file" | cut -d= -f2-)
|
||||
local file_sumprg=$(grep 'FILE_SUM_PRG=' "$YNH_CWD/../conf/${source_id}.src_file" | cut -d= -f2-)
|
||||
local filename=$(grep 'FILENAME=' "$YNH_CWD/../conf/${source_id}.src_file" | cut -d= -f2-)
|
||||
|
||||
# Default value
|
||||
file_sumprg=${file_sumprg:-sha256sum}
|
||||
if [ "$filename" = "" ] ; then
|
||||
filename="$(basename "$file_url")"
|
||||
fi
|
||||
local local_src="/opt/yunohost-apps-src/${YNH_APP_ID}/${filename}"
|
||||
|
||||
if test -e "$local_src"
|
||||
then # Use the local source file if it is present
|
||||
cp $local_src $filename
|
||||
else # If not, download the source
|
||||
local out=`wget -nv -O $filename $file_url 2>&1` || ynh_print_err $out
|
||||
fi
|
||||
|
||||
# Check the control sum
|
||||
echo "${file_sum} ${filename}" | ${file_sumprg} -c --status \
|
||||
|| ynh_die "Corrupt file"
|
||||
|
||||
# Create the destination directory, if it's not already.
|
||||
mkdir -p "$dest_dir"
|
||||
|
||||
# Move the file to its destination
|
||||
mv $filename $dest_dir
|
||||
}
|
||||
|
|
|
@ -54,14 +54,14 @@ then
|
|||
endofbusiness=$(ynh_app_setting_get $app endofbusiness)
|
||||
defaulteventduration=$(ynh_app_setting_get $app defaulteventduration)
|
||||
|
||||
# Ajoute InfCloud dans la config Nginx
|
||||
# Add InfCloud to nginx config
|
||||
ynh_replace_string "#INFCLOUD#" "" /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
# Install InfCloud
|
||||
(YNH_CWD="$YNH_CWD/scripts"; ynh_setup_source "$final_path/infcloud")
|
||||
|
||||
# Configuration de InfCloud
|
||||
# Détermine la langue
|
||||
# InfCloud configuration
|
||||
# Set language
|
||||
case "$language" in
|
||||
"Czech") language="cs_CZ"
|
||||
;;
|
||||
|
@ -120,7 +120,8 @@ then
|
|||
if [ -n "$defaulteventduration" ]; then
|
||||
ynh_replace_string "\(^var globalDefaultEventDuration=\).*" "\1$defaulteventduration;" "$final_path/infcloud/config.js"
|
||||
fi
|
||||
ynh_store_file_checksum "$final_path/infcloud/config.js" # Réenregistre la somme de contrôle du fichier de config
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum "$final_path/infcloud/config.js"
|
||||
|
||||
# Fix permission
|
||||
chown -R radicale: $final_path
|
||||
|
@ -129,13 +130,13 @@ then
|
|||
(cd scripts; ynh_add_fpm_config)
|
||||
|
||||
# Setup SSOWat
|
||||
# /infcloud vient se rajouter à l'adresse de radicale pour y être associé sur le portail.
|
||||
# Remplace radicale par InfCloud dans le portail Yunohost
|
||||
# Add /infcloud to the path of radicale to access it from the portal
|
||||
# Replace radicale by InfCloud into YunoHost portal
|
||||
ynh_app_setting_set $app path ${path_url%/}/infcloud
|
||||
# Protège l'accès à infcloud
|
||||
# Protect InfCloud access
|
||||
ynh_app_setting_set $app protected_uris "/"
|
||||
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
||||
# Radicale est accessible librement (pour l'accès distant aux ressources)
|
||||
# Radicale is always accessible (For access to ressources)
|
||||
ynh_app_setting_set $app skipped_regex "$domain_regex$path_url"
|
||||
# Remove the previous entry for unprotected_uris
|
||||
ynh_app_setting_delete $app unprotected_uris
|
||||
|
@ -153,13 +154,13 @@ else
|
|||
ynh_remove_fpm_config
|
||||
|
||||
# Setup SSOWat
|
||||
# Remplace InfCloud par radicale dans le portail Yunohost
|
||||
# Replace InfCloud by radicale into YunoHost portal
|
||||
ynh_app_setting_set $app path $path_url
|
||||
# Remove the previous entry for protected_uris and skipped_regex
|
||||
ynh_app_setting_delete $app protected_uris
|
||||
ynh_app_setting_delete $app skipped_regex
|
||||
|
||||
# Radicale est accessible librement (pour l'accès distant aux ressources)
|
||||
# Radicale is always accessible (For access to ressources)
|
||||
ynh_app_setting_set $app unprotected_uris "/"
|
||||
fi
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ then
|
|||
cp /etc/yunohost/apps/$app/conf/config.js "$config_file"
|
||||
|
||||
# Recreate the default config
|
||||
# Détermine la langue
|
||||
# Set language
|
||||
case "$language" in
|
||||
"Czech") language="cs_CZ"
|
||||
;;
|
||||
|
@ -145,4 +145,4 @@ fi
|
|||
ynh_store_file_checksum "$config_file"
|
||||
|
||||
# Restart uwsgi to restart radicale
|
||||
ynh_system_reload --service_name=uwsgi --action=restart
|
||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
||||
|
|
|
@ -20,7 +20,6 @@ ynh_abort_if_errors
|
|||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
|
||||
# Récupère les infos de l'application.
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
|
@ -30,7 +29,7 @@ infcloud=$(ynh_app_setting_get $app infcloud)
|
|||
#=================================================
|
||||
# STANDARD BACKUP STEPS
|
||||
#=================================================
|
||||
# BACKUP OF THE MAIN DIR OF THE APP
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
CHECK_SIZE "$final_path"
|
||||
|
@ -39,38 +38,37 @@ CHECK_SIZE "/opt/yunohost/$app"
|
|||
ynh_backup "/opt/yunohost/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP OF THE NGINX CONFIGURATION
|
||||
# BACKUP NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP OF THE PHP-FPM CONFIGURATION
|
||||
# BACKUP PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
if [ $infcloud -eq 1 ]
|
||||
then
|
||||
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
||||
ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
# BACKUP OF THE UWSGI CONFIG
|
||||
# BACKUP UWSGI CONFIG
|
||||
#=================================================
|
||||
|
||||
ynh_backup "/etc/uwsgi/apps-available/radicale.ini"
|
||||
|
||||
#=================================================
|
||||
# BACKUP OF THE RADICALE CONFIGURATION
|
||||
# BACKUP RADICALE CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
CHECK_SIZE "/etc/$app"
|
||||
ynh_backup "/etc/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP OF THE LOGROTATE CONFIGURATION
|
||||
# BACKUP LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup "/etc/logrotate.d/$app"
|
||||
|
|
|
@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get $app final_path)
|
|||
# CHECK THE SYNTAX OF THE PATHS
|
||||
#=================================================
|
||||
|
||||
# Remove /infcloud in old_path
|
||||
# Remove /infcloud in $old_path
|
||||
if [ $infcloud -eq 1 ]
|
||||
then
|
||||
old_path="${old_path%/infcloud}"
|
||||
|
@ -127,17 +127,19 @@ fi
|
|||
#=================================================
|
||||
|
||||
if [ $infcloud -eq 1 ]
|
||||
then # /infcloud vient se rajouter à l'adresse de radicale pour y être associé sur le portail.
|
||||
then
|
||||
# Add /infcloud to the path of radicale to access it from the portal
|
||||
echo "sudo yunohost --verbose app setting $app path -v \"${new_path%/}/infcloud\"; sudo yunohost app ssowatconf" | at now + 1 min >&2
|
||||
domain_regex=$(echo "$new_domain" | sed 's@-@.@g')
|
||||
ynh_app_setting_set $app skipped_regex "$domain_regex$new_path" # Radicale est accessible librement (pour l'accès distant aux ressources)
|
||||
# Radicale is always accessible (For access to ressources)
|
||||
ynh_app_setting_set $app skipped_regex "$domain_regex$new_path"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RESTART UWSGI
|
||||
#=================================================
|
||||
|
||||
ynh_system_reload --service_name=uwsgi --action=restart
|
||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
|
@ -145,7 +147,7 @@ ynh_system_reload --service_name=uwsgi --action=restart
|
|||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
||||
ynh_system_reload --service_name=nginx
|
||||
ynh_systemd_action --action=reload --service_name=nginx
|
||||
|
||||
#=================================================
|
||||
# DEACTIVE MAINTENANCE MODE
|
||||
|
|
|
@ -15,7 +15,8 @@ source _variables
|
|||
# MANAGE FAILURE OF THE SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
|
@ -29,7 +30,8 @@ language=$YNH_APP_ARG_LANGUAGE
|
|||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
version=$(grep '\"version\": ' ../manifest.json | cut -d '"' -f 4 | cut -d '~' -f 1) # Retrieve the version number in the manifest file.
|
||||
# Retrieve the version number in the manifest file.
|
||||
version=$(ynh_app_upstream_version)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
||||
|
@ -41,8 +43,6 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
|||
# Normalize the url path syntax
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
|
||||
# Check web path availability
|
||||
ynh_webpath_available $domain $path_url
|
||||
# Register (book) web path
|
||||
ynh_webpath_register $app $domain $path_url
|
||||
|
||||
|
@ -75,7 +75,8 @@ ynh_install_app_dependencies $app_depencencies
|
|||
|
||||
ynh_add_nginx_config
|
||||
if [ $infcloud -eq 1 ]
|
||||
then # Ajoute InfCloud dans la config Nginx
|
||||
then
|
||||
# Add InfCloud in Nginx config
|
||||
ynh_replace_string "#INFCLOUD#" "" /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
fi
|
||||
ynh_store_file_checksum "$finalnginxconf"
|
||||
|
@ -84,7 +85,8 @@ ynh_store_file_checksum "$finalnginxconf"
|
|||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
ynh_system_user_create $app # Créer un utilisateur système dédié à l'app
|
||||
# Create a dedicated system user
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
|
@ -101,23 +103,28 @@ version=$(ynh_app_setting_get $app version $version)
|
|||
# COPY FILES INTO $FINAL_PATH
|
||||
#=================================================
|
||||
|
||||
# Crée le repertoire de destination et stocke son emplacement.
|
||||
# Create the directory and set the path in the config
|
||||
mkdir "$final_path"
|
||||
ynh_app_setting_set $app final_path $final_path
|
||||
|
||||
# Copy files to the right place
|
||||
mkdir -p $final_path/collections
|
||||
cp ../conf/radicale.wsgi $final_path
|
||||
# Copie les fichiers additionnels ou modifiés.
|
||||
# Copy extra files
|
||||
cp -a ../sources/extra_files_radicale/. "$final_path"
|
||||
# Le fichier regex.py est patché pour corrigé le commit destructeur e807c3d35bea9cfcfcacac83b1b17d748ea15a39 du 3/12/2015 qui arrête la lecture du fichier rights à la première occurence validée.
|
||||
# regex.py file is patched to fix the awful commit e807c3d35bea9cfcfcacac83b1b17d748ea15a39 that stop the reading of "rights" file after the first match.
|
||||
mv "$final_path/regex.py" /opt/yunohost/$app/lib/python*/site-packages/radicale/rights/regex.py
|
||||
if [ $infcloud -eq 1 ]
|
||||
then #Instal InfCloud
|
||||
final_path_backup=$final_path # Sauvegarde le contenu de $final_path
|
||||
final_path=$final_path/infcloud # Change final_path pour l'installation de infcloud
|
||||
ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie dans $final_path
|
||||
final_path=$final_path_backup # Restaure le contenu de $final_path
|
||||
then
|
||||
#Instal InfCloud
|
||||
# Backup the content of $final_path
|
||||
final_path_backup=$final_path
|
||||
# Modify final_path for InfCloud installation
|
||||
final_path=$final_path/infcloud
|
||||
# Download and uncompress the source into final_path
|
||||
ynh_setup_source "$final_path"
|
||||
# Restore the content of $final_path
|
||||
final_path=$final_path_backup
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -130,11 +137,14 @@ cp ../conf/logging /etc/$app/
|
|||
cp ../conf/rights /etc/$app/
|
||||
ynh_replace_string "__PATH__" "${path_url%/}" /etc/$app/config
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" /etc/$app/config
|
||||
ynh_store_file_checksum "/etc/$app/config" # Enregistre la somme de contrôle du fichier de config
|
||||
ynh_store_file_checksum "/etc/$app/logging" # Enregistre la somme de contrôle du fichier de config
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "/etc/$app/config"
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "/etc/$app/logging"
|
||||
if [ $infcloud -eq 1 ]
|
||||
then #Configuration InfCloud
|
||||
# Détermine la langue
|
||||
then
|
||||
# InfCloud configuration
|
||||
# Set language
|
||||
case "$language" in
|
||||
"Czech") language="cs_CZ"
|
||||
;;
|
||||
|
@ -174,7 +184,8 @@ then #Configuration InfCloud
|
|||
ynh_replace_string "__LANG__" "$language" "$final_path/infcloud/config.js"
|
||||
ynh_replace_string "__ADMIN__" "$admin" "$final_path/infcloud/config.js"
|
||||
ynh_replace_string "__TIMEZONE__" "$(cat /etc/timezone)" "$final_path/infcloud/config.js"
|
||||
ynh_store_file_checksum "$final_path/infcloud/config.js" # Enregistre la somme de contrôle du fichier de config
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "$final_path/infcloud/config.js"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -188,11 +199,11 @@ chown -R radicale: $final_path
|
|||
mkdir -p /var/log/$app
|
||||
touch /var/log/$app/$app.log
|
||||
chown radicale -R /var/log/$app
|
||||
# Droit par défaut des dossiers de collections utilisateurs, tels qu'ils sont créés par radicale.
|
||||
# Set default permissions as radicale do.
|
||||
chmod 666 -R $final_path/default_collections
|
||||
chmod 777 $final_path/default_collections $final_path/default_collections/USER
|
||||
|
||||
# Fix permission
|
||||
# Set permissions
|
||||
chmod 755 /etc/$app/
|
||||
find /opt/yunohost/$app/ -type d -exec chmod 2755 {} \;
|
||||
find /opt/yunohost/$app/ -type f -exec chmod g+r,o+r {} \;
|
||||
|
@ -209,27 +220,26 @@ ln -s /etc/uwsgi/apps-available/radicale.ini /etc/uwsgi/apps-enabled/
|
|||
# GENERATE CALENDARS AND ADDRESS BOOKS FOR ALL USERS
|
||||
#=================================================
|
||||
|
||||
# Créer les calendriers et carnets d'adresses par défaut des utilisateurs.
|
||||
while read user #USER en majuscule est une variable système, à éviter.
|
||||
# Create default calendars and address books for each users
|
||||
while read user
|
||||
do
|
||||
cp -a $final_path/default_collections/USER $final_path/collections/$user
|
||||
cp -a $final_path/default_collections/USER.props $final_path/collections/$user.props
|
||||
done <<< "$(yunohost user list | grep username | cut -d ":" -f 2 | cut -c 2-)" # Liste les utilisateurs et supprime l'espace après username:
|
||||
# Le triple chevron <<< permet de prendre la sortie de commande en entrée de boucle.
|
||||
# List all users and remove the space after username
|
||||
done <<< "$(yunohost user list | grep username | cut -d ":" -f 2 | cut -c 2-)"
|
||||
|
||||
#=================================================
|
||||
# ENABLE UWSGI SERVICE IN ADMIN PANEL
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
ynh_system_reload --service_name=uwsgi --action=restart
|
||||
# Ajoute le service au monitoring de Yunohost.
|
||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
||||
yunohost service add uwsgi --log "/var/log/uwsgi/app/radicale.log"
|
||||
|
||||
#=================================================
|
||||
# PREPARE THE HOOKS
|
||||
#=================================================
|
||||
|
||||
# Modification des hook pour la création des collections par défaut des nouveaux utilisateurs. Et leur suppression
|
||||
# Modify the hooks for create user collections and to remove them.
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_create
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_delete
|
||||
|
||||
|
@ -240,19 +250,26 @@ ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_delete
|
|||
#=================================================
|
||||
|
||||
if [ $infcloud -eq 1 ]
|
||||
then # /infcloud vient se rajouter à l'adresse de radicale pour y être associé sur le portail.
|
||||
ynh_app_setting_set $app path ${path_url%/}/infcloud # Remplace radicale par InfCloud dans le portail Yunohost
|
||||
ynh_app_setting_set $app protected_uris "/" # Protège l'accès à infcloud
|
||||
then
|
||||
# Add /infcloud to the path of radicale to access it from the portal
|
||||
# Replace radicale by InfCloud into YunoHost portal
|
||||
ynh_app_setting_set $app path ${path_url%/}/infcloud
|
||||
# Protect InfCloud access
|
||||
ynh_app_setting_set $app protected_uris "/"
|
||||
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
||||
ynh_app_setting_set $app skipped_regex "$domain_regex$path_url" # Radicale est accessible librement (pour l'accès distant aux ressources)
|
||||
else # Si seul radicale est installé.
|
||||
ynh_app_setting_set $app unprotected_uris "/" # Radicale est accessible librement (pour l'accès distant aux ressources)
|
||||
# Radicale is always accessible (For access to ressources)
|
||||
ynh_app_setting_set $app skipped_regex "$domain_regex$path_url"
|
||||
else
|
||||
# If only radicale is installed
|
||||
# Radicale is always accessible (For access to ressources)
|
||||
ynh_app_setting_set $app unprotected_uris "/"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate
|
||||
|
||||
#=================================================
|
||||
|
@ -261,14 +278,15 @@ ynh_use_logrotate
|
|||
|
||||
if [ $infcloud -eq 1 ]
|
||||
then
|
||||
ynh_add_fpm_config # Créer le fichier de configuration du pool php-fpm et le configure.
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
||||
ynh_system_reload --service_name=nginx
|
||||
ynh_systemd_action --action=reload --service_name=nginx
|
||||
|
||||
#=================================================
|
||||
# SEND A README FOR THE ADMIN
|
||||
|
@ -285,8 +303,8 @@ fi
|
|||
|
||||
message="Use the file /etc/radicale/config to change the main configuration of radicale.
|
||||
The file /etc/radicale/logging to change the level of logging.
|
||||
And the file /etc/radicale/rights to edit the way the calendars will be sharing.
|
||||
And the file /etc/radicale/rights to edit the way the calendars will be shared.
|
||||
$infcloud_config
|
||||
If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/radicale_ynh"
|
||||
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/radicale_ynh"
|
||||
|
||||
ynh_send_readme_to_admin --app_message="$message" --recipients="$admin"
|
||||
|
|
|
@ -23,8 +23,8 @@ domain=$(ynh_app_setting_get $app domain)
|
|||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
|
||||
# Suppression de la configuration uwsgi
|
||||
ynh_system_reload --service_name=uwsgi --action=stop
|
||||
# Delete uwsgi configuration
|
||||
ynh_systemd_action --action=stop --service_name=uwsgi
|
||||
if [ -h "/etc/uwsgi/apps-enabled/radicale.ini" ]; then
|
||||
echo "Delete uwsgi config"
|
||||
ynh_secure_remove "/etc/uwsgi/apps-enabled/radicale.ini"
|
||||
|
@ -35,51 +35,56 @@ ynh_secure_remove "/etc/uwsgi/apps-available/radicale.ini"
|
|||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MAIN DIR OF THE APP
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_secure_remove "/var/www/$app" # Suppression du dossier de l'application
|
||||
ynh_secure_remove "/var/www/$app"
|
||||
ynh_secure_remove "/opt/yunohost/$app"
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE NGINX CONFIGURATION
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_remove_nginx_config # Suppression de la configuration nginx
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE PHP-FPM CONFIGURATION
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_remove_fpm_config # Suppression de la configuration du pool php-fpm
|
||||
# Remove the dedicated php-fpm config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE LOGROTATE CONFIG
|
||||
# REMOVE LOGROTATE CONFIG
|
||||
#=================================================
|
||||
|
||||
ynh_remove_logrotate # Suppression de la configuration de logrotate
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE RADICALE'S CONFIG
|
||||
# REMOVE RADICALE CONFIG
|
||||
#=================================================
|
||||
|
||||
ynh_secure_remove "/etc/$app" # Delete radicale config
|
||||
ynh_secure_remove "/etc/$app"
|
||||
|
||||
#=================================================
|
||||
# DISABLE SERVICE IN ADMIN PANEL
|
||||
# REMOVE SERVICE FROM ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
if [ -e /etc/init.d/uwsgi ]
|
||||
then
|
||||
# Redémarre le service uwsgi si il n'est pas désinstallé.
|
||||
ynh_system_reload --service_name=uwsgi --action=start
|
||||
# Restart uwsgi service
|
||||
ynh_systemd_action --action=start --service_name=uwsgi
|
||||
else
|
||||
if yunohost service status | grep -q uwsgi # Test l'existence du service dans Yunohost
|
||||
# Check if the service is declared in YunoHost
|
||||
if yunohost service status | grep -q uwsgi
|
||||
then
|
||||
ynh_print_info "Remove uwsgi service" >&2
|
||||
yunohost service remove uwsgi
|
||||
|
|
|
@ -50,19 +50,19 @@ ynh_maintenance_mode_ON
|
|||
#=================================================
|
||||
# STANDARD RESTORE STEPS
|
||||
#=================================================
|
||||
# RESTORE OF THE NGINX CONFIGURATION
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
ynh_install_app_dependencies $app_depencencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE OF THE MAIN DIR OF THE APP
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file "$final_path"
|
||||
|
@ -70,20 +70,20 @@ mkdir -p /opt/yunohost
|
|||
ynh_restore_file "/opt/yunohost/$app"
|
||||
|
||||
#=================================================
|
||||
# RECREATE OF THE DEDICATED USER
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
ynh_system_user_create $app # Recreate the dedicated user, if not exist
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# RESTORE OF THE PHP-FPM CONFIGURATION
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
if [ $infcloud -eq 1 ]
|
||||
then
|
||||
ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
|
||||
ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini"
|
||||
ynh_system_reload --service_name=php5-fpm
|
||||
ynh_systemd_action --action=reload --service_name=php5-fpm
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -106,7 +106,7 @@ chown radicale -R /var/log/$app
|
|||
ynh_restore_file "/etc/uwsgi/apps-available/radicale.ini"
|
||||
ln -s /etc/uwsgi/apps-available/radicale.ini /etc/uwsgi/apps-enabled/
|
||||
|
||||
# Ajoute le service au monitoring de Yunohost.
|
||||
# Advertise service in admin panel
|
||||
yunohost service add uwsgi --log "/var/log/uwsgi/app/radicale.log"
|
||||
|
||||
#=================================================
|
||||
|
@ -127,8 +127,8 @@ ynh_restore_file "/etc/logrotate.d/$app"
|
|||
# RELOAD NGINX AND UWSGI
|
||||
#=================================================
|
||||
|
||||
ynh_system_reload --service_name=uwsgi --action=restart
|
||||
ynh_system_reload --service_name=nginx
|
||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
||||
ynh_systemd_action --action=reload --service_name=nginx
|
||||
|
||||
#=================================================
|
||||
# DEACTIVE MAINTENANCE MODE
|
||||
|
@ -151,8 +151,8 @@ fi
|
|||
|
||||
message="Use the file /etc/radicale/config to change the main configuration of radicale.
|
||||
The file /etc/radicale/logging to change the level of logging.
|
||||
And the file /etc/radicale/rights to edit the way the calendars will be sharing.
|
||||
And the file /etc/radicale/rights to edit the way the calendars will be shared.
|
||||
$infcloud_config
|
||||
If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/radicale_ynh"
|
||||
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/radicale_ynh"
|
||||
|
||||
ynh_send_readme_to_admin --app_message="$message" --recipients="$admin"
|
||||
|
|
|
@ -56,12 +56,14 @@ fi
|
|||
|
||||
if [ -z "$version" ]
|
||||
then
|
||||
version=$(grep '\"version\": ' ../manifest.json | cut -d '"' -f 4 | cut -d '~' -f 1) # Retrieve the version number in the manifest file.
|
||||
# Retrieve the version number in the manifest file.
|
||||
version=$(ynh_app_upstream_version)
|
||||
ynh_app_setting_set $app version "$version"
|
||||
fi
|
||||
|
||||
# Fix infcloud as a boolean
|
||||
if [ "$infcloud" = "Yes" ]; then
|
||||
ynh_app_setting_set $app infcloud 1 # Fixe infcloud en booléen
|
||||
ynh_app_setting_set $app infcloud 1
|
||||
infcloud=1
|
||||
elif [ "$infcloud" = "No" ]; then
|
||||
ynh_app_setting_set $app infcloud 0
|
||||
|
@ -116,9 +118,11 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
|
||||
if [ $infcloud -eq 1 ]; then
|
||||
path_url=$(echo $path_url | sed "s@/infcloud@@") # Retire /infcloud pour traiter le path seul.
|
||||
# Remove /infcloud to deal with the path only.
|
||||
path_url=$(echo $path_url | sed "s@/infcloud@@")
|
||||
fi
|
||||
path_url=$(ynh_normalize_url_path $path_url) # Vérifie et corrige la syntaxe du path.
|
||||
# Normalize the URL path syntax
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
|
||||
#=================================================
|
||||
# ACTIVATE MAINTENANCE MODE
|
||||
|
@ -137,7 +141,8 @@ if [ $overwrite_nginx -eq 1 ]
|
|||
then
|
||||
ynh_add_nginx_config
|
||||
if [ $infcloud -eq 1 ]
|
||||
then # Ajoute InfCloud dans la config Nginx
|
||||
then
|
||||
# Add InfCloud in Nginx config
|
||||
ynh_replace_string "#INFCLOUD#" "" /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
fi
|
||||
ynh_store_file_checksum "$finalnginxconf"
|
||||
|
@ -147,7 +152,8 @@ fi
|
|||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
ynh_system_user_create $app # Create the dedicated user, if not exist
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
|
||||
if [ $infcloud -eq 1 ]
|
||||
then
|
||||
|
@ -158,7 +164,8 @@ then
|
|||
# Overwrite the php-fpm configuration only if it's allowed
|
||||
if [ $overwrite_phpfpm -eq 1 ]
|
||||
then
|
||||
ynh_add_fpm_config # Créer le fichier de configuration du pool php-fpm et le configure.
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -184,25 +191,30 @@ fi
|
|||
# Copy files to the right place
|
||||
mkdir -p $final_path/collections
|
||||
cp ../conf/radicale.wsgi $final_path
|
||||
# Copie les fichiers additionnels ou modifiés.
|
||||
# Copy extra files
|
||||
cp -a ../sources/extra_files_radicale/. "$final_path"
|
||||
# Le fichier regex.py est patché pour corrigé le commit destructeur e807c3d35bea9cfcfcacac83b1b17d748ea15a39 du 3/12/2015 qui arrête la lecture du fichier rights à la première occurence validée.
|
||||
# regex.py file is patched to fix the awful commit e807c3d35bea9cfcfcacac83b1b17d748ea15a39 that stop the reading of "rights" file after the first match.
|
||||
mv "$final_path/regex.py" /opt/yunohost/$app/lib/python*/site-packages/radicale/rights/regex.py
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
if [ "$infcloud" = "1" ]
|
||||
then #Instal InfCloud
|
||||
final_path_backup=$final_path # Sauvegarde le contenu de $final_path
|
||||
final_path=$final_path/infcloud # Change final_path pour l'installation de infcloud
|
||||
then
|
||||
#Instal InfCloud
|
||||
# Backup the content of $final_path
|
||||
final_path_backup=$final_path
|
||||
# Modify final_path for InfCloud installation
|
||||
final_path=$final_path/infcloud
|
||||
# If overwrite_infcloud is 0, copy the config file, then restore it.
|
||||
if [ $overwrite_infcloud -eq 0 ]; then
|
||||
cp -a $final_path/config.js ./config.js
|
||||
fi
|
||||
ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie dans $final_path
|
||||
# Download and uncompress the source into final_path
|
||||
ynh_setup_source "$final_path"
|
||||
if [ $overwrite_infcloud -eq 0 ]; then
|
||||
mv ./config.js $final_path/config.js
|
||||
fi
|
||||
final_path=$final_path_backup # Restaure le contenu de $final_path
|
||||
# Restore the content of $final_path
|
||||
final_path=$final_path_backup
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -213,27 +225,32 @@ fi
|
|||
# Overwrite the logging config file only if it's allowed
|
||||
if [ $overwrite_logging -eq 1 ]
|
||||
then
|
||||
ynh_backup_if_checksum_is_different "/etc/$app/logging" # Créé un backup du fichier de config si il a été modifié.
|
||||
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||
ynh_backup_if_checksum_is_different "/etc/$app/logging"
|
||||
cp ../conf/logging /etc/$app/
|
||||
ynh_store_file_checksum "/etc/$app/logging" # Réenregistre la somme de contrôle du fichier de config
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum "/etc/$app/logging"
|
||||
fi
|
||||
|
||||
# Overwrite the config file only if it's allowed
|
||||
if [ $overwrite_config -eq 1 ]
|
||||
then
|
||||
ynh_backup_if_checksum_is_different "/etc/$app/config" # Créé un backup du fichier de config si il a été modifié.
|
||||
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||
ynh_backup_if_checksum_is_different "/etc/$app/config"
|
||||
cp ../conf/config /etc/$app/
|
||||
ynh_replace_string "__PATH__" "${path_url%/}" /etc/$app/config
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" /etc/$app/config
|
||||
ynh_store_file_checksum "/etc/$app/config" # Réenregistre la somme de contrôle du fichier de config
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum "/etc/$app/config"
|
||||
fi
|
||||
|
||||
# Overwrite the InfCloud config file only if it's allowed
|
||||
if [ $overwrite_infcloud -eq 1 ]
|
||||
then
|
||||
if [ $infcloud -eq 1 ]
|
||||
then #Configuration InfCloud
|
||||
# Détermine la langue
|
||||
then
|
||||
# InfCloud configuration
|
||||
# Set language
|
||||
case "$language" in
|
||||
"Czech") language="cs_CZ"
|
||||
;;
|
||||
|
@ -267,7 +284,8 @@ then
|
|||
;;
|
||||
esac
|
||||
ynh_app_setting_set $app language $language
|
||||
ynh_backup_if_checksum_is_different "$final_path/infcloud/config.js" # Créé un backup du fichier de config si il a été modifié.
|
||||
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||
ynh_backup_if_checksum_is_different "$final_path/infcloud/config.js"
|
||||
cp ../conf/config.js "$final_path/infcloud/"
|
||||
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/infcloud/config.js"
|
||||
ynh_replace_string "__PATH__" "${path_url%/}" "$final_path/infcloud/config.js"
|
||||
|
@ -294,12 +312,13 @@ then
|
|||
if [ -n "$defaulteventduration" ]; then
|
||||
ynh_replace_string "\(^var globalDefaultEventDuration=\).*" "\1$defaulteventduration;" "$final_path/infcloud/config.js"
|
||||
fi
|
||||
ynh_store_file_checksum "$final_path/infcloud/config.js" # Réenregistre la somme de contrôle du fichier de config
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum "$final_path/infcloud/config.js"
|
||||
fi
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SET PERMISSIONS ON RADICALE'S DIRECTORIES
|
||||
# SET PERMISSIONS ON RADICALE DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
chown radicale: -R /opt/yunohost/$app
|
||||
|
@ -313,7 +332,7 @@ chown -R radicale: $final_path
|
|||
mkdir -p /var/log/$app
|
||||
touch /var/log/$app/$app.log
|
||||
chown radicale -R /var/log/$app
|
||||
# Droit par défaut des dossiers de collections utilisateurs, tels qu'ils sont créés par radicale.
|
||||
# Set default permissions as radicale do.
|
||||
chmod 666 -R $final_path/default_collections
|
||||
chmod 777 $final_path/default_collections $final_path/default_collections/USER
|
||||
|
||||
|
@ -327,13 +346,13 @@ cp ../conf/radicale.ini /etc/uwsgi/apps-available/
|
|||
# RESTART UWSGI
|
||||
#=================================================
|
||||
|
||||
ynh_system_reload --service_name=uwsgi --action=restart
|
||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
||||
|
||||
#=================================================
|
||||
# PREPARE THE HOOKS
|
||||
#=================================================
|
||||
|
||||
# Modification des hook pour la création des collections par défaut des nouveaux utilisateurs. Et leur suppression
|
||||
# Modify the hooks for create user collections and to remove them.
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_create
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_delete
|
||||
|
||||
|
@ -350,20 +369,26 @@ ynh_use_logrotate --non-append
|
|||
#=================================================
|
||||
|
||||
if [ $infcloud -eq 1 ]
|
||||
then # /infcloud vient se rajouter à l'adresse de radicale pour y être associé sur le portail.
|
||||
ynh_app_setting_set $app path ${path_url%/}/infcloud # Remplace radicale par InfCloud dans le portail Yunohost
|
||||
ynh_app_setting_set $app protected_uris "/" # Protège l'accès à infcloud
|
||||
then
|
||||
# Add /infcloud to the path of radicale to access it from the portal
|
||||
# Replace radicale by InfCloud into YunoHost portal
|
||||
ynh_app_setting_set $app path ${path_url%/}/infcloud
|
||||
# Protect InfCloud access
|
||||
ynh_app_setting_set $app protected_uris "/"
|
||||
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
||||
ynh_app_setting_set $app skipped_regex "$domain_regex$path_url" # Radicale est accessible librement (pour l'accès distant aux ressources)
|
||||
else # Si seul radicale est installé.
|
||||
ynh_app_setting_set $app unprotected_uris "/" # Radicale est accessible librement (pour l'accès distant aux ressources)
|
||||
# Radicale is always accessible (For access to ressources)
|
||||
ynh_app_setting_set $app skipped_regex "$domain_regex$path_url"
|
||||
else
|
||||
# If only radicale is installed
|
||||
# Radicale is always accessible (For access to ressources)
|
||||
ynh_app_setting_set $app unprotected_uris "/"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
||||
ynh_system_reload --service_name=nginx
|
||||
ynh_systemd_action --action=reload --service_name=nginx
|
||||
|
||||
#=================================================
|
||||
# DEACTIVE MAINTENANCE MODE
|
||||
|
|
Loading…
Reference in a new issue