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-08-31 11:39:28 +02:00

83 lines
2.5 KiB
Bash
Executable file

#!/bin/bash
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 'Setting up source files...'
install_source
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression 'Adding configuration files...'
add_config
set_permissions
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression "Adding system configurations related to $app..."
# Create a dedicated NGINX config using the conf/nginx.conf template
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd
yunohost service add "$app" --description=XWiki --log="/var/log/$app/$app.log"
ynh_config_add_logrotate "/var/log/$app"
#=================================================
# INSTALL EXTENSIONS
#=================================================
enable_super_admin
# Start a systemd service
ynh_systemctl --service="$app" --action=start --log_path=systemd --wait_until="$systemd_match_start_line"
if [ "$install_standard_flavor" -eq 1 ]; then
ynh_script_progression 'Installing flavor...'
wait_for_flavor_install
fi
ynh_script_progression 'Installing LDAP extension...'
install_exension 'org.xwiki.contrib.ldap:ldap-authenticator' "$ldap_version"
# Disable super admin
ynh_systemctl --service="$app" --action=stop
disable_super_admin
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service="$app" --action=start --log_path=systemd --wait_until="$systemd_match_start_line"
wait_xwiki_started
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Installation of $app completed"