mirror of
https://github.com/YunoHost-Apps/etherpad_mypads_ynh.git
synced 2024-09-03 18:36:09 +02:00
v2
This commit is contained in:
parent
227391ccdf
commit
0f6b5703c0
8 changed files with 313 additions and 220 deletions
|
@ -6,10 +6,10 @@ After=syslog.target network.target
|
|||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
WorkingDirectory=__INSTALL_DIR__/
|
||||
Environment=NODE_ENV=production
|
||||
Environment="__YNH_NODE_LOAD_PATH__"
|
||||
ExecStart=__YNH_NODE__ __FINALPATH__/src/node/server.js
|
||||
ExecStart=__YNH_NODE__ __INSTALL_DIR__/src/node/server.js
|
||||
StandardOutput=append:/var/log/__APP__/etherpad.log
|
||||
StandardError=inherit
|
||||
Restart=always
|
||||
|
|
93
manifest.toml
Normal file
93
manifest.toml
Normal file
|
@ -0,0 +1,93 @@
|
|||
packaging_format = 2
|
||||
|
||||
id = "etherpad_mypads"
|
||||
name = "Etherpad MyPads"
|
||||
description.en = "Online editor providing collaborative editing in real-time"
|
||||
description.fr = "Éditeur en ligne fournissant l'édition collaborative en temps réel"
|
||||
|
||||
version = "1.8.18~ynh2"
|
||||
|
||||
maintainers = []
|
||||
|
||||
[upstream]
|
||||
license = "Apache-2.0"
|
||||
website = "http://etherpad.org"
|
||||
demo = "https://video.etherpad.com"
|
||||
admindoc = "http://etherpad.org/doc/v1.8.18"
|
||||
code = "https://github.com/ether/etherpad-lite"
|
||||
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
|
||||
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 4.3.0"
|
||||
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
|
||||
multi_instance = true
|
||||
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
|
||||
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
|
||||
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
|
||||
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||
type = "domain"
|
||||
|
||||
[install.path]
|
||||
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||
type = "path"
|
||||
default = "/pad"
|
||||
|
||||
[install.init_main_permission]
|
||||
help.en = "If your Etherpad instance is public, everyone will be able to create a pad or see an existing one."
|
||||
help.fr = "Si votre instance Etherpad est publique, tout le monde pourra créer un pad ou voir un pad existant."
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[install.language]
|
||||
ask.en = "Choose your language"
|
||||
ask.fr = "Choisissez la langue"
|
||||
type = "string"
|
||||
choices = ["ca", "de", "en", "es", "fr", "gl", "hu", "it", "nl", "pt"]
|
||||
default = "en"
|
||||
|
||||
[install.admin]
|
||||
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||
type = "user"
|
||||
|
||||
[install.password]
|
||||
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||
type = "password"
|
||||
|
||||
[install.export]
|
||||
ask.en = "Use AbiWord (~260 Mo) or LibreOffice (~400 Mo) (more stable) to expand export possibilities (PDF, doc)?"
|
||||
ask.fr = "Utiliser AbiWord (~260 Mo) ou LibreOffice (~400 Mo) (plus stable) pour étendre les possibilités d'export (PDF, doc) ?"
|
||||
type = "string"
|
||||
choices = ["none", "abiword", "libreoffice"]
|
||||
default = "none"
|
||||
|
||||
[install.mypads]
|
||||
ask.en = "Do you want to install MyPads plugin?"
|
||||
ask.fr = "Voulez-vous installer le plugin MyPads ?"
|
||||
help.en = "<a href=https://git.framasoft.org/framasoft/ep_mypads target=_blank>MyPads plugin</a>"
|
||||
type = "boolean"
|
||||
default = true
|
||||
|
||||
[install.useldap]
|
||||
ask.en = "Do you want to use LDAP with MyPads?"
|
||||
ask.fr = "Voulez-vous utiliser LDAP avec MyPads ?"
|
||||
help.en = "Using LDAP won't let you add new user aside from YunoHost users."
|
||||
help.fr = "Utiliser LDAP ne vous permettra pas d'ajouter un nouvel utilisateur en dehors des utilisateurs de YunoHost."
|
||||
type = "boolean"
|
||||
default = true
|
||||
|
||||
[resources]
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
|
||||
[resources.database]
|
||||
type = "mysql"
|
|
@ -8,7 +8,7 @@
|
|||
abiword_app_depencencies="abiword"
|
||||
|
||||
# Dependencies for LibreOffice
|
||||
libreoffice_app_dependencies="unoconv libreoffice-writer"
|
||||
#REMOVEME? libreoffice_app_dependencies="unoconv libreoffice-writer"
|
||||
|
||||
# NodeJS version
|
||||
nodejs_version=14
|
||||
|
@ -62,7 +62,7 @@ ynh_send_readme_to_admin() {
|
|||
type="${type:-install}"
|
||||
|
||||
# Get the value of admin_mail_html
|
||||
admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
|
||||
#REMOVEME? admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
|
||||
admin_mail_html="${admin_mail_html:-0}"
|
||||
|
||||
# Retrieve the email of users
|
||||
|
@ -181,12 +181,12 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
|
|||
#=================================================
|
||||
|
||||
ynh_maintenance_mode_ON () {
|
||||
# Load value of $path_url and $domain from the config if their not set
|
||||
if [ -z $path_url ]; then
|
||||
path_url=$(ynh_app_setting_get $app path)
|
||||
# Load value of $path and $domain from the config if their not set
|
||||
if [ -z $path ]; then
|
||||
#REMOVEME? path=$(ynh_app_setting_get $app path)
|
||||
fi
|
||||
if [ -z $domain ]; then
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get $app domain)
|
||||
fi
|
||||
|
||||
mkdir -p /var/www/html/
|
||||
|
@ -213,10 +213,10 @@ ynh_maintenance_mode_ON () {
|
|||
</html>" > "/var/www/html/maintenance.$app.html"
|
||||
|
||||
# Create a new nginx config file to redirect all access to the app to the maintenance notice instead.
|
||||
echo "# All request to the app will be redirected to ${path_url}_maintenance and fall on the maintenance notice
|
||||
rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/? redirect;
|
||||
echo "# All request to the app will be redirected to ${path}_maintenance and fall on the maintenance notice
|
||||
rewrite ^${path}/(.*)$ ${path}_maintenance/? redirect;
|
||||
# Use another location, to not be in conflict with the original config file
|
||||
location ${path_url}_maintenance/ {
|
||||
location ${path}_maintenance/ {
|
||||
alias /var/www/html/ ;
|
||||
|
||||
try_files maintenance.$app.html =503;
|
||||
|
@ -227,7 +227,7 @@ include conf.d/yunohost_panel.conf.inc;
|
|||
|
||||
# The current config file will redirect all requests to the root of the app.
|
||||
# To keep the full path, we can use the following rewrite rule:
|
||||
# rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/\$1? redirect;
|
||||
# rewrite ^${path}/(.*)$ ${path}_maintenance/\$1? redirect;
|
||||
# The difference will be in the $1 at the end, which keep the following queries.
|
||||
# But, if it works perfectly for a html request, there's an issue with any php files.
|
||||
# This files are treated as simple files, and will be downloaded by the browser.
|
||||
|
@ -237,16 +237,16 @@ include conf.d/yunohost_panel.conf.inc;
|
|||
}
|
||||
|
||||
ynh_maintenance_mode_OFF () {
|
||||
# Load value of $path_url and $domain from the config if their not set
|
||||
if [ -z $path_url ]; then
|
||||
path_url=$(ynh_app_setting_get $app path)
|
||||
# Load value of $path and $domain from the config if their not set
|
||||
if [ -z $path ]; then
|
||||
#REMOVEME? path=$(ynh_app_setting_get $app path)
|
||||
fi
|
||||
if [ -z $domain ]; then
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get $app domain)
|
||||
fi
|
||||
|
||||
# Rewrite the nginx config file to redirect from ${path_url}_maintenance to the real url of the app.
|
||||
echo "rewrite ^${path_url}_maintenance/(.*)$ ${path_url}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
|
||||
# Rewrite the nginx config file to redirect from ${path}_maintenance to the real url of the app.
|
||||
echo "rewrite ^${path}_maintenance/(.*)$ ${path}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
|
||||
systemctl reload nginx
|
||||
|
||||
# Sleep 4 seconds to let the browser reload the pages and redirect the user to the app.
|
||||
|
@ -296,7 +296,7 @@ ynh_app_changelog () {
|
|||
return 0
|
||||
fi
|
||||
|
||||
local current_version=$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version")
|
||||
#REMOVEME? local current_version=$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version")
|
||||
local update_version=$(ynh_read_manifest --manifest="../manifest.json" --manifest_key="version")
|
||||
|
||||
# Get the line of the version to update to into the changelog
|
||||
|
|
|
@ -14,22 +14,22 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
#REMOVEME? ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
|
@ -40,7 +40,7 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$final_path"
|
||||
ynh_backup --src_path="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
|
|
134
scripts/install
134
scripts/install
|
@ -17,55 +17,55 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
password="$YNH_APP_ARG_PASSWORD"
|
||||
export=$YNH_APP_ARG_EXPORT
|
||||
mypads=$YNH_APP_ARG_MYPADS
|
||||
useldap=$YNH_APP_ARG_USELDAP
|
||||
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
|
||||
#REMOVEME? path=$YNH_APP_ARG_PATH
|
||||
#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
#REMOVEME? language=$YNH_APP_ARG_LANGUAGE
|
||||
#REMOVEME? admin=$YNH_APP_ARG_ADMIN
|
||||
#REMOVEME? password="$YNH_APP_ARG_PASSWORD"
|
||||
#REMOVEME? export=$YNH_APP_ARG_EXPORT
|
||||
#REMOVEME? mypads=$YNH_APP_ARG_MYPADS
|
||||
#REMOVEME? useldap=$YNH_APP_ARG_USELDAP
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||
|
||||
if [ "${#password}" -lt 8 ] || [ "${#password}" -gt 30 ]
|
||||
then
|
||||
ynh_die --message="The password must be between 8 and 30 characters."
|
||||
fi
|
||||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
#REMOVEME? install_dir=/var/www/$app
|
||||
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..." --weight=3
|
||||
#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=3
|
||||
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
|
||||
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
ynh_app_setting_set --app=$app --key=password --value="$password"
|
||||
ynh_app_setting_set --app=$app --key=export --value=$export
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=password --value="$password"
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=export --value=$export
|
||||
ynh_app_setting_set --app=$app --key=mypads --value=$mypads
|
||||
ynh_app_setting_set --app=$app --key=useldap --value=$useldap
|
||||
ynh_app_setting_set --app=$app --key=overwrite_settings --value="1"
|
||||
|
@ -78,21 +78,21 @@ ynh_app_setting_set --app=$app --key=overwrite_systemd --value="1"
|
|||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..." --weight=2
|
||||
#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=2
|
||||
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=9001)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
#REMOVEME? port=$(ynh_find_port --port=9001)
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=120
|
||||
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=120
|
||||
|
||||
if [ "$export" = "abiword" ]; then
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies
|
||||
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies
|
||||
elif [ "$export" = "libreoffice" ]; then
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies
|
||||
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies
|
||||
fi
|
||||
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
@ -101,20 +101,20 @@ ynh_use_nodejs
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=3
|
||||
#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=3
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a MySQL database..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Creating a MySQL database..." --weight=1
|
||||
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
#REMOVEME? db_user=$db_name
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" | ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name
|
||||
|
||||
|
@ -123,13 +123,13 @@ echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=4
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:$app "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -156,40 +156,40 @@ chown $app -R /var/log/$app
|
|||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=6
|
||||
|
||||
cp ../conf/settings.json "$final_path/settings.json"
|
||||
cp ../conf/settings.json "$install_dir/settings.json"
|
||||
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/settings.json"
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$install_dir/settings.json"
|
||||
if [ "$export" = "abiword" ]
|
||||
then
|
||||
# Get Abiword binary path
|
||||
abiword_path=`which abiword`
|
||||
# Set the path of abiword into Etherpad config
|
||||
ynh_replace_string --match_string="\"abiword\" : null" --replace_string="\"abiword\" : \"$abiword_path\"" --target_file="$final_path/settings.json"
|
||||
ynh_replace_string --match_string="\"abiword\" : null" --replace_string="\"abiword\" : \"$abiword_path\"" --target_file="$install_dir/settings.json"
|
||||
elif [ "$export" = "libreoffice" ]
|
||||
then
|
||||
# Get soffice binary path
|
||||
soffice_path=`which soffice`
|
||||
# Set the path of soffice into Etherpad config
|
||||
ynh_replace_string --match_string="\"soffice\" : null" --replace_string="\"soffice\" : \"$soffice_path\"" --target_file="$final_path/settings.json"
|
||||
ynh_replace_string --match_string="\"soffice\" : null" --replace_string="\"soffice\" : \"$soffice_path\"" --target_file="$install_dir/settings.json"
|
||||
fi
|
||||
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/settings.json"
|
||||
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$install_dir/settings.json"
|
||||
|
||||
# Use ldap for mypads
|
||||
if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
|
||||
then
|
||||
ynh_replace_string --match_string="//noldap\(.*\)" --replace_string="\1 //useldap" --target_file="$final_path/settings.json"
|
||||
ynh_replace_string --match_string="//noldap\(.*\)" --replace_string="\1 //useldap" --target_file="$install_dir/settings.json"
|
||||
fi
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$final_path/settings.json"
|
||||
ynh_store_file_checksum --file="$install_dir/settings.json"
|
||||
|
||||
ynh_add_config --template="../conf/credentials.json" --destination="$final_path/credentials.json"
|
||||
ynh_add_config --template="../conf/credentials.json" --destination="$install_dir/credentials.json"
|
||||
|
||||
chmod 600 "$final_path/settings.json"
|
||||
chown $app:$app "$final_path/settings.json"
|
||||
chmod 600 "$install_dir/settings.json"
|
||||
chown $app:$app "$install_dir/settings.json"
|
||||
|
||||
chmod 600 "$final_path/credentials.json"
|
||||
chown $app:$app "$final_path/credentials.json"
|
||||
chmod 600 "$install_dir/credentials.json"
|
||||
chown $app:$app "$install_dir/credentials.json"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -204,7 +204,7 @@ ynh_add_systemd_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing Etherpad plugins..." --weight=90
|
||||
|
||||
pushd "$final_path"
|
||||
pushd "$install_dir"
|
||||
# Add Left/Center/Right/Justify to lines of text in a pad
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_align@${ep_align_version}
|
||||
# Framapad - Adds author names to span titles
|
||||
|
@ -240,7 +240,7 @@ popd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing Etherpad..." --weight=90
|
||||
|
||||
pushd $final_path
|
||||
pushd $install_dir
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH bin/installDeps.sh
|
||||
popd
|
||||
|
||||
|
@ -253,14 +253,14 @@ then
|
|||
ynh_script_progression --message="Some hacks..." --weight=1
|
||||
|
||||
# Add a link to Etherpad to allow anonymous pads creation from MyPads.
|
||||
ynh_replace_string --match_string="^ *\"DESCRIPTION\": .*</ul>" --replace_string="&<a href=../>Pads anonymes</a>" --target_file=$final_path/node_modules/ep_mypads/static/l10n/fr.json
|
||||
ynh_replace_string --match_string="^ *\"DESCRIPTION\": .*</ul>" --replace_string="&<a href=../>Anonymous pads</a>" --target_file=$final_path/node_modules/ep_mypads/static/l10n/en.json
|
||||
ynh_replace_string --match_string="^ *\"DESCRIPTION\": .*</ul>" --replace_string="&<a href=../>Pads anonymes</a>" --target_file=$install_dir/node_modules/ep_mypads/static/l10n/fr.json
|
||||
ynh_replace_string --match_string="^ *\"DESCRIPTION\": .*</ul>" --replace_string="&<a href=../>Anonymous pads</a>" --target_file=$install_dir/node_modules/ep_mypads/static/l10n/en.json
|
||||
# And a link to etherpad admin from Mypads.
|
||||
ynh_replace_string --match_string="^ *\"FOOTER\": .*2.0" --replace_string="& | <a href='../admin'>Etherpad admin</a>" --target_file=$final_path/node_modules/ep_mypads/static/l10n/en.json
|
||||
ynh_replace_string --match_string="^ *\"FOOTER\": .*2.0" --replace_string="& | <a href='../admin'>Etherpad admin</a>" --target_file=$final_path/node_modules/ep_mypads/static/l10n/fr.json
|
||||
ynh_replace_string --match_string="^ *\"FOOTER\": .*2.0" --replace_string="& | <a href='../admin'>Etherpad admin</a>" --target_file=$install_dir/node_modules/ep_mypads/static/l10n/en.json
|
||||
ynh_replace_string --match_string="^ *\"FOOTER\": .*2.0" --replace_string="& | <a href='../admin'>Etherpad admin</a>" --target_file=$install_dir/node_modules/ep_mypads/static/l10n/fr.json
|
||||
|
||||
# Find the /div just after the field to open a pad in order to add a link to MyPads plugin.
|
||||
sed -i '157i<center><br><font size="4"><a href="./mypads/" style="text-decoration: none; color: #555">MyPads</a></font></center>' $final_path/src/templates/index.html
|
||||
sed -i '157i<center><br><font size="4"><a href="./mypads/" style="text-decoration: none; color: #555">MyPads</a></font></center>' $install_dir/src/templates/index.html
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -308,25 +308,25 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failrege
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=2
|
||||
#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=2
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
#REMOVEME? if [ $is_public -eq 1 ]
|
||||
then
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
# Only the admin can access the admin panel of the app (if the app has an admin panel)
|
||||
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin --auth_header=false
|
||||
#REMOVEME? ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin --auth_header=false
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# SEND A README FOR THE ADMIN
|
||||
|
@ -337,9 +337,9 @@ admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)
|
|||
|
||||
if [ $mypads -eq 1 ]
|
||||
then
|
||||
Informations="You can access two different admin panels, for Etherpad by accessing https://$domain${path_url%/}/admin and for MyPads by accessing https://$domain${path_url%/}/mypads/?/admin."
|
||||
Informations="You can access two different admin panels, for Etherpad by accessing https://$domain${path%/}/admin and for MyPads by accessing https://$domain${path%/}/mypads/?/admin."
|
||||
else
|
||||
Informations="You can access the admin panel by accessing https://$domain${path_url%/}/admin."
|
||||
Informations="You can access the admin panel by accessing https://$domain${path%/}/admin."
|
||||
fi
|
||||
|
||||
echo "$Informations
|
||||
|
|
|
@ -12,16 +12,16 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=3
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=3
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
export=$(ynh_app_setting_get --app=$app --key=export)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#REMOVEME? db_user=$db_name
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? export=$(ynh_app_setting_get --app=$app --key=export)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
|
@ -55,18 +55,18 @@ ynh_remove_logrotate
|
|||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the MySQL database..." --weight=2
|
||||
#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." --weight=2
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
#REMOVEME? ynh_secure_remove --file="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
|
@ -79,12 +79,12 @@ ynh_remove_nginx_config
|
|||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
|
||||
if [ "$export" != "none" ]
|
||||
then
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_exec_warn_less ynh_remove_app_dependencies
|
||||
#REMOVEME? ynh_exec_warn_less ynh_remove_app_dependencies
|
||||
fi
|
||||
|
||||
ynh_remove_nodejs
|
||||
|
@ -112,10 +112,10 @@ ynh_secure_remove --file="/var/log/$app"
|
|||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=2
|
||||
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=2
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
#REMOVEME? ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -14,63 +14,63 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=3
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=3
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
export=$(ynh_app_setting_get --app=$app --key=export)
|
||||
mypads=$(ynh_app_setting_get --app=$app --key=mypads)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
password=$(ynh_app_setting_get --app=$app --key=password)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#REMOVEME? db_user=$db_name
|
||||
#REMOVEME? export=$(ynh_app_setting_get --app=$app --key=export)
|
||||
#REMOVEME? mypads=$(ynh_app_setting_get --app=$app --key=mypads)
|
||||
#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
#REMOVEME? test ! -d $install_dir \
|
||||
|| ynh_die --message="There is already a directory: $install_dir "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
|
||||
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=2
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:$app "$install_dir"
|
||||
|
||||
chmod 600 "$final_path/settings.json"
|
||||
chown $app:$app "$final_path/settings.json"
|
||||
chmod 600 "$install_dir/settings.json"
|
||||
chown $app:$app "$install_dir/settings.json"
|
||||
|
||||
chmod 600 "$final_path/credentials.json"
|
||||
chown $app:$app "$final_path/credentials.json"
|
||||
chmod 600 "$install_dir/credentials.json"
|
||||
chown $app:$app "$install_dir/credentials.json"
|
||||
|
||||
#=================================================
|
||||
# RESTORE FAIL2BAN CONFIGURATION
|
||||
|
@ -86,12 +86,12 @@ ynh_systemd_action --action=restart --service_name=fail2ban
|
|||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=60
|
||||
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=60
|
||||
|
||||
if [ "$export" = "abiword" ]; then
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies
|
||||
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies
|
||||
elif [ "$export" = "libreoffice" ]; then
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies
|
||||
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies
|
||||
fi
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
ynh_use_nodejs
|
||||
|
@ -106,10 +106,10 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=2
|
||||
#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." --weight=2
|
||||
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" | ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
|
@ -165,9 +165,9 @@ ynh_systemd_action --action=reload --service_name=nginx
|
|||
|
||||
if [ $mypads -eq 1 ]
|
||||
then
|
||||
Informations="You can access 2 different admin panels, for Etherpad by accessing https://$domain${path_url%/}/admin and for MyPads by accessing https://$domain${path_url%/}/mypads/?/admin."
|
||||
Informations="You can access 2 different admin panels, for Etherpad by accessing https://$domain${path%/}/admin and for MyPads by accessing https://$domain${path%/}/mypads/?/admin."
|
||||
else
|
||||
Informations="You can access to the admin panel, by accessing https://$domain${path_url%/}/admin."
|
||||
Informations="You can access to the admin panel, by accessing https://$domain${path%/}/admin."
|
||||
fi
|
||||
|
||||
echo "$Informations
|
||||
|
|
152
scripts/upgrade
152
scripts/upgrade
|
@ -12,35 +12,35 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=20
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=20
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
export=$(ynh_app_setting_get --app=$app --key=export)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
password=$(ynh_app_setting_get --app=$app --key=password)
|
||||
mypads=$(ynh_app_setting_get --app=$app --key=mypads)
|
||||
useldap=$(ynh_app_setting_get --app=$app --key=useldap)
|
||||
abiword=$(ynh_app_setting_get --app=$app --key=abiword)
|
||||
overwrite_settings=$(ynh_app_setting_get --app=$app --key=overwrite_settings)
|
||||
overwrite_credentials=$(ynh_app_setting_get --app=$app --key=overwrite_credentials)
|
||||
overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx)
|
||||
overwrite_systemd=$(ynh_app_setting_get --app=$app --key=overwrite_systemd)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
|
||||
#REMOVEME? language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
#REMOVEME? export=$(ynh_app_setting_get --app=$app --key=export)
|
||||
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#REMOVEME? db_user=$db_name
|
||||
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password)
|
||||
#REMOVEME? mypads=$(ynh_app_setting_get --app=$app --key=mypads)
|
||||
#REMOVEME? useldap=$(ynh_app_setting_get --app=$app --key=useldap)
|
||||
#REMOVEME? abiword=$(ynh_app_setting_get --app=$app --key=abiword)
|
||||
#REMOVEME? overwrite_settings=$(ynh_app_setting_get --app=$app --key=overwrite_settings)
|
||||
#REMOVEME? overwrite_credentials=$(ynh_app_setting_get --app=$app --key=overwrite_credentials)
|
||||
#REMOVEME? overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx)
|
||||
#REMOVEME? overwrite_systemd=$(ynh_app_setting_get --app=$app --key=overwrite_systemd)
|
||||
|
||||
# Optional parameters from config-panel feature
|
||||
pad_config_nocolors=$(ynh_app_setting_get --app=$app --key=pad_config_nocolors)
|
||||
pad_config_showlinenumbers=$(ynh_app_setting_get --app=$app --key=pad_config_showlinenumbers)
|
||||
pad_config_chatandusers=$(ynh_app_setting_get --app=$app --key=pad_config_chatandusers)
|
||||
pad_config_alwaysshowchat=$(ynh_app_setting_get --app=$app --key=pad_config_alwaysshowchat)
|
||||
pad_config_show_markdown=$(ynh_app_setting_get --app=$app --key=pad_config_show_markdown)
|
||||
#REMOVEME? pad_config_nocolors=$(ynh_app_setting_get --app=$app --key=pad_config_nocolors)
|
||||
#REMOVEME? pad_config_showlinenumbers=$(ynh_app_setting_get --app=$app --key=pad_config_showlinenumbers)
|
||||
#REMOVEME? pad_config_chatandusers=$(ynh_app_setting_get --app=$app --key=pad_config_chatandusers)
|
||||
#REMOVEME? pad_config_alwaysshowchat=$(ynh_app_setting_get --app=$app --key=pad_config_alwaysshowchat)
|
||||
#REMOVEME? pad_config_show_markdown=$(ynh_app_setting_get --app=$app --key=pad_config_show_markdown)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -55,16 +55,16 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=35
|
||||
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=35
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_backup_before_upgrade
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
#REMOVEME? ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# ACTIVATE MAINTENANCE MODE
|
||||
|
@ -90,7 +90,7 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
|
|||
# If db_name doesn't exist, create it
|
||||
if [ -z "$db_name" ]; then
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
fi
|
||||
|
||||
# If abiword setting doesn't exist
|
||||
|
@ -104,14 +104,14 @@ if [ -n "$abiword" ]; then
|
|||
if [ $abiword -eq 1 ]; then
|
||||
export=abiword
|
||||
fi
|
||||
ynh_app_setting_set --app=$app --key=export --value=$export
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=export --value=$export
|
||||
ynh_app_setting_delete --app=$app --key=abiword
|
||||
fi
|
||||
|
||||
# If export setting doesn't exist
|
||||
if [ -z "$export" ]; then
|
||||
export=none
|
||||
ynh_app_setting_set --app=$app --key=export --value=$export
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=export --value=$export
|
||||
fi
|
||||
|
||||
# If mypads setting doesn't exist
|
||||
|
@ -126,10 +126,10 @@ if [ -z "$useldap" ]; then
|
|||
ynh_app_setting_set --app=$app --key=useldap --value=$useldap
|
||||
fi
|
||||
|
||||
# If path_url setting doesn't exist
|
||||
if [ -z "$path_url" ]; then
|
||||
path_url="/"
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
# If path setting doesn't exist
|
||||
if [ -z "$path" ]; then
|
||||
path="/"
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
|
||||
fi
|
||||
|
||||
# If overwrite_settings doesn't exist, create it
|
||||
|
@ -157,15 +157,15 @@ if [ -z "$overwrite_systemd" ]; then
|
|||
fi
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
#REMOVEME? if ynh_legacy_permissions_exists; then
|
||||
#REMOVEME? ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
if ! ynh_permission_exists --permission="admin"; then
|
||||
#REMOVEME? if ! ynh_permission_exists --permission="admin"; then
|
||||
# Create the required permissions
|
||||
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
|
||||
#REMOVEME? ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
|
||||
else
|
||||
# Make sure the admin panel is not exposed to the SSO's authentication headers
|
||||
# AFAIK there is no helper to check if that flag is up or not, so let's force it.
|
||||
|
@ -179,10 +179,10 @@ ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -193,22 +193,22 @@ then
|
|||
ynh_script_progression --message="Upgrading source files..." --weight=4
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path" --keep="settings.json credentials.json"
|
||||
ynh_setup_source --dest_dir="$install_dir" --keep="settings.json credentials.json"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:$app "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=5
|
||||
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=5
|
||||
|
||||
if [ "$export" = "abiword" ]; then
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies
|
||||
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies
|
||||
elif [ "$export" = "libreoffice" ]; then
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies
|
||||
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies
|
||||
fi
|
||||
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
@ -247,22 +247,22 @@ then
|
|||
if [ $overwrite_settings -eq 1 ]
|
||||
then
|
||||
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/settings.json"
|
||||
cp ../conf/settings.json "$final_path/settings.json"
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/settings.json"
|
||||
ynh_backup_if_checksum_is_different --file="$install_dir/settings.json"
|
||||
cp ../conf/settings.json "$install_dir/settings.json"
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$install_dir/settings.json"
|
||||
|
||||
if [ "$export" = "abiword" ]
|
||||
then
|
||||
# Get abiword binary path
|
||||
abiword_path=`which abiword`
|
||||
# Set the path of Abiword into Etherpad config
|
||||
ynh_replace_string --match_string="\"abiword\" : null" --replace_string="\"abiword\" : \"$abiword_path\"" --target_file="$final_path/settings.json"
|
||||
ynh_replace_string --match_string="\"abiword\" : null" --replace_string="\"abiword\" : \"$abiword_path\"" --target_file="$install_dir/settings.json"
|
||||
elif [ "$export" = "libreoffice" ]
|
||||
then
|
||||
# Get soffice binary path
|
||||
soffice_path=`which soffice`
|
||||
# Set the path of soffice into Etherpad config
|
||||
ynh_replace_string --match_string="\"soffice\" : null" --replace_string="\"soffice\" : \"$soffice_path\"" --target_file="$final_path/settings.json"
|
||||
ynh_replace_string --match_string="\"soffice\" : null" --replace_string="\"soffice\" : \"$soffice_path\"" --target_file="$install_dir/settings.json"
|
||||
fi
|
||||
|
||||
if test -z "$language"; then
|
||||
|
@ -270,47 +270,47 @@ then
|
|||
language=en
|
||||
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||
fi
|
||||
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/settings.json"
|
||||
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$install_dir/settings.json"
|
||||
|
||||
# Use LDAP for MyPads
|
||||
if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
|
||||
then
|
||||
ynh_replace_string --match_string="//noldap" --replace_string="" --target_file="$final_path/settings.json"
|
||||
ynh_replace_string --match_string="//noldap" --replace_string="" --target_file="$install_dir/settings.json"
|
||||
fi
|
||||
|
||||
# Optional parameters from config-panel feature
|
||||
if [ -n "$pad_config_nocolors" ]; then
|
||||
ynh_replace_string --match_string="\(\"noColors\" *: \).*," --replace_string="\1$pad_config_nocolors," --target_file="$final_path/settings.json"
|
||||
ynh_replace_string --match_string="\(\"noColors\" *: \).*," --replace_string="\1$pad_config_nocolors," --target_file="$install_dir/settings.json"
|
||||
fi
|
||||
if [ -n "$pad_config_showlinenumbers" ]; then
|
||||
ynh_replace_string --match_string="\(\"showLineNumbers\" *: \).*," --replace_string="\1$pad_config_showlinenumbers," --target_file="$final_path/settings.json"
|
||||
ynh_replace_string --match_string="\(\"showLineNumbers\" *: \).*," --replace_string="\1$pad_config_showlinenumbers," --target_file="$install_dir/settings.json"
|
||||
fi
|
||||
if [ -n "$pad_config_chatandusers" ]; then
|
||||
ynh_replace_string --match_string="\(\"chatAndUsers\" *: \).*," --replace_string="\1$pad_config_chatandusers," --target_file="$final_path/settings.json"
|
||||
ynh_replace_string --match_string="\(\"chatAndUsers\" *: \).*," --replace_string="\1$pad_config_chatandusers," --target_file="$install_dir/settings.json"
|
||||
fi
|
||||
if [ -n "$pad_config_alwaysshowchat" ]; then
|
||||
ynh_replace_string --match_string="\(\"alwaysShowChat\" *: \).*," --replace_string="\1$pad_config_alwaysshowchat," --target_file="$final_path/settings.json"
|
||||
ynh_replace_string --match_string="\(\"alwaysShowChat\" *: \).*," --replace_string="\1$pad_config_alwaysshowchat," --target_file="$install_dir/settings.json"
|
||||
fi
|
||||
if [ -n "$pad_config_show_markdown" ]; then
|
||||
ynh_replace_string --match_string="\(\"ep_markdown_default\" *: \).*," --replace_string="\1$pad_config_show_markdown," --target_file="$final_path/settings.json"
|
||||
ynh_replace_string --match_string="\(\"ep_markdown_default\" *: \).*," --replace_string="\1$pad_config_show_markdown," --target_file="$install_dir/settings.json"
|
||||
fi
|
||||
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$final_path/settings.json"
|
||||
ynh_store_file_checksum --file="$install_dir/settings.json"
|
||||
fi
|
||||
|
||||
# Overwrite the credentials config file only if it's allowed
|
||||
if [ $overwrite_credentials -eq 1 ]
|
||||
then
|
||||
ynh_add_config --template="../conf/credentials.json" --destination="$final_path/credentials.json"
|
||||
ynh_add_config --template="../conf/credentials.json" --destination="$install_dir/credentials.json"
|
||||
fi
|
||||
fi
|
||||
|
||||
chmod 600 "$final_path/settings.json"
|
||||
chown $app:$app "$final_path/settings.json"
|
||||
chmod 600 "$install_dir/settings.json"
|
||||
chown $app:$app "$install_dir/settings.json"
|
||||
|
||||
chmod 600 "$final_path/credentials.json"
|
||||
chown $app:$app "$final_path/credentials.json"
|
||||
chmod 600 "$install_dir/credentials.json"
|
||||
chown $app:$app "$install_dir/credentials.json"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -328,7 +328,7 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing Etherpad plugins..." --weight=90
|
||||
|
||||
pushd "$final_path"
|
||||
pushd "$install_dir"
|
||||
# Add Left/Center/Right/Justify to lines of text in a pad
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_align@${ep_align_version}
|
||||
# Framapad - Adds author names to span titles
|
||||
|
@ -364,7 +364,7 @@ popd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Upgrading Etherpad..." --weight=60
|
||||
|
||||
pushd $final_path
|
||||
pushd $install_dir
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH bin/installDeps.sh
|
||||
popd
|
||||
|
||||
|
@ -375,7 +375,7 @@ popd
|
|||
if [ "$upgrade_type" == "UPGRADE_APP" ] && [ $mypads -eq 1 ]
|
||||
then
|
||||
# Find the /div just after the field to open a pad in order to add a link to MyPads plugin.
|
||||
sed -i '157i<center><br><font size="4"><a href="./mypads/" style="text-decoration: none; color: #555">MyPads</a></font></center>' $final_path/src/templates/index.html
|
||||
sed -i '157i<center><br><font size="4"><a href="./mypads/" style="text-decoration: none; color: #555">MyPads</a></font></center>' $install_dir/src/templates/index.html
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -413,9 +413,9 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failrege
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# DEACTIVE MAINTENANCE MODE
|
||||
|
@ -433,7 +433,7 @@ admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)
|
|||
|
||||
# Build the changelog
|
||||
# Get the value of admin_mail_html
|
||||
admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
|
||||
#REMOVEME? admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
|
||||
admin_mail_html="${admin_mail_html:-0}"
|
||||
# If a html email is required. Apply html to the changelog.
|
||||
if [ "$admin_mail_html" -eq 1 ]; then
|
||||
|
@ -445,9 +445,9 @@ ynh_app_changelog --format=$format
|
|||
|
||||
if [ $mypads -eq 1 ]
|
||||
then
|
||||
Informations="You can access 2 different admin panels, for Etherpad by accessing https://$domain${path_url%/}/admin and for MyPads by accessing https://$domain${path_url%/}/mypads/?/admin."
|
||||
Informations="You can access 2 different admin panels, for Etherpad by accessing https://$domain${path%/}/admin and for MyPads by accessing https://$domain${path%/}/mypads/?/admin."
|
||||
else
|
||||
Informations="You can access the admin panel by accessing https://$domain${path_url%/}/admin."
|
||||
Informations="You can access the admin panel by accessing https://$domain${path%/}/admin."
|
||||
fi
|
||||
|
||||
echo "$Informations
|
||||
|
|
Loading…
Add table
Reference in a new issue