mirror of
https://github.com/YunoHost-Apps/mastodon_ynh.git
synced 2024-09-03 19:46:02 +02:00
3d39136865
* [enh] Switch to tagged release * [enh] Switch to tagged release on upgrade * [fix] Restore pg dump Restore pg dump with mastodon user. * Change version on manifest * [fix] Change rm dump to ynh_secure_remove * [fix] Upgrade from 1.3.3 Fix error: Your local changes to the following files would be overwritten by merge: .babelrc .dockerignore .editorconfig .env.production.sample .gitignore .rubocop.yml .travis.yml Capfile Dockerfile README.md Vagrantfile .... * [fix] Owner of live * [fix] Reinstall dependencies on restore * Return to home * [fix] Jenkins upgrade error * Check .fonctions * Remove unneeded comment * Add apt lists to backup * Change .list name on backup * Copy Apt .lists on restore * version 1.3.3 on manifest * Remove admin instructions + TODO
103 lines
3 KiB
Bash
103 lines
3 KiB
Bash
#!/bin/bash
|
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
set -u
|
|
|
|
if [ ! -e .fonctions ]; then
|
|
# Get file fonction if not been to the current directory
|
|
sudo cp ../settings/scripts/.fonctions ./.fonctions
|
|
sudo chmod a+rx .fonctions
|
|
fi
|
|
|
|
source .fonctions # Loads the generic functions usually used in the script
|
|
# Source app helpers
|
|
source /usr/share/yunohost/helpers
|
|
|
|
# Get multi-instances specific variables
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
# Retrieve app settings
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
|
|
# Stop mastodon-web
|
|
if [ -e "/etc/systemd/system/mastodon-web.service" ]; then
|
|
echo "Delete systemd script"
|
|
sudo systemctl stop mastodon-web.service
|
|
ynh_secure_remove "/etc/systemd/system/mastodon-web.service"
|
|
sudo systemctl disable mastodon-web.service
|
|
fi
|
|
|
|
# Stop mastodon-sidekiq
|
|
if [ -e "/etc/systemd/system/mastodon-sidekiq.service" ]; then
|
|
echo "Delete systemd script"
|
|
sudo systemctl stop mastodon-sidekiq.service
|
|
ynh_secure_remove "/etc/systemd/system/mastodon-sidekiq.service"
|
|
sudo systemctl disable mastodon-sidekiq.service
|
|
fi
|
|
|
|
# Stop mastodon-sidekiq
|
|
if [ -e "/etc/systemd/system/mastodon-streaming.service" ]; then
|
|
echo "Delete systemd script"
|
|
sudo systemctl stop mastodon-streaming.service
|
|
ynh_secure_remove "/etc/systemd/system/mastodon-streaming.service"
|
|
sudo systemctl disable mastodon-streaming.service
|
|
fi
|
|
|
|
# Delete service on Yunohost monitoring
|
|
if sudo yunohost service status | grep -q mastodon-web
|
|
then
|
|
echo "Remove mastodon-web service"
|
|
sudo yunohost service remove mastodon-web
|
|
fi
|
|
|
|
# Delete service on Yunohost monitoring
|
|
if sudo yunohost service status | grep -q mastodon-sidekiq
|
|
then
|
|
echo "Remove mastodon-sidekiq service"
|
|
sudo yunohost service remove mastodon-sidekiq
|
|
fi
|
|
|
|
# Delete service on Yunohost monitoring
|
|
if sudo yunohost service status | grep -q mastodon-streaming
|
|
then
|
|
echo "Remove mastodon-streaming service"
|
|
sudo yunohost service remove mastodon-streaming
|
|
fi
|
|
|
|
# delete postgresql database & user
|
|
ynh_psql_drop_db "${app}_production"
|
|
ynh_psql_drop_role "${app}"
|
|
|
|
# Remove Debian package
|
|
sudo apt-get remove --purge -y yarn
|
|
#sudo apt-get remove --purge -y imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file curl git
|
|
# Delete redis package
|
|
#sudo apt-get remove --purge -y redis-server redis-tools
|
|
# Delete postgresql package
|
|
#sudo apt-get remove --purge -y postgresql postgresql-contrib
|
|
# Delete Ruby package
|
|
#sudo apt-get remove --purge -y autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev
|
|
|
|
# Delete app directory and configurations
|
|
ynh_secure_remove /opt/$app
|
|
[[ -n $domain ]] && sudo rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
|
|
|
# Delete nginx configuration
|
|
REMOVE_NGINX_CONF
|
|
|
|
# Delete cronlog
|
|
ynh_secure_remove /etc/cron.d/$app
|
|
# Delete source.list
|
|
ynh_secure_remove /etc/apt/sources.list.d/backports.list
|
|
ynh_secure_remove /etc/apt/sources.list.d/yarn.list
|
|
|
|
# Delete ruby exec
|
|
ynh_secure_remove /usr/bin/ruby
|
|
|
|
# Remove user
|
|
sudo userdel -f $app
|
|
|
|
# Reload services
|
|
sudo systemctl reload nginx
|
|
|
|
echo -e "\e[0m" # Restore normal color
|