153 my $msg = |
154 my $msg = |
154 sprintf "need: 0%04o root:%s, got: 0%04o %s:%s\n", |
155 sprintf "need: 0%04o root:%s, got: 0%04o %s:%s\n", |
155 $mode, $group, $f_mode, $f_owner, $f_group; |
156 $mode, $group, $f_mode, $f_owner, $f_group; |
156 |
157 |
157 if (-f '/etc/debian_version') { |
158 if (-f '/etc/debian_version') { |
158 $msg .= sprintf "try dpkg-statoverride --update --add root %s 0%04o %s\n", |
159 $msg .= sprintf "try dpkg-statoverride --update --add root %sgroup 0%04o %s\n", |
159 $group, $mode, $file; |
160 $group, $mode, $file; |
160 } |
161 } |
161 |
162 |
162 die $msg unless $f_owner eq $owner; |
163 die $msg unless $f_owner eq $owner; |
163 die $msg unless $f_group eq $group; |
164 die $msg unless $f_group eq $group; |
237 } |
238 } |
238 |
239 |
239 sub compare_lists { |
240 sub compare_lists { |
240 my %arg = @_; |
241 my %arg = @_; |
241 my @confs = @{ $arg{confs} } or croak 'missing list of confs'; |
242 my @confs = @{ $arg{confs} } or croak 'missing list of confs'; |
242 my @exclude = @{ $arg{exclude} }; |
243 |
|
244 # magic: if there is no config with the exclude, generate a list of config:exclude |
|
245 my @exclude = map { /^[^\/]+?:/ ? $_ : do { my $x = $_; map { "$_:$x" } @confs } } |
|
246 @{ $arg{exclude} }; |
|
247 ### exclude:@exclude |
243 |
248 |
244 WARNING |
249 WARNING |
245 "excluded filesystem(s) @$_ does not exist, update the config please!\n" |
250 "excluded filesystem(s) @$_ does not exist, update the config please!\n" |
246 if @exclude |
251 if @exclude |
247 and @$_ = grep { not -e } unique map { /^.*?:(.*)/ } @exclude; |
252 and @$_ = grep { not -e } unique map { /^.*?:(.*)/ } @exclude; |
248 |
253 |
249 my @candidates = get_devices; |
254 my @candidates = get_devices; |
250 my %missing; |
255 my %missing; |
251 |
256 |
|
257 ### Candidates: @candidates |
252 foreach my $conf (@confs) { |
258 foreach my $conf (@confs) { |
253 my @dles = _amlist $conf; |
259 my @dles = _amlist $conf; |
|
260 ### DLEs: @dles |
|
261 |
254 foreach my $candidate (@candidates) { |
262 foreach my $candidate (@candidates) { |
255 next if not $candidate =~ m{^/|\Q$conf\E:}; |
263 ### $candidate |
|
264 #next if not $candidate =~ m{^/|\Q$conf\E:}; |
256 |
265 |
257 # we're satisfied if either the name of the device is in |
266 # we're satisfied if either the name of the device is in |
258 # the disklist, or the device id is found |
267 # the disklist, or the device id is found |
259 $candidate->[0] ~~ [map { $_->[0] } @dles] and next; |
268 $candidate->[0] ~~ [map { $_->[0] } @dles] and next; |
260 $candidate->[1] ~~ [map { $_->[1] } @dles] and next; |
269 $candidate->[1] ~~ [map { $_->[1] } @dles] and next; |