#!/usr/bin/perl

use strict;
use warnings;

use PVE::INotify;
use PVE::Tools;

my $if = 'interfaces';

my $code = sub {
    PVE::INotify::write_file($if, PVE::INotify::read_file($if));
};

PVE::Tools::lock_file($if, 10, $code);
die $@ if $@;

my $current_config_file = "/etc/network/interfaces";
my $new_config_file = "/etc/network/interfaces.new";
rename($new_config_file, $current_config_file) if -e $new_config_file;
