mirror of
https://github.com/YunoHost-Apps/etherpad_mypads_ynh.git
synced 2024-09-03 18:36:09 +02:00
Use new helpers
This commit is contained in:
parent
205f427cb8
commit
f17b3f33cd
7 changed files with 151 additions and 136 deletions
|
@ -6,7 +6,7 @@
|
||||||
"en": "Framapad clone, a online editor providing collaborative editing in real-time.",
|
"en": "Framapad clone, a online editor providing collaborative editing in real-time.",
|
||||||
"fr": "Clone de Framapad, un éditeur en ligne fournissant l'édition collaborative en temps réel."
|
"fr": "Clone de Framapad, un éditeur en ligne fournissant l'édition collaborative en temps réel."
|
||||||
},
|
},
|
||||||
"version": "1.6.2",
|
"version": "1.6.2~ynh1",
|
||||||
"url": "https://framapad.org",
|
"url": "https://framapad.org",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
@ -27,8 +27,8 @@
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose a dedicated domain for Etherpad Mypads.",
|
"en": "Choose a domain for Etherpad Mypads.",
|
||||||
"fr": "Choisissez un domaine dédié pour Etherpad Mypads."
|
"fr": "Choisissez un domaine pour Etherpad Mypads."
|
||||||
},
|
},
|
||||||
"example": "sub.domain.org"
|
"example": "sub.domain.org"
|
||||||
},
|
},
|
||||||
|
|
51
scripts/_sed
Normal file
51
scripts/_sed
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# https://github.com/YunoHost/yunohost/pull/394
|
||||||
|
|
||||||
|
# Substitute/replace a string (or expression) by another in a file
|
||||||
|
#
|
||||||
|
# usage: ynh_replace_string match_string replace_string target_file
|
||||||
|
# | arg: match_string - String to be searched and replaced in the file
|
||||||
|
# | arg: replace_string - String that will replace matches
|
||||||
|
# | arg: target_file - File in which the string will be replaced.
|
||||||
|
#
|
||||||
|
# As this helper is based on sed command, regular expressions and
|
||||||
|
# references to sub-expressions can be used
|
||||||
|
# (see sed manual page for more information)
|
||||||
|
ynh_replace_string () {
|
||||||
|
local delimit=@
|
||||||
|
local match_string=$1
|
||||||
|
local replace_string=$2
|
||||||
|
local workfile=$3
|
||||||
|
|
||||||
|
# Escape the delimiter if it's in the string.
|
||||||
|
match_string=${match_string//${delimit}/"\\${delimit}"}
|
||||||
|
replace_string=${replace_string//${delimit}/"\\${delimit}"}
|
||||||
|
|
||||||
|
sudo sed --in-place "s${delimit}${match_string}${delimit}${replace_string}${delimit}g" "$workfile"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Substitute/replace a password by another in a file
|
||||||
|
#
|
||||||
|
# usage: ynh_replace_password_string match_string replace_string target_file
|
||||||
|
# | arg: match_string - String to be searched and replaced in the file
|
||||||
|
# | arg: replace_string - String that will replace matches
|
||||||
|
# | arg: target_file - File in which the string will be replaced.
|
||||||
|
#
|
||||||
|
# This helper will use ynh_replace_string, but as you can use special
|
||||||
|
# characters, you can't use some regular expressions and sub-expressions.
|
||||||
|
ynh_replace_password_string () {
|
||||||
|
local match_string=$1
|
||||||
|
local replace_string=$2
|
||||||
|
local workfile=$3
|
||||||
|
|
||||||
|
# Escape any backslash to preserve them as simple backslash.
|
||||||
|
match_string=${match_string//\\/"\\\\"}
|
||||||
|
replace_string=${replace_string//\\/"\\\\"}
|
||||||
|
|
||||||
|
# Escape the & character, who has a special function in sed.
|
||||||
|
match_string=${match_string//&/"\&"}
|
||||||
|
replace_string=${replace_string//&/"\&"}
|
||||||
|
|
||||||
|
ynh_replace_string "$match_string" "$replace_string" "$workfile"
|
||||||
|
}
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
source _sed
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
|
@ -63,11 +64,7 @@ fi
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
# Nettoyage des résidus d'installation non pris en charge par le script remove.
|
# Nettoyage des résidus d'installation non pris en charge par le script remove.
|
||||||
if test -n "$PID_TAIL"
|
ynh_clean_check_starting
|
||||||
then
|
|
||||||
SUPPRESS_WARNING kill -s 15 $PID_TAIL # Arrête l'exécution de tail.
|
|
||||||
ynh_secure_remove "$tempfile"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
@ -130,30 +127,9 @@ fi
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# START ETHERPAD IN BACKGROUND
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Démarre etherpad
|
|
||||||
WARNING echo "Redémarrage d'etherpad"
|
|
||||||
tempfile="$(mktemp)"
|
|
||||||
tail -f -n1 /var/log/$app/etherpad.log > "$tempfile" & # Suit le démarrage dans le log
|
|
||||||
PID_TAIL=$! # Récupère le PID de la commande tail, qui est passée en arrière plan.
|
|
||||||
systemctl start $app # Redémarre etherpad. Le démarrage est fait le plus tôt possible, car il est très long...
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK ETHERPAD STARTING
|
# CHECK ETHERPAD STARTING
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
for i in `seq 1 120`
|
# Wait for etherpad fully started
|
||||||
do # La boucle attend le démarrage d'etherpad. Ou 2 minutes. Cette boucle évite simplement un 502 au début, car le démarrage est long...
|
ynh_check_starting "You can access your Etherpad instance at" "/var/log/$app/etherpad.log" "120"
|
||||||
if grep -q "You can access your Etherpad instance at" "$tempfile"; then
|
|
||||||
WARNING echo "Le service $app a démarré correctement."
|
|
||||||
break # Si le log annonce le démarrage d'etherpad, sort de la boucle.
|
|
||||||
fi
|
|
||||||
WARNING echo -n "."
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
echo ""
|
|
||||||
QUIET kill -s 15 $PID_TAIL # Arrête l'exécution de tail.
|
|
||||||
ynh_secure_remove "$tempfile"
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
# Load common variables for all scripts.
|
# Load common variables for all scripts.
|
||||||
source _variables
|
source _variables
|
||||||
|
source _sed
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE FAILURE OF THE SCRIPT
|
# MANAGE FAILURE OF THE SCRIPT
|
||||||
|
@ -17,12 +18,7 @@ source _variables
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
# Nettoyage des résidus d'installation non pris en charge par le script remove.
|
# Nettoyage des résidus d'installation non pris en charge par le script remove.
|
||||||
if test -n "$PID_TAIL"
|
ynh_clean_check_starting
|
||||||
then
|
|
||||||
SUPPRESS_WARNING kill -s 15 $PID_TAIL # Arrête l'exécution de tail.
|
|
||||||
ynh_secure_remove "$tempfile"
|
|
||||||
fi
|
|
||||||
echo ""
|
|
||||||
}
|
}
|
||||||
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
|
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
|
||||||
|
|
||||||
|
@ -171,7 +167,7 @@ ynh_replace_string "__PORT__" "$port" "$final_path/settings.json"
|
||||||
ynh_replace_string "__DB_USER__" "$db_name" "$final_path/credentials.json"
|
ynh_replace_string "__DB_USER__" "$db_name" "$final_path/credentials.json"
|
||||||
ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/credentials.json"
|
ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/credentials.json"
|
||||||
ynh_replace_string "__ADMIN__" "$admin" "$final_path/credentials.json"
|
ynh_replace_string "__ADMIN__" "$admin" "$final_path/credentials.json"
|
||||||
ynh_replace_string "__PASSWD__" "$password" "$final_path/credentials.json"
|
ynh_replace_password_string "__PASSWD__" "$password" "$final_path/credentials.json"
|
||||||
if [ "$export" = "abiword" ]
|
if [ "$export" = "abiword" ]
|
||||||
then
|
then
|
||||||
abiword_path=`which abiword` # Récupère l'emplacement de l'exécutable de abiword
|
abiword_path=`which abiword` # Récupère l'emplacement de l'exécutable de abiword
|
||||||
|
@ -251,16 +247,6 @@ then
|
||||||
sed -i "$mod_line s@div>@&\n\t<center><br><font size="5"><a href="./mypads">Mypads</a></font></center>@" $final_path/src/templates/index.html # Pour ajouter un lien vers le plugin mypads depuis la page d'Etherpad.
|
sed -i "$mod_line s@div>@&\n\t<center><br><font size="5"><a href="./mypads">Mypads</a></font></center>@" $final_path/src/templates/index.html # Pour ajouter un lien vers le plugin mypads depuis la page d'Etherpad.
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# START ETHERPAD IN BACKGROUND
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
WARNING echo "Démarrage d'etherpad"
|
|
||||||
tempfile="$(mktemp)"
|
|
||||||
tail -f -n1 /var/log/$app/etherpad.log > "$tempfile" & # Suit le démarrage dans le log
|
|
||||||
PID_TAIL=$! # Récupère le PID de la commande tail, qui est passée en arrière plan.
|
|
||||||
systemctl start $app # Démarre etherpad. Le démarrage est fait le plus tôt possible, car il est très long...
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -281,34 +267,43 @@ systemctl reload nginx
|
||||||
# CHECK ETHERPAD STARTING
|
# CHECK ETHERPAD STARTING
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Wait for etherpad fully started
|
||||||
|
ynh_check_starting "You can access your Etherpad instance at" "/var/log/$app/etherpad.log" "120"
|
||||||
|
|
||||||
if [ $mypads -eq 1 ]
|
if [ $mypads -eq 1 ]
|
||||||
then
|
then
|
||||||
lang_OK=0
|
|
||||||
else
|
|
||||||
lang_OK=1
|
|
||||||
fi
|
|
||||||
for i in `seq 1 120`
|
|
||||||
do # La boucle attend le démarrage d'etherpad. Ou 2 minutes. Cette boucle évite simplement un 502 au début, car le démarrage est long...
|
|
||||||
if [ $mypads -eq 1 ]
|
|
||||||
then
|
|
||||||
if grep -q "You can access your Etherpad instance at" "$tempfile" && [ "$lang_OK" -eq 0 ] ; then
|
|
||||||
# Si le log annonce une première fois le démarrage d'etherpad, applique la langue de mypads et redémarre le service.
|
|
||||||
WARNING echo "Le service $app a démarré correctement."
|
|
||||||
ynh_replace_string "__LANGUAGE__" "$language" "$script_dir/../conf/lang_mypads.sql"
|
ynh_replace_string "__LANGUAGE__" "$language" "$script_dir/../conf/lang_mypads.sql"
|
||||||
mysql -u $db_name -p$db_pwd $db_name < "$script_dir/../conf/lang_mypads.sql"
|
mysql -u $db_name -p$db_pwd $db_name < "$script_dir/../conf/lang_mypads.sql"
|
||||||
echo ""
|
|
||||||
systemctl restart $app
|
# Wait for etherpad fully started
|
||||||
cat /dev/null > "$tempfile" # Purge le log de suivi du démarrage.
|
ynh_check_starting "You can access your Etherpad instance at" "/var/log/$app/etherpad.log" "120"
|
||||||
lang_OK=1
|
|
||||||
i=1;
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SEND A README FOR THE ADMIN
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if [ $mypads -eq 1 ]
|
||||||
|
then
|
||||||
|
Informations1="You can access to 2 different admin panels, for etherpad by accessing https://$domain${path_url%/}/admin and for mypads by https://$domain${path_url%/}/mypads/?/admin."
|
||||||
|
|
||||||
|
Informations2="
|
||||||
|
Because there's no ldap support with mypads plugin, no user is created at the installation.
|
||||||
|
You have to connect to the admin panel to create the first users.
|
||||||
|
"
|
||||||
|
else
|
||||||
|
Informations1="You can access to the admin panel, by accessing https://$domain${path_url%/}/admin."
|
||||||
|
|
||||||
|
Informations2=""
|
||||||
fi
|
fi
|
||||||
if grep -q "You can access your Etherpad instance at" "$tempfile" && [ "$lang_OK" -eq 1 ]; then
|
|
||||||
WARNING echo "Le service $app a démarré correctement."
|
message="$Informations1
|
||||||
break # Si le log annonce une deuxième fois le démarrage d'etherpad, sort de la boucle.
|
Or, you can find a config file for etherpad at this path /var/www/etherpad_mypads/settings.json.
|
||||||
fi
|
|
||||||
WARNING echo -n "."
|
Your credentials for the admin panel are:
|
||||||
sleep 1
|
- login : $admin
|
||||||
done
|
- password : $password
|
||||||
SUPPRESS_WARNING kill -s 15 $PID_TAIL # Arrête l'exécution de tail.
|
$Informations2
|
||||||
ynh_secure_remove "$tempfile"
|
If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/etherpad_mypads_ynh"
|
||||||
|
|
||||||
|
ynh_send_readme_to_admin "$message" "$admin"
|
||||||
|
|
|
@ -34,7 +34,7 @@ ynh_remove_systemd_config
|
||||||
|
|
||||||
if yunohost service status | grep -q $app # Test l'existence du service dans Yunohost
|
if yunohost service status | grep -q $app # Test l'existence du service dans Yunohost
|
||||||
then
|
then
|
||||||
echo "Remove $app service"
|
ynh_print_info "Remove $app service" >&2
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,10 @@ source ../settings/scripts/_variables
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
# Nettoyage des résidus d'installation non pris en charge par le script remove.
|
||||||
|
ynh_clean_check_starting
|
||||||
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
@ -30,16 +34,19 @@ ynh_abort_if_errors
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
path_url=$(ynh_app_setting_get $app path_url)
|
path_url=$(ynh_app_setting_get $app path)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
export=$(ynh_app_setting_get $app export)
|
export=$(ynh_app_setting_get $app export)
|
||||||
|
mypads=$(ynh_app_setting_get $app mypads)
|
||||||
|
admin=$(ynh_app_setting_get $app admin)
|
||||||
|
password=$(ynh_app_setting_get $app password)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
yunohost app checkurl "${domain}${path_url}" -a "$app" \
|
ynh_webpath_available $domain $path_url \
|
||||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||||
test ! -d $final_path \
|
test ! -d $final_path \
|
||||||
|| ynh_die "There is already a directory: $final_path "
|
|| ynh_die "There is already a directory: $final_path "
|
||||||
|
@ -126,16 +133,6 @@ ynh_restore_file "/etc/systemd/system/$app.service"
|
||||||
## Démarrage auto du service
|
## Démarrage auto du service
|
||||||
systemctl enable $app.service
|
systemctl enable $app.service
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# START ETHERPAD IN BACKGROUND
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
echo "Démarrage d'etherpad" >&2
|
|
||||||
tempfile="$(mktemp)"
|
|
||||||
tail -f -n1 /var/log/$app/etherpad.log > "$tempfile" & # Suit le démarrage dans le log
|
|
||||||
PID_TAIL=$! # Récupère le PID de la commande tail, qui est passée en arrière plan.
|
|
||||||
systemctl start $app # Démarre etherpad. Le démarrage est fait le plus tôt possible, car il est très long...
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -146,16 +143,34 @@ systemctl reload nginx
|
||||||
# CHECK ETHERPAD STARTING
|
# CHECK ETHERPAD STARTING
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Surveille le démarrage du service.
|
# Wait for etherpad fully started
|
||||||
for i in `seq 1 60`
|
ynh_check_starting "You can access your Etherpad instance at" "/var/log/$app/etherpad.log" "120"
|
||||||
do # La boucle attend le démarrage d'etherpad. Ou 1 minute. Cette boucle évite simplement un 502 au début, car le démarrage est long...
|
|
||||||
if grep -q "You can access your Etherpad instance at" "$tempfile"; then
|
#=================================================
|
||||||
echo "Le service $app a démarré correctement." >&2
|
# SEND A README FOR THE ADMIN
|
||||||
break # Si le log annonce le démarrage d'etherpad, sort de la boucle.
|
#=================================================
|
||||||
|
|
||||||
|
if [ $mypads -eq 1 ]
|
||||||
|
then
|
||||||
|
Informations1="You can access to 2 different admin panels, for etherpad by accessing https://$domain${path_url%/}/admin and for mypads by https://$domain${path_url%/}/mypads/?/admin."
|
||||||
|
|
||||||
|
Informations2="
|
||||||
|
Because there's no ldap support with mypads plugin, no user is created at the installation.
|
||||||
|
You have to connect to the admin panel to create the first users.
|
||||||
|
"
|
||||||
|
else
|
||||||
|
Informations1="You can access to the admin panel, by accessing https://$domain${path_url%/}/admin."
|
||||||
|
|
||||||
|
Informations2=""
|
||||||
fi
|
fi
|
||||||
echo -n "." >&2
|
|
||||||
sleep 1
|
message="$Informations1
|
||||||
done
|
Or, you can find a config file for etherpad at this path /var/www/etherpad_mypads/settings.json.
|
||||||
echo ""
|
|
||||||
kill -s 15 $PID_TAIL > /dev/null # Arrête l'exécution de tail.
|
Your credentials for the admin panel are:
|
||||||
ynh_secure_remove "$tempfile"
|
- login : $admin
|
||||||
|
- password : $password
|
||||||
|
$Informations2
|
||||||
|
If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/etherpad_mypads_ynh"
|
||||||
|
|
||||||
|
ynh_send_readme_to_admin "$message" "$admin"
|
||||||
|
|
|
@ -10,6 +10,7 @@ source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
# Load common variables for all scripts.
|
# Load common variables for all scripts.
|
||||||
source _variables
|
source _variables
|
||||||
|
source _sed
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
|
@ -28,6 +29,12 @@ export=$(ynh_app_setting_get $app export)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
mypads=$(ynh_app_setting_get $app mypads)
|
mypads=$(ynh_app_setting_get $app mypads)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK VERSION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_abort_if_up_to_date
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIX OLD THINGS
|
# FIX OLD THINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -81,11 +88,7 @@ fi
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
# Nettoyage des résidus d'installation non pris en charge par le script remove.
|
# Nettoyage des résidus d'installation non pris en charge par le script remove.
|
||||||
if test -n "$PID_TAIL"
|
ynh_clean_check_starting
|
||||||
then
|
|
||||||
SUPPRESS_WARNING kill -s 15 $PID_TAIL # Arrête l'exécution de tail.
|
|
||||||
ynh_secure_remove "$tempfile"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# restore it if the upgrade fails
|
# restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
|
@ -155,7 +158,7 @@ db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||||
password=$(ynh_app_setting_get $app password)
|
password=$(ynh_app_setting_get $app password)
|
||||||
ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/credentials.json"
|
ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/credentials.json"
|
||||||
ynh_replace_string "__ADMIN__" "$admin" "$final_path/credentials.json"
|
ynh_replace_string "__ADMIN__" "$admin" "$final_path/credentials.json"
|
||||||
ynh_replace_string "__PASSWD__" "$password" "$final_path/credentials.json"
|
ynh_replace_password_string "__PASSWD__" "$password" "$final_path/credentials.json"
|
||||||
if [ "$export" = "abiword" ]
|
if [ "$export" = "abiword" ]
|
||||||
then
|
then
|
||||||
abiword_path=`which abiword` # Récupère l'emplacement de l'exécutable de abiword
|
abiword_path=`which abiword` # Récupère l'emplacement de l'exécutable de abiword
|
||||||
|
@ -192,10 +195,7 @@ chown $app -R /var/log/$app/etherpad.log
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove logrotate config
|
ynh_use_logrotate --non-append
|
||||||
ynh_remove_logrotate
|
|
||||||
# And replace it
|
|
||||||
ynh_use_logrotate
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
@ -215,17 +215,6 @@ then
|
||||||
sed -i "$mod_line s@div>@&\n\t<center><br><font size="5"><a href="./mypads">Mypads</a></font></center>@" $final_path/src/templates/index.html # Pour ajouter un lien vers le plugin mypads depuis la page d'Etherpad.
|
sed -i "$mod_line s@div>@&\n\t<center><br><font size="5"><a href="./mypads">Mypads</a></font></center>@" $final_path/src/templates/index.html # Pour ajouter un lien vers le plugin mypads depuis la page d'Etherpad.
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# START ETHERPAD IN BACKGROUND
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Démarre etherpad
|
|
||||||
WARNING echo "Redémarrage d'etherpad"
|
|
||||||
tempfile="$(mktemp)"
|
|
||||||
tail -f -n1 /var/log/$app/etherpad.log > "$tempfile" & # Suit le démarrage dans le log
|
|
||||||
PID_TAIL=$! # Récupère le PID de la commande tail, qui est passée en arrière plan.
|
|
||||||
systemctl start $app # Redémarre etherpad. Le démarrage est fait le plus tôt possible, car il est très long...
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -247,16 +236,5 @@ systemctl reload nginx
|
||||||
# CHECK ETHERPAD STARTING
|
# CHECK ETHERPAD STARTING
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Wait for etherpad fully started
|
||||||
for i in `seq 1 120`
|
ynh_check_starting "You can access your Etherpad instance at" "/var/log/$app/etherpad.log" "120"
|
||||||
do # La boucle attend le démarrage d'etherpad. Ou 2 minutes. Cette boucle évite simplement un 502 au début, car le démarrage est long...
|
|
||||||
if grep -q "You can access your Etherpad instance at" "$tempfile"; then
|
|
||||||
WARNING echo "Le service $app a démarré correctement."
|
|
||||||
break # Si le log annonce le démarrage d'etherpad, sort de la boucle.
|
|
||||||
fi
|
|
||||||
WARNING echo -n "."
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
echo ""
|
|
||||||
QUIET kill -s 15 $PID_TAIL # Arrête l'exécution de tail.
|
|
||||||
ynh_secure_remove "$tempfile"
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue