mirror of
https://github.com/YunoHost-Apps/writefreely_ynh.git
synced 2024-09-03 20:36:02 +02:00
* Auto-update README * Version 2 (#112) * v2 * v2 * Auto-update README * cleaning * Auto-update README * Update manifest.toml * Update systemd.service * Update systemd.service --------- Co-authored-by: yunohost-bot <yunohost@yunohost.org> * Auto-update README * Update manifest.toml * Auto-update README --------- Co-authored-by: yunohost-bot <yunohost@yunohost.org>
78 lines
2.5 KiB
Bash
Executable file
78 lines
2.5 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
#=================================================
|
|
|
|
# Bypass package_checker name not compatible with writefreely
|
|
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
|
admin="test"
|
|
fi
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files..."
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
ynh_setup_source --dest_dir="$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R $app:www-data "$install_dir"
|
|
|
|
#=================================================
|
|
# NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring NGINX web server..."
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
# Create a dedicated systemd config
|
|
ynh_add_systemd_config
|
|
|
|
yunohost service add $app --description="WriteFreely daemon" --log="/var/log/$app/$app.log"
|
|
|
|
#=================================================
|
|
# ADD A CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding a configuration file..."
|
|
|
|
ynh_add_config --template="../conf/config.ini" --destination="$install_dir/config.ini"
|
|
|
|
chmod 600 "$install_dir/config.ini"
|
|
chown $app:$app "$install_dir/config.ini"
|
|
|
|
#=================================================
|
|
# MAKE SETUP
|
|
#=================================================
|
|
ynh_script_progression --message="Making setup..."
|
|
|
|
pushd $install_dir
|
|
ynh_exec_as $app ./writefreely --init-db
|
|
ynh_exec_as $app ./writefreely --gen-keys
|
|
ynh_exec_as $app ./writefreely --create-admin "$admin":"$password"
|
|
popd
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..."
|
|
|
|
# Start a systemd service
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Serving on"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed"
|