smeserver-usbdisksmanager/root/etc/e-smith/db/confusbdisks/migrate/10options

28 lines
719 B
Plaintext
Raw Normal View History

{
my @add = split(/[,; ]+/, '');
my %remove = map { $_ => 1 } split(/[,; ]+/, 'managed,pamconsole');
# options=pamconsole,exec,noauto,managed,gid=102,uid=101
# options=pamconsole,exec,noauto,managed
for my $repo ( $DB->get_all )
{
#warn $repo->key;
my @options = split(/,/, $repo->prop('options') || '');
push @options, @add;
@options = grep(!defined $remove{$_} , @options);
# remove duplicates
undef %saw;
@options = grep(!$saw{$_}++, @options);
if ($#options >= 0)
{
$repo->set_prop('options', join(',', @options));
}
else
{
# $repo->delete('options');
}
}
}