Compare commits
4 Commits
970c5e1df6
...
46de0f10e4
| Author | SHA1 | Date | |
|---|---|---|---|
| 46de0f10e4 | |||
| 2c763489b7 | |||
| 73f710a11e | |||
| 9eaaf473f1 |
13
conf/nginx.conf
Normal file
13
conf/nginx.conf
Normal file
@ -0,0 +1,13 @@
|
||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
location __PATH__/ {
|
||||
|
||||
# Path to source
|
||||
alias __INSTALL_DIR__/;
|
||||
|
||||
index index.html;
|
||||
|
||||
try_files $uri /index.html;
|
||||
|
||||
# Include SSOWAT user panel
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
45
manifest.toml
Normal file
45
manifest.toml
Normal file
@ -0,0 +1,45 @@
|
||||
packaging_format = 2
|
||||
|
||||
id = "restarter"
|
||||
name = "Restarter for yunohost"
|
||||
description.en = "A simple service restarter for Yunohost, supporting these apps: MiniDLNA"
|
||||
|
||||
version = "0.2~ynh1"
|
||||
|
||||
maintainers = ["eclipse"]
|
||||
|
||||
[upstream]
|
||||
license = "GPL-3.0"
|
||||
code = "https://git.unterdemradar.de/eclipse/restarter_ynh"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.1"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
ldap = "not_relevant"
|
||||
sso = "not_relevant"
|
||||
disk = "1M"
|
||||
ram.build = "1M"
|
||||
ram.runtime = "1M"
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||
type = "domain"
|
||||
|
||||
[install.path]
|
||||
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||
type = "path"
|
||||
default = "/restarter"
|
||||
|
||||
[install.init_main_permission]
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[resources]
|
||||
[resources.install_dir]
|
||||
owner = "www-data:rwx"
|
||||
group = "www-data:rx"
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
28
scripts/backup
Normal file
28
scripts/backup
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_backup --src_path="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE SUDOERS CONFIGURATION
|
||||
#=================================================
|
||||
ynh_backup --src_path="/etc/sudoers.d/$app"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
51
scripts/install
Normal file
51
scripts/install
Normal file
@ -0,0 +1,51 @@
|
||||
#!/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_setup_source --dest_dir="$install_dir"
|
||||
|
||||
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 750 "$install_dir"
|
||||
chmod 640 "$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
|
||||
18
scripts/remove
Normal file
18
scripts/remove
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing nginx web server configuration..." --weight=1
|
||||
|
||||
ynh_remove_nginx_config
|
||||
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing nginx web server configuration..." --weight=1
|
||||
|
||||
rm /etc/sudoers.d/$app
|
||||
45
scripts/restore
Normal file
45
scripts/restore
Normal file
@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chown -R www-date:www-data $install_dir
|
||||
chmod 750 "$install_dir"
|
||||
chmod 640 "$install_dir/*"
|
||||
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
||||
#=================================================
|
||||
# RESTORE SUDOERS CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the sudoers configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/sudoers.d/$app"
|
||||
chown root:root "/etc/sudoers.d/$app"
|
||||
chmod 600 "/etc/sudoers.d/$app"
|
||||
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoration completed for $app" --last
|
||||
Loading…
Reference in New Issue
Block a user