1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/xwiki_ynh.git synced 2024-09-03 20:36:11 +02:00
xwiki_ynh/scripts/install
2024-04-27 01:00:20 +02:00

91 lines
2.9 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
#=================================================
if [ -n "$(ls -A "$data_dir")" ]; then
old_data_dir_path="${data_dir}_$(date '+%Y%m%d.%H%M%S')"
ynh_print_warn "Data directory was not empty. Data was moved to $old_data_dir_path"
mkdir -p "$old_data_dir_path"
mv -t "$old_data_dir_path" "$data_dir"/*
fi
mkdir -p /var/log/"$app"
mkdir -p /etc/"$app"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message='Setting up source files...' --weight=1
install_source
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message='Adding configuration files...' --weight=1
add_config
set_permissions
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config using the conf/nginx.conf template
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add "$app" --description=XWiki --log="/var/log/$app/$app.log"
ynh_use_logrotate --logfile="/var/log/$app"
#=================================================
# INSTALL EXTENSIONS
#=================================================
enable_super_admin
# Start a systemd service
ynh_systemd_action --service_name="$app" --action=start --log_path=systemd --line_match="$systemd_match_start_line"
if [ "$install_standard_flavor" -eq 1 ]; then
ynh_script_progression --message='Installing flavor...'
wait_for_flavor_install
fi
ynh_script_progression --message='Installing LDAP extension...' --weight=1
install_exension 'org.xwiki.contrib.ldap:ldap-authenticator' "$ldap_version"
# Disable super admin
ynh_systemd_action --service_name="$app" --action=stop
disable_super_admin
#=================================================
# GENERIC FINALIZATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message='Starting a systemd service...' --weight=1
ynh_systemd_action --service_name="$app" --action=start --log_path=systemd --line_match="$systemd_match_start_line"
wait_xwiki_started
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last