mirror of
https://github.com/YunoHost-Apps/mopidy_ynh.git
synced 2024-09-03 19:46:21 +02:00
create and check final path
This commit is contained in:
parent
e3b9f568a2
commit
1ee7e90136
3 changed files with 65 additions and 0 deletions
|
@ -59,3 +59,60 @@ CHECK_FINALPATH () { # Vérifie que le dossier de destination n'est pas déjà u
|
||||||
false
|
false
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### REMOVE SCRIPT
|
||||||
|
|
||||||
|
REMOVE_NGINX_CONF () { # Suppression de la configuration nginx
|
||||||
|
if [ -e "/etc/nginx/conf.d/$domain.d/$app.conf" ]; then # Delete nginx config
|
||||||
|
echo "Delete nginx config"
|
||||||
|
sudo rm "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
sudo service nginx reload
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
REMOVE_FPM_CONF () { # Suppression de la configuration du pool php-fpm
|
||||||
|
if [ -e "/etc/php5/fpm/pool.d/$app.conf" ]; then # Delete fpm config
|
||||||
|
echo "Delete fpm config"
|
||||||
|
sudo rm "/etc/php5/fpm/pool.d/$app.conf"
|
||||||
|
fi
|
||||||
|
if [ -e "/etc/php5/fpm/conf.d/20-$app.ini" ]; then # Delete php config
|
||||||
|
echo "Delete php config"
|
||||||
|
sudo rm "/etc/php5/fpm/conf.d/20-$app.ini"
|
||||||
|
fi
|
||||||
|
sudo service php5-fpm reload
|
||||||
|
}
|
||||||
|
|
||||||
|
REMOVE_LOGROTATE_CONF () { # Suppression de la configuration de logrotate
|
||||||
|
if [ -e "/etc/logrotate.d/$app" ]; then
|
||||||
|
echo "Delete logrotate config"
|
||||||
|
sudo rm "/etc/logrotate.d/$app"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
SECURE_REMOVE () { # Suppression de dossier avec vérification des variables
|
||||||
|
chaine="$1" # L'argument doit être donné entre quotes simple '', pour éviter d'interpréter les variables.
|
||||||
|
no_var=0
|
||||||
|
while (echo "$chaine" | grep -q '\$') # Boucle tant qu'il y a des $ dans la chaine
|
||||||
|
do
|
||||||
|
no_var=1
|
||||||
|
global_var=$(echo "$chaine" | cut -d '$' -f 2) # Isole la première variable trouvée.
|
||||||
|
only_var=\$$(expr "$global_var" : '\([A-Za-z0-9_]*\)') # Isole complètement la variable en ajoutant le $ au début et en gardant uniquement le nom de la variable. Se débarrasse surtout du / et d'un éventuel chemin derrière.
|
||||||
|
real_var=$(eval "echo ${only_var}") # `eval "echo ${var}` permet d'interpréter une variable contenue dans une variable.
|
||||||
|
if test -z "$real_var" || [ "$real_var" = "/" ]; then
|
||||||
|
echo "Variable $only_var is empty, suppression of $chaine cancelled." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
chaine=$(echo "$chaine" | sed "s@$only_var@$real_var@") # remplace la variable par sa valeur dans la chaine.
|
||||||
|
done
|
||||||
|
if [ "$no_var" -eq 1 ]
|
||||||
|
then
|
||||||
|
if [ -e "$chaine" ]; then
|
||||||
|
echo "Delete directory $chaine"
|
||||||
|
sudo rm -r "$chaine"
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo "No detected variable." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
|
@ -38,6 +38,10 @@ ynh_app_setting_set $app spotify_id $spotify_id
|
||||||
ynh_app_setting_set $app spotify_id_secret $spotify_id_secret
|
ynh_app_setting_set $app spotify_id_secret $spotify_id_secret
|
||||||
ynh_app_setting_set $app soundcloud_id $soundcloud_id
|
ynh_app_setting_set $app soundcloud_id $soundcloud_id
|
||||||
|
|
||||||
|
# Create final_path and check
|
||||||
|
sudo mkdir "$final_path"
|
||||||
|
ynh_app_setting_set $app final_path $final_path
|
||||||
|
|
||||||
# Add the archive’s GPG key:
|
# Add the archive’s GPG key:
|
||||||
wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add -
|
wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add -
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,10 @@ sudo rm -fr /usr/local/lib/python2.7/dist-packages/Mopidy_MusicBox_Webclient-2.3
|
||||||
sudo yunohost firewall disallow TCP 6600
|
sudo yunohost firewall disallow TCP 6600
|
||||||
sudo yunohost firewall disallow TCP 6680
|
sudo yunohost firewall disallow TCP 6680
|
||||||
|
|
||||||
|
SECURE_REMOVE '/var/www/$app' # Suppression du dossier de l'application
|
||||||
|
|
||||||
|
REMOVE_NGINX_CONF # Suppression de la configuration nginx
|
||||||
|
|
||||||
# Régénère la configuration de SSOwat
|
# Régénère la configuration de SSOwat
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue