From 4effddeab1db09132463573b57a92a7db34ec4ba Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 11 Mar 2021 02:59:34 +0100 Subject: [PATCH] Report app using a folder in /home that aint the recommended practice /home/yunohost.app/ or multimedia --- package_linter.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/package_linter.py b/package_linter.py index b348870..3f4e04d 100755 --- a/package_linter.py +++ b/package_linter.py @@ -581,6 +581,16 @@ class App(TestSuite): if os.system("grep -q -nr '/etc/ssowat/conf.json.persistent' %s/*/* 2>/dev/null" % self.path) == 0: yield Error("Don't do black magic with /etc/ssowat/conf.json.persistent !") + @test() + def app_data_in_unofficial_dir(self): + + allowed_locations = ["yunohost.app", "yunohost.conf", "yunohost.backup", "yunohost.multimedia"] + cmd = "grep -IhEro '/home/yunohost[^/ ]*/' %s/scripts || true" % self.path + home_locations = subprocess.check_output(cmd, shell=True).decode('utf-8').strip().split("\n") + forbidden_locations = set([location for location in home_locations if location and location not in allowed_locations]) + + if forbidden_locations: + yield Warning("The app seems to be storing data in the 'forbidden' locations %s. The recommended pratice is rather to store data in /home/yunohost.app/$app or /home/yunohost.multimedia (depending on the use case)" % ', '.join(forbidden_locations)) class Configurations(TestSuite):