mirror of
https://github.com/YunoHost-Apps/garage_ynh.git
synced 2024-09-03 18:36:32 +02:00
114 lines
3.7 KiB
Text
Executable file
114 lines
3.7 KiB
Text
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
|
|
if [ "$virtualisation" = "true" ]
|
|
then
|
|
export VIRTUALISTATION=true
|
|
fi
|
|
|
|
#=================================================
|
|
# REMOVE NODE CONFIGURATION
|
|
#=================================================
|
|
$install_dir/garage -c $install_dir/garage.toml layout remove "$node_id"
|
|
|
|
apply_layout "$install_dir/garage -c $install_dir/garage.toml "
|
|
if [ $? -ne 0 ]
|
|
then
|
|
ynh_print_warn --message="unable to remove the node. Maybe the number of node staying alive is not enough"
|
|
fi
|
|
|
|
#=================================================
|
|
# STANDARD REMOVE
|
|
#=================================================
|
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
|
#=================================================
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
|
then
|
|
ynh_script_progression --message="Removing $app service integration..."
|
|
yunohost service remove $app
|
|
fi
|
|
|
|
#=================================================
|
|
# STOP AND REMOVE SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Stopping and removing the systemd service..."
|
|
|
|
# Remove the dedicated systemd config
|
|
ynh_remove_systemd_config
|
|
|
|
#=================================================
|
|
# REMOVE LOGROTATE CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Removing logrotate configuration..."
|
|
|
|
# Remove the app-specific logrotate config
|
|
ynh_remove_logrotate
|
|
|
|
|
|
if [[ "$system_is_inside_container" == "true" ]]
|
|
then
|
|
#=================================================
|
|
# REMOVE VIRTUAL DISK
|
|
#=================================================
|
|
ynh_script_progression --message="umount virtual disk..."
|
|
|
|
# Remove the app directory securely
|
|
$install_dir/umount_disk.sh
|
|
fi
|
|
|
|
#=================================================
|
|
# REMOVE APP MAIN DIR
|
|
#=================================================
|
|
#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1
|
|
|
|
# Remove the app directory securely
|
|
#REMOVEME? ynh_secure_remove --file="$install_dir"
|
|
|
|
#=================================================
|
|
# REMOVE NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Removing NGINX web server configuration..."
|
|
|
|
# Remove the dedicated NGINX config
|
|
ynh_remove_nginx_config
|
|
|
|
#add wildcard subdomain
|
|
ynh_replace_string --replace_string="server_name $domain" --match_string="server_name $domain *.$domain" --target_file="/etc/nginx/conf.d/$domain.conf"
|
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.conf"
|
|
|
|
#=================================================
|
|
# SPECIFIC REMOVE
|
|
#=================================================
|
|
# REMOVE VARIOUS FILES
|
|
#=================================================
|
|
ynh_script_progression --message="Removing various files..."
|
|
|
|
# Remove the log files
|
|
ynh_secure_remove --file="/var/log/$app"
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
|
|
ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/98-nginx_$app"
|
|
yunohost tools regen-conf nginx
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|