- update config for Nut 2.8.2 [SME: 12657] TODO review master/slave mode TODO convert master/slave to primary/secondary TODO convert to new config data + migrate TODO event and action
		
			
				
	
	
		
			23 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
{
 | 
						|
  # migrate to SME11
 | 
						|
  # first we get ride of Master=no
 | 
						|
  # if Mode  not set then set it according to Master
 | 
						|
  my $mnut = $DB->get('nut') || $DB->new_record('nut', {type => 'service'});
 | 
						|
  my $nutMaster = $DB->get_prop_and_delete ('nut','Master');
 | 
						|
  unless ( ${'nut'}{'Mode'} ) {
 | 
						|
    $mnut>set_prop('Mode','netserver') if $nutMaster eq "yes";
 | 
						|
  }
 | 
						|
 | 
						|
  # if nut-driver@ups not existing create it
 | 
						|
  my $driverUPS = $DB->get('nut-driver@ups') || $DB->new_record('nut-driver@ups', {type => 'service'});
 | 
						|
  # then migrate to nut-driver@ups (first UPS) the following properties
 | 
						|
  my $mdl = $DB->get_prop_and_delete ('nut','mdl');
 | 
						|
  $driverUPS->set_prop('mdl',$mdl) unless ${'nut-driver@ups'}{'mdl'};
 | 
						|
  my $mfr = $DB->get_prop_and_delete ('nut','mfr');
 | 
						|
  $driverUPS->set_prop('mfr',$mfr) unless ${'nut-driver@ups'}{'mfr'};
 | 
						|
  my $model = $DB->get_prop_and_delete ('nut','Model');
 | 
						|
  $driverUPS->set_prop('Model',$model) unless ${'nut-driver@ups'}{'Model'};
 | 
						|
  my $Type = $DB->get_prop_and_delete ('nut','Type');
 | 
						|
  $driverUPS->set_prop('Type',$model) unless ${'nut-driver@ups'}{'Type'};
 | 
						|
}
 |