mirror of
https://github.com/YunoHost-Apps/radicale_ynh.git
synced 2024-09-03 20:16:14 +02:00
Merge pull request #3 from maniackcrudelis/master
Factorisation du code
This commit is contained in:
commit
f278ff6f60
16 changed files with 401 additions and 174 deletions
49
check_process
Normal file
49
check_process
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
;; Test complet avec Infcloud
|
||||||
|
auto_remove=1
|
||||||
|
; Manifest
|
||||||
|
domain="domain.tld" (DOMAIN)
|
||||||
|
path="/path" (PATH)
|
||||||
|
admin="john" (USER)
|
||||||
|
infcloud="Yes"
|
||||||
|
language="French"
|
||||||
|
; Checks
|
||||||
|
pkg_linter=1
|
||||||
|
setup_sub_dir=1
|
||||||
|
setup_root=1
|
||||||
|
setup_nourl=0
|
||||||
|
setup_private=0
|
||||||
|
setup_public=0
|
||||||
|
upgrade=1
|
||||||
|
backup_restore=1
|
||||||
|
multi_instance=0
|
||||||
|
wrong_user=1
|
||||||
|
wrong_path=1
|
||||||
|
incorrect_path=1
|
||||||
|
corrupt_source=0
|
||||||
|
fail_download_source=0
|
||||||
|
port_already_use=0
|
||||||
|
final_path_already_use=0
|
||||||
|
;; Test sans Infcloud
|
||||||
|
auto_remove=1
|
||||||
|
; Manifest
|
||||||
|
domain="domain.tld" (DOMAIN)
|
||||||
|
path="/path" (PATH)
|
||||||
|
admin="john" (USER)
|
||||||
|
infcloud="No"
|
||||||
|
language="French"
|
||||||
|
; Checks
|
||||||
|
setup_sub_dir=1
|
||||||
|
setup_root=1
|
||||||
|
setup_nourl=0
|
||||||
|
setup_private=0
|
||||||
|
setup_public=0
|
||||||
|
upgrade=1
|
||||||
|
backup_restore=1
|
||||||
|
multi_instance=0
|
||||||
|
wrong_user=0
|
||||||
|
wrong_path=0
|
||||||
|
incorrect_path=0
|
||||||
|
corrupt_source=0
|
||||||
|
fail_download_source=0
|
||||||
|
port_already_use=0
|
||||||
|
final_path_already_use=0
|
|
@ -25,7 +25,7 @@ location @radicale {
|
||||||
uwsgi_param SERVER_NAME $server_name;
|
uwsgi_param SERVER_NAME $server_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
#INFCLOUD#location __PATH__/infcloud {
|
#INFCLOUD#location __PATH_NO_ROOT__/infcloud {
|
||||||
#INFCLOUD# alias __FINALPATH__/infcloud;
|
#INFCLOUD# alias __FINALPATH__/infcloud;
|
||||||
#INFCLOUD# if ($scheme = http) {
|
#INFCLOUD# if ($scheme = http) {
|
||||||
#INFCLOUD# rewrite ^ https://$server_name$request_uri? permanent;
|
#INFCLOUD# rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
|
|
|
@ -1,47 +1,50 @@
|
||||||
{
|
{
|
||||||
"name": "Radicale",
|
"name": "Radicale",
|
||||||
"id": "radicale",
|
"id": "radicale",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 2.4"
|
"yunohost": ">= 2.4"
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"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.1",
|
"version": "1.1.1",
|
||||||
"url": "http://radicale.org",
|
"url": "http://radicale.org",
|
||||||
"licence": "free",
|
"license": "free",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "beudbeud",
|
"name": "Maniack Crudelis",
|
||||||
"email": "beudbeud@beudibox.fr"
|
"email": "maniackc_dev@crudelis.fr"
|
||||||
},
|
},
|
||||||
"multi_instance": "false",
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx",
|
||||||
"php5-fpm"
|
"php5-fpm"
|
||||||
],
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install" : [
|
"install" : [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"ask": {
|
"type": "domain",
|
||||||
"en": "Choose a domain for Radicale",
|
"ask": {
|
||||||
"fr": "Choisissez un domaine pour Radicale"
|
"en": "Choose a domain for Radicale",
|
||||||
},
|
"fr": "Choisissez un domaine pour Radicale"
|
||||||
"example": "domain.org"
|
},
|
||||||
},
|
"example": "domain.org"
|
||||||
{
|
},
|
||||||
"name": "path",
|
{
|
||||||
"ask": {
|
"name": "path",
|
||||||
"en": "Choose a path for Radicale",
|
"type": "path",
|
||||||
"fr": "Choisissez un chemin pour Radicale"
|
"ask": {
|
||||||
},
|
"en": "Choose a path for Radicale",
|
||||||
"example": "/radicale",
|
"fr": "Choisissez un chemin pour Radicale"
|
||||||
"default": "/radicale"
|
},
|
||||||
},
|
"example": "/radicale",
|
||||||
|
"default": "/radicale"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
|
"type": "user",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose the administrator (must be an existing YunoHost user)",
|
"en": "Choose the administrator (must be an existing YunoHost user)",
|
||||||
"fr": "Choisissez un administrateur (doit être un utilisateur YunoHost)"
|
"fr": "Choisissez un administrateur (doit être un utilisateur YunoHost)"
|
||||||
|
@ -66,6 +69,6 @@
|
||||||
"choices" : ["Czech", "Danish", "German", "English/US", "Spanish", "French", "Italian", "Japan", "Hungarian", "Dutch", "Slovak", "Turkish", "Russian", "Ukrainian", "Chinese"],
|
"choices" : ["Czech", "Danish", "German", "English/US", "Spanish", "French", "Italian", "Japan", "Hungarian", "Dutch", "Slovak", "Turkish", "Russian", "Ukrainian", "Chinese"],
|
||||||
"default" : "English/US"
|
"default" : "English/US"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
185
scripts/.fonctions
Executable file
185
scripts/.fonctions
Executable file
|
@ -0,0 +1,185 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ynh_version="2.4"
|
||||||
|
|
||||||
|
YNH_VERSION () { # Renvoi le numéro de version de la moulinette Yunohost
|
||||||
|
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
||||||
|
}
|
||||||
|
|
||||||
|
CHECK_VAR () { # Vérifie que la variable n'est pas vide.
|
||||||
|
# $1 = Variable à vérifier
|
||||||
|
# $2 = Texte à afficher en cas d'erreur
|
||||||
|
test -n "$1" || (echo "$2" >&2 && false)
|
||||||
|
}
|
||||||
|
|
||||||
|
EXIT_PROPERLY () { # Provoque l'arrêt du script en cas d'erreur. Et nettoye les résidus.
|
||||||
|
trap '' ERR
|
||||||
|
echo -e "\e[91m \e[1m" # Shell in light red bold
|
||||||
|
echo -e "!!\n $app install's script has encountered an error. Installation was cancelled.\n!!" >&2
|
||||||
|
|
||||||
|
CLEAN_SETUP # Appel la fonction de nettoyage spécifique du script install.
|
||||||
|
|
||||||
|
# Compense le bug de ssowat qui ne supprime pas l'entrée de l'app en cas d'erreur d'installation.
|
||||||
|
sudo sed -i "\@\"$domain$path/\":@d" /etc/ssowat/conf.json
|
||||||
|
|
||||||
|
if [ "$ynh_version" = "2.2" ]; then
|
||||||
|
/bin/bash $script_dir/remove # Appel le script remove. En 2.2, ce comportement n'est pas automatique.
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
TRAP_ON () { # Activate signal capture
|
||||||
|
trap EXIT_PROPERLY ERR # Capturing exit signals on error
|
||||||
|
}
|
||||||
|
|
||||||
|
TRAP_OFF () { # Ignoring signal capture until TRAP_ON
|
||||||
|
# Pour une raison que j'ignore, la fonction TRAP_ON fonctionne très bien.
|
||||||
|
# Mais pas la fonction TRAP_OFF...
|
||||||
|
# Utiliser directement `trap '' ERR` dans le code pour l'utiliser, à la place de la fonction.
|
||||||
|
trap '' ERR # Ignoring exit signals
|
||||||
|
}
|
||||||
|
|
||||||
|
CHECK_USER () { # Vérifie la validité de l'user admin
|
||||||
|
# $1 = Variable de l'user admin.
|
||||||
|
sudo yunohost user list --json | grep -q "\"username\": \"$1\"" || (echo "Wrong admin" >&2 && false)
|
||||||
|
}
|
||||||
|
|
||||||
|
CHECK_PATH () { # Vérifie la présence du / en début de path. Et son absence à la fin.
|
||||||
|
if [ "${path:0:1}" != "/" ]; then # Si le premier caractère n'est pas un /
|
||||||
|
path="/$path" # Ajoute un / en début de path
|
||||||
|
fi
|
||||||
|
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then # Si le dernier caractère est un / et que ce n'est pas le seul caractère.
|
||||||
|
path="${path:0:${#path}-1}" # Supprime le dernier caractère
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
CHECK_DOMAINPATH () { # Vérifie la disponibilité du path et du domaine.
|
||||||
|
sudo yunohost app checkurl $domain$path -a $app
|
||||||
|
}
|
||||||
|
|
||||||
|
CHECK_FINALPATH () { # Vérifie que le dossier de destination n'est pas déjà utilisé.
|
||||||
|
final_path=/var/www/$app
|
||||||
|
if [ -e "$final_path" ]
|
||||||
|
then
|
||||||
|
echo "This path already contains a folder" >&2
|
||||||
|
false
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
GENERATE_DB () { # Créer une base de données et un utilisateur dédié au nom de l'app.
|
||||||
|
# $1 = Nom de la base de donnée
|
||||||
|
# Génère un mot de passe aléatoire.
|
||||||
|
db_user=$1
|
||||||
|
db_pwd=$(head -n20 /dev/urandom | tr -c -d 'A-Za-z0-9' | head -c20)
|
||||||
|
CHECK_VAR "$db_pwd" "db_pwd empty"
|
||||||
|
# Utilise '$app' comme nom d'utilisateur et de base de donnée
|
||||||
|
# Initialise la base de donnée et stocke le mot de passe mysql.
|
||||||
|
ynh_mysql_create_db $db_user $db_user $db_pwd
|
||||||
|
sudo yunohost app setting $app mysqlpwd -v $db_pwd
|
||||||
|
}
|
||||||
|
|
||||||
|
SETUP_SOURCE () { # Télécharge la source, décompresse et copie dans $final_path
|
||||||
|
# $1 = Nom de l'archive téléchargée.
|
||||||
|
wget -nv --show-progress -i ../sources/source_url -O $1
|
||||||
|
# Vérifie la somme de contrôle de la source téléchargée.
|
||||||
|
md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false)
|
||||||
|
# Décompresse la source
|
||||||
|
if [ "$(echo ${1##*.})" == "gz" ]; then
|
||||||
|
tar -x -f $1
|
||||||
|
elif [ "$(echo ${1##*.})" == "zip" ]; then
|
||||||
|
unzip -q $1
|
||||||
|
else
|
||||||
|
false # Format d'archive non pris en charge.
|
||||||
|
fi
|
||||||
|
# Copie les fichiers sources
|
||||||
|
sudo cp -a $(cat ../sources/source_dir)/. "$final_path"
|
||||||
|
# Copie les fichiers additionnels ou modifiés.
|
||||||
|
sudo cp -a ../sources/ajouts/. "$final_path"
|
||||||
|
}
|
||||||
|
|
||||||
|
POOL_FPM () { # Créer le fichier de configuration du pool php-fpm et le configure.
|
||||||
|
sed -i "s@__NAMETOCHANGE__@$app@g" ../conf/php-fpm.conf
|
||||||
|
sed -i "s@__FINALPATH__@$final_path@g" ../conf/php-fpm.conf
|
||||||
|
finalphpconf=/etc/php5/fpm/pool.d/$app.conf
|
||||||
|
sudo cp ../conf/php-fpm.conf $finalphpconf
|
||||||
|
sudo chown root: $finalphpconf
|
||||||
|
finalphpini=/etc/php5/fpm/conf.d/20-$app.ini
|
||||||
|
sudo cp ../conf/php-fpm.ini $finalphpini
|
||||||
|
sudo chown root: $finalphpini
|
||||||
|
sudo service php5-fpm reload
|
||||||
|
}
|
||||||
|
|
||||||
|
STORE_MD5_CONFIG () { # Enregistre la somme de contrôle du fichier de config
|
||||||
|
# $1 = Nom du fichier de conf pour le stockage dans settings.yml
|
||||||
|
# $2 = Nom complet et chemin du fichier de conf.
|
||||||
|
sudo yunohost app setting $app $1_file_md5 -v $(md5sum "$2" | cut -d' ' -f1)
|
||||||
|
}
|
||||||
|
|
||||||
|
CHECK_MD5_CONFIG () { # Créé un backup du fichier de config si il a été modifié.
|
||||||
|
# $1 = Nom du fichier de conf pour le stockage dans settings.yml
|
||||||
|
# $2 = Nom complet et chemin du fichier de conf.
|
||||||
|
if [ "$(sudo yunohost app setting $app $1_file_md5)" != $(md5sum "$2" | cut -d' ' -f1) ]; then
|
||||||
|
sudo cp -a "$2" "$2.backup.$(date '+%d.%m.%y_%Hh%M,%Ss')" # Si le fichier de config a été modifié, créer un backup.
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
FIND_PORT () { # Cherche un port libre.
|
||||||
|
# $1 = Numéro de port pour débuter la recherche.
|
||||||
|
port=$1
|
||||||
|
while ! sudo yunohost app checkport $port ; do
|
||||||
|
port=$((port+1))
|
||||||
|
done
|
||||||
|
CHECK_VAR "$port" "port empty"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
### REMOVE SCRIPT
|
||||||
|
|
||||||
|
REMOVE_NGINX_CONF () { # Suppression de la configuration nginx
|
||||||
|
if [ -e "/etc/nginx/conf.d/$domain.d/$app.conf" ]; then # Delete nginx config
|
||||||
|
echo "Delete nginx config"
|
||||||
|
sudo rm "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
sudo service nginx reload
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
REMOVE_FPM_CONF () { # Suppression de la configuration du pool php-fpm
|
||||||
|
if [ -e "/etc/php5/fpm/pool.d/$app.conf" ]; then # Delete fpm config
|
||||||
|
echo "Delete fpm config"
|
||||||
|
sudo rm "/etc/php5/fpm/pool.d/$app.conf"
|
||||||
|
fi
|
||||||
|
if [ -e "/etc/php5/fpm/conf.d/20-$app.ini" ]; then # Delete php config
|
||||||
|
echo "Delete php config"
|
||||||
|
sudo rm "/etc/php5/fpm/conf.d/20-$app.ini"
|
||||||
|
fi
|
||||||
|
sudo service php5-fpm reload
|
||||||
|
}
|
||||||
|
|
||||||
|
REMOVE_LOGROTATE_CONF () { # Suppression de la configuration de logrotate
|
||||||
|
if [ -e "/etc/logrotate.d/$app" ]; then
|
||||||
|
echo "Delete logrotate config"
|
||||||
|
sudo rm "/etc/logrotate.d/$app"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
REMOVE_APP_DIR () { # Suppression du dossier de l'application
|
||||||
|
if test -n "$app"
|
||||||
|
then # Supprime le dossier seulement si $app n'est pas vide.
|
||||||
|
if [ -e "/var/www/$app" ]; then # Delete final_path
|
||||||
|
echo "Delete app dir"
|
||||||
|
sudo rm -r "/var/www/$app"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
REMOVE_BDD () { # Suppression de la base de donnée et de l'utilisateur associé.
|
||||||
|
# $1 = Nom de la base de donnée
|
||||||
|
# Utilise '$app' comme nom d'utilisateur et de base de donnée
|
||||||
|
db_user=$1
|
||||||
|
if mysqlshow -u root -p$(sudo cat $MYSQL_ROOT_PWD_FILE) | grep -q "^| $db_user"; then
|
||||||
|
echo "Delete db"
|
||||||
|
ynh_mysql_drop_db $db_user
|
||||||
|
ynh_mysql_drop_user $db_user
|
||||||
|
fi
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Récupère les infos de l'application.
|
# Récupère les infos de l'application.
|
||||||
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2) # Récupère le numéro de version de Yunohost.
|
||||||
if [ $ynh_version = "2.4" ]; then
|
if [ $ynh_version = "2.4" ]; then
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
else
|
else
|
||||||
|
@ -20,6 +20,12 @@ sudo mkdir -p "$backup_dir"
|
||||||
# Backup sources & data
|
# Backup sources & data
|
||||||
sudo cp -a $final_path/. $backup_dir/sources
|
sudo cp -a $final_path/. $backup_dir/sources
|
||||||
|
|
||||||
|
# Backup virtualenv
|
||||||
|
sudo cp -a /opt/yunohost/$app/. $backup_dir/virtualenv
|
||||||
|
|
||||||
|
# Backup uwsgi config
|
||||||
|
sudo cp -a /etc/uwsgi/apps-available/radicale.ini $backup_dir/uwsgi_conf
|
||||||
|
|
||||||
# Copy Nginx and YunoHost parameters to make the script "standalone"
|
# Copy Nginx and YunoHost parameters to make the script "standalone"
|
||||||
sudo cp -a /etc/yunohost/apps/$app/. $backup_dir/yunohost
|
sudo cp -a /etc/yunohost/apps/$app/. $backup_dir/yunohost
|
||||||
sudo cp -a /etc/nginx/conf.d/$domain.d/$app.conf $backup_dir/nginx.conf
|
sudo cp -a /etc/nginx/conf.d/$domain.d/$app.conf $backup_dir/nginx.conf
|
||||||
|
|
106
scripts/install
106
scripts/install
|
@ -1,6 +1,16 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
source .fonctions # Charge les fonctions génériques habituellement utilisées dans le script
|
||||||
|
|
||||||
|
YNH_VERSION # Récupère le numéro de version de Yunohost.
|
||||||
|
|
||||||
|
CLEAN_SETUP () {
|
||||||
|
# Nettoyage des résidus d'installation non pris en charge par le script remove.
|
||||||
|
# Pas de nettoyage supplémentaire nécessaire ici...
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
TRAP_ON # Active trap pour arrêter le script si une erreur est détectée.
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
if [ $ynh_version = "2.4" ]
|
if [ $ynh_version = "2.4" ]
|
||||||
then
|
then
|
||||||
|
@ -13,7 +23,7 @@ then
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Source app helpers
|
# Source app helpers
|
||||||
. /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
else
|
else
|
||||||
domain=$1
|
domain=$1
|
||||||
path=$2
|
path=$2
|
||||||
|
@ -23,57 +33,20 @@ else
|
||||||
app=radicale
|
app=radicale
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Delete files and db if exit with an error
|
# Checks variables are not empty
|
||||||
EXIT_PROPERLY () {
|
CHECK_VAR "$app" "app name not set"
|
||||||
trap '' ERR
|
|
||||||
echo -e "\e[91m \e[1m" # Shell in light red bold
|
|
||||||
echo -e "!!\n $app install's script has encountered an error. Installation was cancelled.\n!!"
|
|
||||||
|
|
||||||
if [ $ynh_version = "2.2" ]; then
|
|
||||||
/bin/bash ./remove # Appel le script remove. En 2.2, ce comportement n'est pas automatique.
|
|
||||||
fi
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
TRAP_ON () { # Activate signal capture
|
|
||||||
trap EXIT_PROPERLY ERR # Capturing exit signals on error
|
|
||||||
}
|
|
||||||
TRAP_OFF () { # Ignoring signal capture until TRAP_ON
|
|
||||||
# Pour une raison que j'ignore, la fonction TRAP_ON fonctionne très bien.
|
|
||||||
# Mais pas la fonction TRAP_OFF...
|
|
||||||
# Utiliser directement `trap '' ERR` dans le code pour l'utiliser, à la place de la fonction.
|
|
||||||
trap '' ERR # Ignoring exit signals
|
|
||||||
}
|
|
||||||
TRAP_ON
|
|
||||||
|
|
||||||
|
|
||||||
# Vérifie la validité de l'user admin
|
CHECK_USER "$admin" # Vérifie la validité de l'user admin
|
||||||
sudo yunohost user list --json | grep -q "\"username\": \"$admin\""
|
|
||||||
if [[ ! $? -eq 0 ]]; then
|
|
||||||
echo "Wrong admin"
|
|
||||||
touch /force_stop
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Vérifie la disponibilité du path et du domaine.
|
CHECK_PATH # Vérifie et corrige la syntaxe du path.
|
||||||
sudo yunohost app checkurl $domain$path -a $app
|
CHECK_DOMAINPATH # Vérifie la disponibilité du path et du domaine.
|
||||||
if [[ ! $? -eq 0 ]]; then
|
|
||||||
touch /force_stop
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Vérifie que le dossier de destination n'est pas déjà utilisé.
|
CHECK_FINALPATH # Vérifie que le dossier de destination n'est pas déjà utilisé.
|
||||||
final_path=/var/www/$app
|
|
||||||
if [ -e "$final_path" ]
|
|
||||||
then
|
|
||||||
echo "This path already contains a folder"
|
|
||||||
touch /force_stop
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Vérifie la présence du / en début de path
|
|
||||||
if [ $(echo $path | cut -c1) != "/" ]; then
|
|
||||||
path="/$path"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Modifie le domaine pour qu'il passe dans une regex
|
# Modifie le domaine pour qu'il passe dans une regex
|
||||||
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
||||||
|
CHECK_VAR "$domain_regex" "domain_regex empty"
|
||||||
|
|
||||||
if [ "$infcloud" = "Yes" ] || [ "$infcloud" = "yes" ] || [ "$infcloud" = "YES" ] || [ "$infcloud" = "Y" ] || [ "$infcloud" = "y" ]
|
if [ "$infcloud" = "Yes" ] || [ "$infcloud" = "yes" ] || [ "$infcloud" = "YES" ] || [ "$infcloud" = "Y" ] || [ "$infcloud" = "y" ]
|
||||||
then
|
then
|
||||||
|
@ -84,7 +57,7 @@ fi
|
||||||
|
|
||||||
# Enregistre les infos dans la config YunoHost
|
# Enregistre les infos dans la config YunoHost
|
||||||
sudo yunohost app setting $app domain -v $domain
|
sudo yunohost app setting $app domain -v $domain
|
||||||
sudo yunohost app setting $app path -v $path
|
sudo yunohost app setting $app path -v $path/
|
||||||
sudo yunohost app setting $app admin -v $admin
|
sudo yunohost app setting $app admin -v $admin
|
||||||
sudo yunohost app setting $app infcloud -v $infcloud
|
sudo yunohost app setting $app infcloud -v $infcloud
|
||||||
|
|
||||||
|
@ -113,12 +86,10 @@ sudo mv "$final_path/regex.py" /opt/yunohost/$app/lib/python*/site-packages/radi
|
||||||
sudo rm /opt/yunohost/$app/lib/python*/site-packages/radicale/rights/regex.pyc
|
sudo rm /opt/yunohost/$app/lib/python*/site-packages/radicale/rights/regex.pyc
|
||||||
if [ "$infcloud" = "1" ]
|
if [ "$infcloud" = "1" ]
|
||||||
then #Instal InfCloud
|
then #Instal InfCloud
|
||||||
# Décompresse la source
|
final_path_backup=$final_path # Sauvegarde le contenu de $final_path
|
||||||
tar -x -f ../sources/infcloud.tar.gz
|
final_path=$final_path/infcloud # Change final_path pour l'installation de infcloud
|
||||||
# Copie les fichiers sources
|
SETUP_SOURCE "infcloud.zip" # Télécharge la source, décompresse et copie dans $final_path
|
||||||
sudo cp -a infcloud "$final_path/"
|
final_path=$final_path_backup # Restaure le contenu de $final_path
|
||||||
# Copie les fichiers additionnels ou modifiés.
|
|
||||||
sudo cp -a ../sources/ajouts_infcloud/. "$final_path/infcloud/"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Configuration Radicale
|
#Configuration Radicale
|
||||||
|
@ -128,6 +99,8 @@ sudo cp ../conf/logging /etc/$app/
|
||||||
sudo cp ../conf/rights /etc/$app/
|
sudo cp ../conf/rights /etc/$app/
|
||||||
sudo sed -i "s@__PATH__@$path@g" /etc/$app/config
|
sudo sed -i "s@__PATH__@$path@g" /etc/$app/config
|
||||||
sudo sed -i "s@__FINALPATH__@$final_path@g" /etc/$app/config
|
sudo sed -i "s@__FINALPATH__@$final_path@g" /etc/$app/config
|
||||||
|
STORE_MD5_CONFIG "config" "/etc/$app/config" # Enregistre la somme de contrôle du fichier de config
|
||||||
|
STORE_MD5_CONFIG "logging" "/etc/$app/logging" # Enregistre la somme de contrôle du fichier de config
|
||||||
if [ "$infcloud" = "1" ]
|
if [ "$infcloud" = "1" ]
|
||||||
then #Configuration InfCloud
|
then #Configuration InfCloud
|
||||||
# Détermine la langue
|
# Détermine la langue
|
||||||
|
@ -170,6 +143,7 @@ then #Configuration InfCloud
|
||||||
sudo sed -i "s@__LANG__@$language@g" "$final_path/infcloud/config.js"
|
sudo sed -i "s@__LANG__@$language@g" "$final_path/infcloud/config.js"
|
||||||
sudo sed -i "s@__ADMIN__@$admin@g" "$final_path/infcloud/config.js"
|
sudo sed -i "s@__ADMIN__@$admin@g" "$final_path/infcloud/config.js"
|
||||||
sudo sed -i "s@__TIMEZONE__@$(cat /etc/timezone)@g" "$final_path/infcloud/config.js"
|
sudo sed -i "s@__TIMEZONE__@$(cat /etc/timezone)@g" "$final_path/infcloud/config.js"
|
||||||
|
STORE_MD5_CONFIG "config.js" "$final_path/infcloud/config.js" # Enregistre la somme de contrôle du fichier de config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set permissions to radicale directory
|
# Set permissions to radicale directory
|
||||||
|
@ -191,6 +165,12 @@ sudo ln -s /etc/uwsgi/apps-available/radicale.ini /etc/uwsgi/apps-enabled/
|
||||||
|
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
sudo sed -i "s@__PATH__@$path@g" ../conf/nginx.conf
|
sudo sed -i "s@__PATH__@$path@g" ../conf/nginx.conf
|
||||||
|
if [ "$path" = "/" ]
|
||||||
|
then
|
||||||
|
sudo sed -i "s@__PATH_NO_ROOT__@@g" ../conf/nginx.conf
|
||||||
|
else
|
||||||
|
sudo sed -i "s@__PATH_NO_ROOT__@$path@g" ../conf/nginx.conf
|
||||||
|
fi
|
||||||
sudo sed -i "s@__FINALPATH__@$final_path@g" ../conf/nginx.conf
|
sudo sed -i "s@__FINALPATH__@$final_path@g" ../conf/nginx.conf
|
||||||
sudo sed -i "s@__NAMETOCHANGE__@$app@g" ../conf/nginx.conf
|
sudo sed -i "s@__NAMETOCHANGE__@$app@g" ../conf/nginx.conf
|
||||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
@ -201,16 +181,7 @@ fi
|
||||||
|
|
||||||
if [ "$infcloud" = "1" ]
|
if [ "$infcloud" = "1" ]
|
||||||
then
|
then
|
||||||
# Créer le fichier de configuration du pool php-fpm et le configure.
|
POOL_FPM # Créer le fichier de configuration du pool php-fpm et le configure.
|
||||||
sed -i "s@__NAMETOCHANGE__@$app@g" ../conf/php-fpm.conf
|
|
||||||
sed -i "s@__FINALPATH__@$final_path@g" ../conf/php-fpm.conf
|
|
||||||
finalphpconf=/etc/php5/fpm/pool.d/$app.conf
|
|
||||||
sudo cp ../conf/php-fpm.conf $finalphpconf
|
|
||||||
sudo chown root: $finalphpconf
|
|
||||||
finalphpini=/etc/php5/fpm/conf.d/20-$app.ini
|
|
||||||
sudo cp ../conf/php-fpm.ini $finalphpini
|
|
||||||
sudo chown root: $finalphpini
|
|
||||||
sudo service php5-fpm reload
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Fix permission
|
# Fix permission
|
||||||
|
@ -246,8 +217,11 @@ fi
|
||||||
|
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
||||||
# Mise en place des hook pour la création des collections par défaut des nouveaux utilisateurs. Et leur suppression
|
# Modification des hook pour la création des collections par défaut des nouveaux utilisateurs. Et leur suppression
|
||||||
sudo sed -i "s@__FINALPATH__@$final_path@g" ../hooks/post_user_create
|
sudo sed -i "s@__FINALPATH__@$final_path@g" ../hooks/post_user_create
|
||||||
sudo yunohost hook add radicale ../hooks/post_user_create
|
|
||||||
sudo sed -i "s@__FINALPATH__@$final_path@g" ../hooks/post_user_delete
|
sudo sed -i "s@__FINALPATH__@$final_path@g" ../hooks/post_user_delete
|
||||||
sudo yunohost hook add radicale ../hooks/post_user_delete
|
if [ $ynh_version != "2.4" ]
|
||||||
|
then
|
||||||
|
sudo yunohost hook add radicale ../hooks/post_user_create
|
||||||
|
sudo yunohost hook add radicale ../hooks/post_user_delete
|
||||||
|
fi
|
||||||
|
|
|
@ -1,22 +1,20 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
source .fonctions # Charge les fonctions génériques habituellement utilisées dans le script
|
||||||
|
|
||||||
# Récupère les infos de l'application.
|
# Récupère les infos de l'application.
|
||||||
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
YNH_VERSION # Récupère le numéro de version de Yunohost.
|
||||||
if [ $ynh_version = "2.4" ]; then
|
if [ $ynh_version = "2.4" ]; then
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Source app helpers
|
# Source app helpers
|
||||||
. /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
else
|
else
|
||||||
app=radicale
|
app=radicale
|
||||||
fi
|
fi
|
||||||
domain=$(sudo yunohost app setting $app domain)
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
|
|
||||||
# Suppression des dossiers de l'application
|
REMOVE_APP_DIR # Suppression du dossier de l'application
|
||||||
if [ -e "/var/www/$app/" ]; then # Delete final_path
|
|
||||||
echo "Delete app dir"
|
|
||||||
sudo rm -r "/var/www/$app/"
|
|
||||||
fi
|
|
||||||
if [ -e "/opt/yunohost/$app" ]; then
|
if [ -e "/opt/yunohost/$app" ]; then
|
||||||
echo "Delete virtualenv"
|
echo "Delete virtualenv"
|
||||||
sudo rm -r "/opt/yunohost/$app"
|
sudo rm -r "/opt/yunohost/$app"
|
||||||
|
@ -33,7 +31,7 @@ if [ -e "/etc/uwsgi/apps-available/radicale.ini" ]; then
|
||||||
echo "Delete uwsgi config"
|
echo "Delete uwsgi config"
|
||||||
sudo rm "/etc/uwsgi/apps-available/radicale.ini"
|
sudo rm "/etc/uwsgi/apps-available/radicale.ini"
|
||||||
fi
|
fi
|
||||||
if [ -e "/etc/uwsgi/apps-enabled/radicale.ini" ]; then
|
if [ -h "/etc/uwsgi/apps-enabled/radicale.ini" ]; then
|
||||||
echo "Delete uwsgi config"
|
echo "Delete uwsgi config"
|
||||||
sudo rm "/etc/uwsgi/apps-enabled/radicale.ini"
|
sudo rm "/etc/uwsgi/apps-enabled/radicale.ini"
|
||||||
fi
|
fi
|
||||||
|
@ -45,32 +43,17 @@ fi
|
||||||
# Redémarre le service uwsgi
|
# Redémarre le service uwsgi
|
||||||
sudo service uwsgi start
|
sudo service uwsgi start
|
||||||
|
|
||||||
# Suppression de la configuration nginx
|
REMOVE_NGINX_CONF # Suppression de la configuration nginx
|
||||||
if [ -e "/etc/nginx/conf.d/$domain.d/$app.conf" ]; then # Delete nginx config
|
|
||||||
echo "Delete nginx config"
|
|
||||||
sudo rm "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
||||||
sudo service nginx reload
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Suppression de la configuration du pool php-fpm
|
REMOVE_FPM_CONF # Suppression de la configuration du pool php-fpm
|
||||||
if [ -e "/etc/php5/fpm/pool.d/$app.conf" ]; then # Delete fpm config
|
|
||||||
echo "Delete fpm config"
|
|
||||||
sudo rm "/etc/php5/fpm/pool.d/$app.conf"
|
|
||||||
fi
|
|
||||||
if [ -e "/etc/php5/fpm/conf.d/20-$app.ini" ]; then # Delete php config
|
|
||||||
echo "Delete php config"
|
|
||||||
sudo rm "/etc/php5/fpm/conf.d/20-$app.ini"
|
|
||||||
fi
|
|
||||||
sudo service php5-fpm reload
|
|
||||||
|
|
||||||
# Suppression de la configuration de logrotate
|
REMOVE_LOGROTATE_CONF # Suppression de la configuration de logrotate
|
||||||
if [ -e "/etc/logrotate.d/$app" ]; then
|
|
||||||
echo "Delete logrotate config"
|
|
||||||
sudo rm -r "/etc/logrotate.d/$app"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Retire le hook sur la création de nouveaux utilisateurs
|
if [ $ynh_version != "2.4" ]
|
||||||
sudo yunohost hook remove radicale
|
then
|
||||||
|
# Retire le hook sur la création de nouveaux utilisateurs
|
||||||
|
sudo yunohost hook remove radicale
|
||||||
|
fi
|
||||||
|
|
||||||
# Régénère la configuration de SSOwat
|
# Régénère la configuration de SSOwat
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Récupère les infos de l'application.
|
# Récupère les infos de l'application.
|
||||||
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2) # Récupère le numéro de version de Yunohost.
|
||||||
if [ $ynh_version = "2.4" ]; then
|
if [ $ynh_version = "2.4" ]; then
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
else
|
else
|
||||||
|
@ -24,11 +24,25 @@ sudo cp -a $backup_dir/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
# Restore radicale configuration
|
# Restore radicale configuration
|
||||||
sudo cp -a $backup_dir/etc/. /etc/$app
|
sudo cp -a $backup_dir/etc/. /etc/$app
|
||||||
|
|
||||||
|
# Restore virtualenv
|
||||||
|
sudo cp -a $backup_dir/virtualenv/. /opt/yunohost/$app
|
||||||
|
|
||||||
|
# Set permissions to radicale directory
|
||||||
|
if ! grep -q "^radicale:" /etc/passwd # Test l'existence de l'utilisateur
|
||||||
|
then # Si il n'existe pas, l'user radicale est créé
|
||||||
|
sudo useradd radicale -d /opt/yunohost/$app
|
||||||
|
fi
|
||||||
|
sudo chown radicale: -R /opt/yunohost/$app
|
||||||
|
|
||||||
|
# Restore uwsgi config
|
||||||
|
sudo cp -a $backup_dir/uwsgi_conf /etc/uwsgi/apps-available/radicale.ini
|
||||||
|
sudo ln -s /etc/uwsgi/apps-available/radicale.ini /etc/uwsgi/apps-enabled/
|
||||||
|
|
||||||
# Copy dedicated php-fpm process to backup folder
|
# Copy dedicated php-fpm process to backup folder
|
||||||
if [ "$infcloud" = "1" ]
|
if [ "$infcloud" = "1" ]
|
||||||
then
|
then
|
||||||
sudo cp -a /etc/php5/fpm/pool.d/$app.conf $backup_dir/php-fpm.conf
|
sudo cp -a $backup_dir/php-fpm.conf /etc/php5/fpm/pool.d/$app.conf
|
||||||
sudo cp -a /etc/php5/fpm/conf.d/20-$app.ini $backup_dir/php-fpm.ini
|
sudo cp -a $backup_dir/php-fpm.ini /etc/php5/fpm/conf.d/20-$app.ini
|
||||||
sudo service php5-fpm reload
|
sudo service php5-fpm reload
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Get app settings
|
source .fonctions # Charge les fonctions génériques habituellement utilisées dans le script
|
||||||
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
|
||||||
|
# Récupère les infos de l'application.
|
||||||
|
YNH_VERSION # Récupère le numéro de version de Yunohost.
|
||||||
if [ $ynh_version = "2.4" ]; then
|
if [ $ynh_version = "2.4" ]; then
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
else
|
else
|
||||||
|
@ -12,8 +14,13 @@ path=$(sudo yunohost app setting $app path)
|
||||||
admin=$(sudo yunohost app setting $app admin)
|
admin=$(sudo yunohost app setting $app admin)
|
||||||
infcloud=$(sudo yunohost app setting $app infcloud)
|
infcloud=$(sudo yunohost app setting $app infcloud)
|
||||||
language=$(sudo yunohost app setting $app language)
|
language=$(sudo yunohost app setting $app language)
|
||||||
|
final_path=$(sudo yunohost app setting $app final_path)
|
||||||
|
|
||||||
|
|
||||||
|
CHECK_PATH # Vérifie et corrige la syntaxe du path.
|
||||||
|
if [ "$infcloud" = "1" ]; then
|
||||||
|
path=$(echo $path | sed "s@/infcloud@@") # Retire /infcloud pour traiter le path seul.
|
||||||
|
fi
|
||||||
# Check depends installation
|
# Check depends installation
|
||||||
sudo apt-get install -y python-pip python-virtualenv python-dev libldap2-dev libsasl2-dev libssl-dev uwsgi uwsgi-plugin-python
|
sudo apt-get install -y python-pip python-virtualenv python-dev libldap2-dev libsasl2-dev libssl-dev uwsgi uwsgi-plugin-python
|
||||||
|
|
||||||
|
@ -23,14 +30,6 @@ then
|
||||||
sudo mv /usr/local/radicale /opt/yunohost/
|
sudo mv /usr/local/radicale /opt/yunohost/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set permissions to radicale directory
|
|
||||||
sudo grep radicale /etc/passwd > /dev/null 2>&1
|
|
||||||
if [ $? != 0 ];
|
|
||||||
then
|
|
||||||
sudo useradd radicale -d /opt/yunohost/$app
|
|
||||||
fi
|
|
||||||
sudo chown radicale: -R /opt/yunohost/$app
|
|
||||||
|
|
||||||
# Upgrade pip packages
|
# Upgrade pip packages
|
||||||
sudo rm -Rf /opt/yunohost/$app
|
sudo rm -Rf /opt/yunohost/$app
|
||||||
sudo virtualenv /opt/yunohost/$app
|
sudo virtualenv /opt/yunohost/$app
|
||||||
|
@ -46,19 +45,21 @@ sudo mv "$final_path/regex.py" /opt/yunohost/$app/lib/python*/site-packages/radi
|
||||||
sudo rm /opt/yunohost/$app/lib/python*/site-packages/radicale/rights/regex.pyc
|
sudo rm /opt/yunohost/$app/lib/python*/site-packages/radicale/rights/regex.pyc
|
||||||
if [ "$infcloud" = "1" ]
|
if [ "$infcloud" = "1" ]
|
||||||
then #Instal InfCloud
|
then #Instal InfCloud
|
||||||
# Décompresse la source
|
final_path_backup=$final_path # Sauvegarde le contenu de $final_path
|
||||||
tar -x -f ../sources/infcloud.tar.gz
|
final_path=$final_path/infcloud # Change final_path pour l'installation de infcloud
|
||||||
# Copie les fichiers sources
|
SETUP_SOURCE "infcloud.zip" # Télécharge la source, décompresse et copie dans $final_path
|
||||||
sudo cp -a infcloud "$final_path/"
|
final_path=$final_path_backup # Restaure le contenu de $final_path
|
||||||
# Copie les fichiers additionnels ou modifiés.
|
|
||||||
sudo cp -a ../sources/ajouts/. "$final_path/infcloud/"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Radicale configuration
|
# Radicale configuration
|
||||||
|
CHECK_MD5_CONFIG "config" "/etc/$app/config" # Créé un backup du fichier de config si il a été modifié.
|
||||||
sudo cp ../conf/config /etc/$app/
|
sudo cp ../conf/config /etc/$app/
|
||||||
|
CHECK_MD5_CONFIG "logging" "/etc/$app/logging" # Créé un backup du fichier de config si il a été modifié.
|
||||||
sudo cp ../conf/logging /etc/$app/
|
sudo cp ../conf/logging /etc/$app/
|
||||||
|
STORE_MD5_CONFIG "logging" "/etc/$app/logging" # Réenregistre la somme de contrôle du fichier de config
|
||||||
sudo sed -i "s@__PATH__@$path@g" /etc/$app/config
|
sudo sed -i "s@__PATH__@$path@g" /etc/$app/config
|
||||||
sudo sed -i "s@__FINALPATH__@$path@g" /etc/$app/config
|
sudo sed -i "s@__FINALPATH__@$final_path@g" /etc/$app/config
|
||||||
|
STORE_MD5_CONFIG "config" "/etc/$app/config" # Réenregistre la somme de contrôle du fichier de config
|
||||||
if [ "$infcloud" = "1" ]
|
if [ "$infcloud" = "1" ]
|
||||||
then #Configuration InfCloud
|
then #Configuration InfCloud
|
||||||
# Détermine la langue
|
# Détermine la langue
|
||||||
|
@ -95,12 +96,14 @@ then #Configuration InfCloud
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
sudo yunohost app setting $app language -v $language
|
sudo yunohost app setting $app language -v $language
|
||||||
|
CHECK_MD5_CONFIG "config.js" "$final_path/infcloud/config.js" # Créé un backup du fichier de config si il a été modifié.
|
||||||
sudo cp ../conf/config.js "$final_path/infcloud/"
|
sudo cp ../conf/config.js "$final_path/infcloud/"
|
||||||
sudo sed -i "s@__DOMAIN__@$domain@g" "$final_path/infcloud/config.js"
|
sudo sed -i "s@__DOMAIN__@$domain@g" "$final_path/infcloud/config.js"
|
||||||
sudo sed -i "s@__PATH__@$path@g" "$final_path/infcloud/config.js"
|
sudo sed -i "s@__PATH__@$path@g" "$final_path/infcloud/config.js"
|
||||||
sudo sed -i "s@__LANG__@$language@g" "$final_path/infcloud/config.js"
|
sudo sed -i "s@__LANG__@$language@g" "$final_path/infcloud/config.js"
|
||||||
sudo sed -i "s@__ADMIN__@$admin@g" "$final_path/infcloud/config.js"
|
sudo sed -i "s@__ADMIN__@$admin@g" "$final_path/infcloud/config.js"
|
||||||
sudo sed -i "s@__TIMEZONE__@$(cat /etc/timezone)@g" "$final_path/infcloud/config.js"
|
sudo sed -i "s@__TIMEZONE__@$(cat /etc/timezone)@g" "$final_path/infcloud/config.js"
|
||||||
|
STORE_MD5_CONFIG "config.js" "$final_path/infcloud/config.js" # Réenregistre la somme de contrôle du fichier de config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy uwsgi config
|
# Copy uwsgi config
|
||||||
|
@ -108,6 +111,12 @@ sudo cp ../conf/radicale.ini /etc/uwsgi/apps-available/
|
||||||
|
|
||||||
# Update Nginx configuration file
|
# Update Nginx configuration file
|
||||||
sudo sed -i "s@__PATH__@$path@g" ../conf/nginx.conf
|
sudo sed -i "s@__PATH__@$path@g" ../conf/nginx.conf
|
||||||
|
if [ "$path" = "/" ]
|
||||||
|
then
|
||||||
|
sudo sed -i "s@__PATH_NO_ROOT__@@g" ../conf/nginx.conf
|
||||||
|
else
|
||||||
|
sudo sed -i "s@__PATH_NO_ROOT__@$path@g" ../conf/nginx.conf
|
||||||
|
fi
|
||||||
sudo sed -i "s@__FINALPATH__@$final_path@g" ../conf/nginx.conf
|
sudo sed -i "s@__FINALPATH__@$final_path@g" ../conf/nginx.conf
|
||||||
sudo sed -i "s@__NAMETOCHANGE__@$app@g" ../conf/nginx.conf
|
sudo sed -i "s@__NAMETOCHANGE__@$app@g" ../conf/nginx.conf
|
||||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
@ -118,18 +127,17 @@ fi
|
||||||
|
|
||||||
if [ "$infcloud" = "1" ]
|
if [ "$infcloud" = "1" ]
|
||||||
then
|
then
|
||||||
# Met à jour le fichier de configuration du pool php-fpm.
|
POOL_FPM # Créer le fichier de configuration du pool php-fpm et le configure.
|
||||||
sed -i "s@__NAMETOCHANGE__@$app@g" ../conf/php-fpm.conf
|
|
||||||
sed -i "s@__FINALPATH__@$final_path@g" ../conf/php-fpm.conf
|
|
||||||
finalphpconf=/etc/php5/fpm/pool.d/$app.conf
|
|
||||||
sudo cp ../conf/php-fpm.conf $finalphpconf
|
|
||||||
sudo chown root: $finalphpconf
|
|
||||||
finalphpini=/etc/php5/fpm/conf.d/20-$app.ini
|
|
||||||
sudo cp ../conf/php-fpm.ini $finalphpini
|
|
||||||
sudo chown root: $finalphpini
|
|
||||||
sudo service php5-fpm reload
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Set permissions to radicale directory
|
||||||
|
sudo grep radicale /etc/passwd > /dev/null 2>&1
|
||||||
|
if [ $? != 0 ];
|
||||||
|
then
|
||||||
|
sudo useradd radicale -d /opt/yunohost/$app
|
||||||
|
fi
|
||||||
|
sudo chown radicale: -R /opt/yunohost/$app
|
||||||
|
|
||||||
# Fix permission
|
# Fix permission
|
||||||
sudo chmod 755 /etc/$app/
|
sudo chmod 755 /etc/$app/
|
||||||
sudo find /opt/yunohost/$app/ -type d -exec chmod 2755 {} \;
|
sudo find /opt/yunohost/$app/ -type d -exec chmod 2755 {} \;
|
||||||
|
@ -157,6 +165,9 @@ sudo service nginx reload
|
||||||
|
|
||||||
# Mise en place des hook pour la création des collections par défaut des nouveaux utilisateurs. Et leur suppression
|
# Mise en place des hook pour la création des collections par défaut des nouveaux utilisateurs. Et leur suppression
|
||||||
sudo sed -i "s@__FINALPATH__@$final_path@g" ../hooks/post_user_create
|
sudo sed -i "s@__FINALPATH__@$final_path@g" ../hooks/post_user_create
|
||||||
sudo yunohost hook add radicale ../hooks/post_user_create
|
|
||||||
sudo sed -i "s@__FINALPATH__@$final_path@g" ../hooks/post_user_delete
|
sudo sed -i "s@__FINALPATH__@$final_path@g" ../hooks/post_user_delete
|
||||||
sudo yunohost hook add radicale ../hooks/post_user_delete
|
if [ $ynh_version != "2.4" ]
|
||||||
|
then
|
||||||
|
sudo yunohost hook add radicale ../hooks/post_user_create
|
||||||
|
sudo yunohost hook add radicale ../hooks/post_user_delete
|
||||||
|
fi
|
||||||
|
|
Binary file not shown.
1
sources/source_dir
Normal file
1
sources/source_dir
Normal file
|
@ -0,0 +1 @@
|
||||||
|
infcloud
|
1
sources/source_md5
Normal file
1
sources/source_md5
Normal file
|
@ -0,0 +1 @@
|
||||||
|
6ffb1b3b9b7f54137723c6c13e9c5635 infcloud.zip
|
1
sources/source_url
Normal file
1
sources/source_url
Normal file
|
@ -0,0 +1 @@
|
||||||
|
https://www.inf-it.com/InfCloud_0.13.1.zip
|
|
@ -1 +0,0 @@
|
||||||
|
|
Loading…
Reference in a new issue