[improvement] the temp dir used now has a different name if you launch bauh as the root user to avoid permissioning issues

This commit is contained in:
Vinícius Moreira
2020-02-12 14:41:30 -03:00
parent 9d373adfcc
commit 584064f214
7 changed files with 14 additions and 11 deletions

View File

@@ -20,6 +20,7 @@ from bauh.api.abstract.model import PackageUpdate, PackageHistory, SoftwarePacka
SuggestionPriority
from bauh.api.abstract.view import MessageType, FormComponent, InputOption, SingleSelectComponent, SelectViewType, \
ViewComponent, PanelComponent
from bauh.api.constants import TEMP_DIR
from bauh.commons.category import CategoriesDownloader
from bauh.commons.config import save_config
from bauh.commons.html import bold
@@ -846,7 +847,7 @@ class ArchManager(SoftwareManager):
return False
def _sync_databases(self, root_password: str, handler: ProcessHandler):
sync_path = '/tmp/bauh/arch/sync'
sync_path = '{}/arch/sync'.format(TEMP_DIR)
if self.local_config['sync_databases']:
if os.path.exists(sync_path):
@@ -873,8 +874,8 @@ class ArchManager(SoftwareManager):
force=True))
if synced:
try:
Path('/tmp/bauh/arch').mkdir(parents=True, exist_ok=True)
with open('/tmp/bauh/arch/sync', 'w+') as f:
Path('/'.join(sync_path.split('/')[0:-1])).mkdir(parents=True, exist_ok=True)
with open(sync_path, 'w+') as f:
f.write(str(int(time.time())))
except:
traceback.print_exc()