1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/opentracker_ynh.git synced 2024-09-03 19:46:34 +02:00
opentracker_ynh/scripts/install
Éric Gaspar 82e4f12c21 fix
2023-05-01 19:12:55 +02:00

62 lines
2.1 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Installing OpenTracker..." --weight=5
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
git clone git://erdgeist.org/opentracker "$install_dir" --quiet
cp ../conf/Makefile $install_dir/Makefile
cp ../conf/opentracker.conf.sample $install_dir/opentracker.conf
pushd $install_dir
ynh_exec_warn_less make
popd
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=2
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to app files
chown -R $app: $install_dir
chmod +x $install_dir/$app
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Bittorrent tracker" --log="systemd" --needs_exposed_ports="$port"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service
ynh_systemd_action --service_name=$app --action=start --log_path="systemd"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of OpenTracker completed" --last