mirror of
https://github.com/YunoHost/test_apps.git
synced 2024-09-03 20:06:29 +02:00
Add stuff to break remove failure and other app breaking the system
This commit is contained in:
parent
a694881d1a
commit
933c07f6d6
5 changed files with 95 additions and 1 deletions
42
break_yo_system_ynh/manifest.json
Normal file
42
break_yo_system_ynh/manifest.json
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
{
|
||||||
|
"name": "Break your system!",
|
||||||
|
"id": "break_yo_system",
|
||||||
|
"description": {
|
||||||
|
"en": "That's a nice server you have here ... would be a shame if somebody was to ... break it !"
|
||||||
|
},
|
||||||
|
"license": "WTFPL",
|
||||||
|
"maintainer": {
|
||||||
|
"name": "Aleks",
|
||||||
|
"email": "alex.aubin@mailoo.org",
|
||||||
|
"url": "https://github.com/alexAubin/"
|
||||||
|
},
|
||||||
|
"requirements": {
|
||||||
|
"yunohost": ">> 3.6.0"
|
||||||
|
},
|
||||||
|
"multi_instance": false,
|
||||||
|
"arguments": {
|
||||||
|
"install" : [
|
||||||
|
{
|
||||||
|
"name": "domain",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a domain"
|
||||||
|
},
|
||||||
|
"example": "domain.org"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "breakwhat",
|
||||||
|
"ask": {
|
||||||
|
"en": "What script to break"
|
||||||
|
},
|
||||||
|
"choices": {
|
||||||
|
"none" : "None",
|
||||||
|
"install" : "Install script",
|
||||||
|
"remove" : "Remove script",
|
||||||
|
"upgrade" : "Upgrade script",
|
||||||
|
"everything" : "Every script"
|
||||||
|
},
|
||||||
|
"default": "none"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
20
break_yo_system_ynh/scripts/install
Normal file
20
break_yo_system_ynh/scripts/install
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
|
breakwhat=$YNH_APP_ARG_BREAKWHAT
|
||||||
|
|
||||||
|
ynh_app_setting_set $app domain $domain
|
||||||
|
ynh_app_setting_set $app breakwhat $breakwhat
|
||||||
|
|
||||||
|
if [[ $breakwhat == "install" ]] || [[ $breakwhat == "everything" ]]
|
||||||
|
then
|
||||||
|
echo "; WTF ; ?!() {{{{" > /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
service nginx restart || true # What could go wrong lol
|
||||||
|
else
|
||||||
|
touch /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
service nginx reload
|
||||||
|
fi
|
16
break_yo_system_ynh/scripts/remove
Normal file
16
break_yo_system_ynh/scripts/remove
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
|
breakwhat=$(sudo yunohost app setting $app breakwhat)
|
||||||
|
|
||||||
|
rm /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
service nginx reload
|
||||||
|
|
||||||
|
if [[ $breakwhat == "remove" ]] || [[ $breakwhat == "everything" ]]
|
||||||
|
then
|
||||||
|
service nginx stop
|
||||||
|
fi
|
16
break_yo_system_ynh/scripts/upgrade
Normal file
16
break_yo_system_ynh/scripts/upgrade
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
set -eux
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
|
breakwhat=$(sudo yunohost app setting $app breakwhat)
|
||||||
|
|
||||||
|
if [[ $breakwhat == "upgrade" ]] || [[ $breakwhat == "everything" ]]
|
||||||
|
then
|
||||||
|
echo "; WTF ; ?!() {{{{" > /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
service nginx restart || true # What could go wrong lol
|
||||||
|
else
|
||||||
|
rm /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
service nginx reload
|
||||||
|
fi
|
|
@ -8,7 +8,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(sudo yunohost app setting $app domain)
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
|
|
||||||
sudo rm -rf /var/www/$app
|
sudo rm -rf /var/www/$app
|
||||||
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
sudo rm /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
sudo rm -f /etc/importantfile
|
sudo rm -f /etc/importantfile
|
||||||
|
|
||||||
db_user=$app
|
db_user=$app
|
||||||
|
|
Loading…
Add table
Reference in a new issue