mirror of
https://github.com/YunoHost-Apps/etherpad_mypads_ynh.git
synced 2024-09-03 18:36:09 +02:00
cleaning
This commit is contained in:
parent
39d0808ab3
commit
ca4469b26b
5 changed files with 0 additions and 408 deletions
35
actions.toml
35
actions.toml
|
@ -1,35 +0,0 @@
|
|||
[add_remove_abiword]
|
||||
name = "Install/remove AbiWord"
|
||||
command = "/bin/bash scripts/actions/add_remove_abiword"
|
||||
# user = "root" # optional
|
||||
# cwd = "/" # optional
|
||||
# accepted_return_codes = [0, 1, 2, 3] # optional
|
||||
accepted_return_codes = [0]
|
||||
description = "Install or remove AbiWord"
|
||||
|
||||
[add_remove_libreoffice]
|
||||
name = "Install/remove LibreOffice"
|
||||
command = "/bin/bash scripts/actions/add_remove_libreoffice"
|
||||
# user = "root" # optional
|
||||
# cwd = "/" # optional
|
||||
# accepted_return_codes = [0, 1, 2, 3] # optional
|
||||
accepted_return_codes = [0]
|
||||
description = "Install or remove LibreOffice"
|
||||
|
||||
[list_all_pads]
|
||||
name = "List all existing pads"
|
||||
command = "/bin/bash scripts/actions/list_all_pads"
|
||||
# user = "root" # optional
|
||||
# cwd = "/" # optional
|
||||
# accepted_return_codes = [0, 1, 2, 3] # optional
|
||||
accepted_return_codes = [0]
|
||||
description = "List all existing pads."
|
||||
|
||||
[reset_default_config]
|
||||
name = "Reset the config file and restore a default one."
|
||||
command = "/bin/bash scripts/actions/reset_default_config \"settings.json\""
|
||||
# user = "root" # optional
|
||||
# cwd = "/" # optional
|
||||
# accepted_return_codes = [0, 1, 2, 3] # optional
|
||||
accepted_return_codes = [0]
|
||||
description = "Reset the config file settings.json."
|
|
@ -1,110 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# CHECK IF ARGUMENTS ARE CORRECT
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# CHECK IF AN ACTION HAS TO BE DONE
|
||||
#=================================================
|
||||
|
||||
# Check the dependencies of the meta packages of etherpad_mypads with apt-cache
|
||||
if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet abiword
|
||||
then
|
||||
# Abiword is already a dependence of etherpad_mypads.
|
||||
# Abiword should be removed.
|
||||
abiword=0
|
||||
action1=removed
|
||||
action2=Removing
|
||||
else
|
||||
# Abiword isn't a dependence of etherpad_mypads.
|
||||
# Abiword should be installed.
|
||||
abiword=1
|
||||
action1=installed
|
||||
action2=Installing
|
||||
fi
|
||||
|
||||
ynh_print_info --message="Abiword will be $action1."
|
||||
|
||||
if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet libreoffice-writer
|
||||
then
|
||||
# LibreOffice is already a dependence of Etherpad MyPads.
|
||||
# Keep it
|
||||
libreoffice=1
|
||||
else
|
||||
# LibreOffice isn't a dependence of Etherpad MyPads.
|
||||
# Do not add it
|
||||
libreoffice=0
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC ACTION
|
||||
#=================================================
|
||||
# INSTALL OR REMOVE ABIWORD
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="$action2 AbiWord..." --weight=3
|
||||
|
||||
dependencies=""
|
||||
if [ $abiword -eq 1 ]
|
||||
then
|
||||
# Add abiword dependencies if Abiword has to be installed
|
||||
dependencies="$dependencies $abiword_app_depencencies"
|
||||
fi
|
||||
if [ $libreoffice -eq 1 ]
|
||||
then
|
||||
# Add LibreOffice dependencies if LibreOffice is already installed to keep it as a dependence.
|
||||
dependencies="$dependencies $libreoffice_app_dependencies"
|
||||
fi
|
||||
|
||||
# Rebuild the meta package and install the new dependencies
|
||||
( cd scripts # Move to scripts directory to allow the helper to find the manifest where it expects to find it.
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $dependencies)
|
||||
|
||||
# Remove all unused dependencies
|
||||
ynh_package_autopurge
|
||||
|
||||
#=================================================
|
||||
# SET THE DEFAULT EXPORT APP
|
||||
#=================================================
|
||||
|
||||
if [ $abiword -eq 1 ]
|
||||
then
|
||||
# Set Abiword as default export app
|
||||
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=abiword"
|
||||
elif [ $libreoffice -eq 1 ]
|
||||
then
|
||||
# Set LibreOffice as default export app
|
||||
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=libreoffice"
|
||||
else
|
||||
# Remove any export app
|
||||
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=none"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Execution completed" --last
|
|
@ -1,110 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# CHECK IF ARGUMENTS ARE CORRECT
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# CHECK IF AN ACTION HAS TO BE DONE
|
||||
#=================================================
|
||||
|
||||
# Check the dependencies of the meta packages of Etherpad MyPads with apt-cache
|
||||
if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet libreoffice-writer
|
||||
then
|
||||
# LibreOffice is already a dependence of Etherpad myPads.
|
||||
# LibreOffice should be removed.
|
||||
libreoffice=0
|
||||
action1=removed
|
||||
action2=Removing
|
||||
else
|
||||
# LibreOffice isn't a dependence of Etherpad MyPads.
|
||||
# LibreOffice should be installed.
|
||||
libreoffice=1
|
||||
action1=installed
|
||||
action2=Installing
|
||||
fi
|
||||
|
||||
ynh_print_info --message="LibreOffice will be $action1."
|
||||
|
||||
if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet abiword
|
||||
then
|
||||
# Abiword is already a dependence of Etherpad MyPads.
|
||||
# Keep it
|
||||
abiword=1
|
||||
else
|
||||
# Abiword isn't a dependence of Etherpad MyPads.
|
||||
# Do not add it
|
||||
abiword=0
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC ACTION
|
||||
#=================================================
|
||||
# INSTALL OR REMOVE LIBREOFFICE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="$action2 LibreOffice..." --weight=3
|
||||
|
||||
dependencies=""
|
||||
if [ $libreoffice -eq 1 ]
|
||||
then
|
||||
# Add LibreOffice dependencies if LibreOffice has to be installed
|
||||
dependencies="$dependencies $libreoffice_app_dependencies"
|
||||
fi
|
||||
if [ $abiword -eq 1 ]
|
||||
then
|
||||
# Add Abiword dependencies if abiword is already installed to keep it as a dependence.
|
||||
dependencies="$dependencies $abiword_app_depencencies"
|
||||
fi
|
||||
|
||||
# Rebuild the meta package and install the new dependencies
|
||||
( cd scripts # Move to scripts directory to allow the helper to find the manifest where it expects to find it.
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $dependencies)
|
||||
|
||||
# Remove all unused dependencies
|
||||
ynh_package_autopurge
|
||||
|
||||
#=================================================
|
||||
# SET THE DEFAULT EXPORT APP
|
||||
#=================================================
|
||||
|
||||
if [ $libreoffice -eq 1 ]
|
||||
then
|
||||
# Set LibreOffice as default export app
|
||||
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=libreoffice"
|
||||
elif [ $abiword -eq 1 ]
|
||||
then
|
||||
# Set Abiword as default export app
|
||||
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=abiword"
|
||||
else
|
||||
# Remove any export app
|
||||
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=none"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Execution completed" --last
|
|
@ -1,57 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF ARGUMENTS ARE CORRECT
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# CHECK IF AN ACTION HAS TO BE DONE
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC ACTION
|
||||
#=================================================
|
||||
# LIST ALL PADS FROM THE DATABASE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Listing all pads..." --weight=3
|
||||
|
||||
# Get the list of pads from the database
|
||||
pad_list="$(ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name <<< \
|
||||
"select distinct substring(store.key,5,locate(\":\",store.key,5)-5) as \"pads\" from store where store.key like \"pad:%\"")"
|
||||
|
||||
# Remove empty lines
|
||||
# Name the first line "> List of pads"
|
||||
# Then for the second lines and following, add >> before the name of the pad.
|
||||
ynh_print_info --message="$(echo "$pad_list" | sed '/^$/d' | sed '1 s/^/> List of /' | sed '2,$s/^/>> /g')"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Execution completed" --last
|
|
@ -1,96 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
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)
|
||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
mypads=$(ynh_app_setting_get --app=$app --key=mypads)
|
||||
useldap=$(ynh_app_setting_get --app=$app --key=useldap)
|
||||
|
||||
#=================================================
|
||||
# SORT OUT THE CONFIG FILE TO HANDLE
|
||||
#=================================================
|
||||
|
||||
file="$1"
|
||||
|
||||
if [ "$file" = "settings.json" ]; then
|
||||
config_file="$final_path/settings.json"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC ACTION
|
||||
#=================================================
|
||||
# RESET THE CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Resetting the config file $config_file..." --weight=3
|
||||
|
||||
# Verify the checksum and backup the file if it's different
|
||||
ynh_backup_if_checksum_is_different --file="$config_file"
|
||||
|
||||
if [ "$file" = "settings.json" ]
|
||||
then
|
||||
# Get the default file and overwrite the current config
|
||||
cp /etc/yunohost/apps/$app/conf/settings.json "$config_file"
|
||||
|
||||
# Recreate the default config
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/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"
|
||||
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"
|
||||
fi
|
||||
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/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"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$config_file"
|
||||
|
||||
#=================================================
|
||||
# CHECK ETHERPAD STARTING
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restarting Etherpad..." --weight=9
|
||||
|
||||
# Wait for etherpad to be fully started
|
||||
ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
Loading…
Add table
Reference in a new issue