smeserver-bridge-interface/root/etc/e-smith/db/configuration/migrate/50bridge-interface

22 lines
739 B
Plaintext
Raw Normal View History

{
my $bridge = $DB->get('bridge') || $DB->new_record('bridge', {type => 'service'});
my $brStatus = $bridge->prop('status') || 'enabled';
# Return nothing if bridge is disabled
return "" if ($brStatus eq 'disabled');
my $br = $bridge->prop('bridgeInterface') || 'br0';
my $IntIfConf = $DB->get('InternalInterface');
my $IntIfName = $IntIfConf->prop('Name');
# If the InternalInterface Name is the same as the bridge, there's nothing to do
return "" if ($IntIfName eq $br);
# else, we store the old InternalInterface Name in ethernetInterface
# and we set the InternalInterface to be the bridge
$bridge->set_prop('ethernetInterface',$IntIfName);
$IntIfConf->set_prop('Name',$br);
}