summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2019-02-12 18:02:46 +0000
committerintrigeri <intrigeri@boum.org>2019-02-12 18:08:43 +0000
commit2777a4067724daa8e3ebe014891d6b5ce0de9679 (patch)
treee97ba19194df17e2899d6013859e98430c8aa3ac
parent2f21d0579c0440f4c8b7dfa4d2fbdee04c7b9202 (diff)
Ensure changes made to persistence.conf outside of t-p-s are written synchronously on the disk (refs: #10976).
Pretty often, we have migration code in live-persist that modifies persistence.conf. Let's ensure these changes are written to disk instead of leaving a truncated, empty file around.
-rw-r--r--lib/Tails/Persistence/Configuration/ConfigFile.pm2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Tails/Persistence/Configuration/ConfigFile.pm b/lib/Tails/Persistence/Configuration/ConfigFile.pm
index 848d52e..10917ca 100644
--- a/lib/Tails/Persistence/Configuration/ConfigFile.pm
+++ b/lib/Tails/Persistence/Configuration/ConfigFile.pm
@@ -14,6 +14,7 @@ use MooX::HandlesVia;
use autodie qw(:all);
use Carp;
use Function::Parameters;
+use IPC::System::Simple qw{systemx};
use Tails::Persistence::Configuration::Line;
use Types::Path::Tiny qw{AbsPath};
@@ -86,6 +87,7 @@ method save () {
my $output = $self->output;
$self->config_file_path->spew($output);
$self->config_file_path->chmod(0600);
+ systemx('chattr', '+S', $self->config_file_path->stringify);
}
no Moo;