50 lines
1.6 KiB
Bash
50 lines
1.6 KiB
Bash
#!/bin/bash
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
#=================================================
|
|
# CHECK IF RESTARTABLE SERVICES EXIST
|
|
#=================================================
|
|
ynh_script_progression --message="Checking installed apps: minidlna …" --weight=1
|
|
|
|
if ! yunohost app list | grep "id: minidlna" >/dev/null 2>&1 ; then
|
|
ynh_die --message="No restartable app found. aborting installation" --ret-code="1"
|
|
fi
|
|
|
|
|
|
#=================================================
|
|
# INSTALL FILES
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files…" --weight=1
|
|
|
|
ynh_add_config --template="index.html" --destination="$install_dir/index.html"
|
|
ynh_add_config --template="restarter.php" --destination="$install_dir/$app.php"
|
|
|
|
chown -R www-data:www-data "$install_dir"
|
|
chmod -R 640 "$install_dir"
|
|
chmod 750 "$install_dir"
|
|
|
|
|
|
#=================================================
|
|
# SUDOERS CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding sudoers configuration …" --weight=1
|
|
|
|
ynh_add_config --template="sudoer" --destination="/etc/sudoers.d/$app"
|
|
chown root:root "/etc/sudoers.d/$app"
|
|
chmod 600 "/etc/sudoers.d/$app"
|
|
|
|
#=================================================
|
|
# WEBSERVER CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding nginx configuration …" --weight=1
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
ynh_script_progression --message="Installation of $app completed" --last
|