mirror of
https://github.com/YunoHost-Apps/gogs_ynh.git
synced 2024-09-03 20:36:23 +02:00
83 lines
2.5 KiB
Bash
83 lines
2.5 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
#=================================================
|
|
|
|
# Retrieve arguments
|
|
key=$(ynh_string_random)
|
|
ynh_app_setting_set --app=$app --key=key --value=$key
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files..." --weight=3
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
ynh_setup_source --dest_dir=$install_dir
|
|
|
|
mkdir -p "$install_dir/custom/conf/auth.d"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R $app:www-data "$install_dir"
|
|
|
|
#=================================================
|
|
# ADD A CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
|
|
|
if [ "$path" = "/" ]
|
|
then
|
|
url="$domain"
|
|
else
|
|
url="$domain${path%/}"
|
|
fi
|
|
|
|
ynh_add_config --template="../conf/app.ini" --destination="$install_dir/custom/conf/app.ini"
|
|
|
|
chmod 400 "$install_dir/custom/conf/app.ini"
|
|
chown $app:$app "$install_dir/custom/conf/app.ini"
|
|
|
|
ynh_add_config --template="../conf/ldap.conf" --destination="$install_dir/custom/conf/auth.d/ldap.conf"
|
|
|
|
#=================================================
|
|
# SETUP SYSTEMD
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
|
|
|
# Configure init script
|
|
ynh_add_systemd_config
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
# Use logrotate to manage application logfile(s)
|
|
ynh_use_logrotate
|
|
|
|
chown -R $app:$app "/var/log/$app"
|
|
chmod u=rwX,g=rX,o= "/var/log/$app"
|
|
|
|
yunohost service add $app --description="Lightweight Git forge" --log="/var/log/$app/$app.log"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=3
|
|
|
|
# Start a systemd service
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|