mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 16:35:02 +01:00
Move the cache to /var/cache
Let's not store a bunch of automatically generated binary files in /etc.
AppArmor 3.0 will store the cache in /var/cache and most distros
(openSUSE, Debian, and soon Ubuntu) moved it there already.
Bug-Debian: https://bugs.debian.org/904637
(cherry picked from commit 3d21cf0e32
)
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
6f5c61e6af
commit
affc7a9fb4
3 changed files with 8 additions and 7 deletions
|
@ -247,7 +247,7 @@ If a cache directory name needs to have a comma as part of the name, it
|
||||||
can be specified by using a backslash to escape the comma character in
|
can be specified by using a backslash to escape the comma character in
|
||||||
the directory name.
|
the directory name.
|
||||||
|
|
||||||
If not specified the cache location defaults to /etc/apparmor.d/cache.d
|
If not specified the cache location defaults to /var/cache/apparmor
|
||||||
|
|
||||||
=item --print-cache-dir
|
=item --print-cache-dir
|
||||||
|
|
||||||
|
|
|
@ -1272,12 +1272,7 @@ int main(int argc, char *argv[])
|
||||||
uint16_t max_caches = write_cache && cond_clear_cache ? (uint16_t) (-1) : 0;
|
uint16_t max_caches = write_cache && cond_clear_cache ? (uint16_t) (-1) : 0;
|
||||||
|
|
||||||
if (!cacheloc[0]) {
|
if (!cacheloc[0]) {
|
||||||
char *tmp;
|
char *tmp = "/var/cache/apparmor";
|
||||||
|
|
||||||
if (asprintf(&tmp, "%s/cache.d", basedir) == -1) {
|
|
||||||
PERROR(_("Memory allocation error."));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
cacheloc[0] = tmp;
|
cacheloc[0] = tmp;
|
||||||
cacheloc_n = 1;
|
cacheloc_n = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,12 @@ class AAParserCachingCommon(testlib.AATestTemplate):
|
||||||
if not self.is_apparmorfs_mounted():
|
if not self.is_apparmorfs_mounted():
|
||||||
self.cmd_prefix += ['-M', './features_files/features.all']
|
self.cmd_prefix += ['-M', './features_files/features.all']
|
||||||
|
|
||||||
|
# Otherwise get_cache_dir() will try to create /var/cache/apparmor
|
||||||
|
# and will fail when the test suite is run as non-root.
|
||||||
|
self.cmd_prefix += [
|
||||||
|
'--cache-loc', os.path.join(self.tmp_dir, 'cache')
|
||||||
|
]
|
||||||
|
|
||||||
# create directory for cached blobs
|
# create directory for cached blobs
|
||||||
# NOTE: get_cache_dir() requires cmd_prefix to be fully initialized
|
# NOTE: get_cache_dir() requires cmd_prefix to be fully initialized
|
||||||
self.cache_dir = self.get_cache_dir(create=True)
|
self.cache_dir = self.get_cache_dir(create=True)
|
||||||
|
|
Loading…
Add table
Reference in a new issue