summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/cache.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/cache.py b/src/utils/cache.py
index 3bd4053..9952c50 100644
--- a/src/utils/cache.py
+++ b/src/utils/cache.py
@@ -68,3 +68,15 @@ def generate_cache_txt():
return
content = ','.join(files)
write_cache_txt(content)
+
+
+def init_cache():
+ """
+ If a cache partition is present, creates the following directories
+ /opt/opengnsys/images. This is the default folder in which images
+ are stored when using tiptorrent-cache.
+ """
+ mountpoint = mount_cache()
+ if mountpoint:
+ logging.debug(f'Creating cache directory at {mountpoint}')
+ os.makedirs('/opt/opengnsys/cache/opt/opengnsys/images')