From 7953b15584a18b199381a0d07712c1e916006715 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 8 Aug 2016 21:10:52 +0200 Subject: borg-restore.pl: WIP, finally working now. just needs polish Signed-off-by: Florian Pritz --- borg-restore.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/borg-restore.pl b/borg-restore.pl index 770c5da..fd0de1d 100755 --- a/borg-restore.pl +++ b/borg-restore.pl @@ -174,6 +174,13 @@ sub get_cache_path { return get_cache_dir()."/$item"; } +sub get_temp_path { + my $item = shift; + + # FIXME securely create temp dir here!!! + return '/tmp/borg-restore-tmp'.$item; +} + sub add_path_to_hash { my $hash = shift; my $path = shift; @@ -316,7 +323,7 @@ sub save_database { my $archives = shift; my $db_path = get_cache_path('archives.db'); - my $db_path_tmp = get_cache_path('archives.db.tmp'); + my $db_path_tmp = get_temp_path('archives.db.tmp'); my $db_path_new = get_cache_path('archives.db.new'); my $archive_cache = get_cache_path('archive_list'); my $archive_cache_tmp = get_cache_path('archive_list.tmp'); @@ -345,7 +352,7 @@ sub save_database { sub build_archive_cache { my $borg_archives = borg_list(); my $db_path = get_cache_path('archives.db'); - my $db_path_tmp = get_cache_path('archives.db.tmp'); + my $db_path_tmp = get_temp_path('archives.db.tmp'); my $archive_cache = get_cache_path('archive_list'); my $archive_cache_tmp = get_cache_path('archive_list.tmp'); my $previous_archives = []; -- cgit v1.2.3-24-g4f1b