Only check for ssowatconf at the end of the file, which is typically where it's useless

This commit is contained in:
Alexandre Aubin 2020-03-31 04:30:57 +02:00
parent 73741c225f
commit 1775202a26

View file

@ -596,8 +596,14 @@ class Script():
print_warning("'yunohost app initdb' is deprecated. Please use 'ynh_mysql_setup_db' instead.") print_warning("'yunohost app initdb' is deprecated. Please use 'ynh_mysql_setup_db' instead.")
if self.contains("exit"): if self.contains("exit"):
print_warning("'exit' command shouldn't be used. Please use 'ynh_die' instead.") print_warning("'exit' command shouldn't be used. Please use 'ynh_die' instead.")
# Dirty hack to check only the 10 last lines for ssowatconf
# (the "bad" practice being using this at the very end of the script, but some apps legitimately need this in the middle of the script)
oldlines = list(self.lines)
self.lines = self.lines[-10:]
if self.contains("yunohost app ssowatconf"): if self.contains("yunohost app ssowatconf"):
print_warning("You probably don't need to run 'yunohost app ssowatconf' in the app script. It's supposed to be ran automatically after the script.") print_warning("You probably don't need to run 'yunohost app ssowatconf' in the app script. It's supposed to be ran automatically after the script.")
self.lines = oldlines
if self.contains("rm -rf"): if self.contains("rm -rf"):
print_error("[YEP-2.12] You should avoid using 'rm -rf', please use 'ynh_secure_remove' instead") print_error("[YEP-2.12] You should avoid using 'rm -rf', please use 'ynh_secure_remove' instead")