created yunohost scripts
This commit is contained in:
parent
970c5e1df6
commit
9eaaf473f1
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