diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-03-23 13:47:07 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-03-23 16:32:52 -0700 |
commit | 66995798688c30b52e2fd2f89c039ecb9c29f77e (patch) | |
tree | 245290172a12728b4135f4ea2af9aaf9c72085c7 /bin/locmaint | |
parent | 3f693e033d127930eade0fa1ac64fa753f283999 (diff) | |
download | dotfiles-66995798688c30b52e2fd2f89c039ecb9c29f77e.tar.gz |
locmaint: improve handling of obsolete conffiles
Diffstat (limited to 'bin/locmaint')
-rwxr-xr-x | bin/locmaint | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/bin/locmaint b/bin/locmaint index c182ace0..98a1e2f4 100755 --- a/bin/locmaint +++ b/bin/locmaint @@ -114,6 +114,25 @@ for (getpwuid($<) . '@' . `hostname -f`) { } } +# List of files which dpkg considers obsolete, but where deleting the +# conffile and reinstalling its package does not resolve the problem +# or is not what should be done. One case in which doing that is not +# the correct fix is when conffiles move between packages. +# +# It's a bug in the package if +# - there are obsolete conffiles which the local administrator has +# never modified +# - regardless of whether the file has been modified by the local +# administrator, deleting the conffile and reinstalling its package +# does not get clear the entry from the list of obsolete conffiles. +# +# When adding an entry to this list, see if a bug needs to be +# reported, and record the Debian release in which the bug was seen, +# so entries can be removed at some point +our %known_bad_obsolete_conffiles = ( + "/etc/this_is_a_sample_entry" => undef, # buster +); + # CODE -- no more edit me exit main(); @@ -561,20 +580,24 @@ sub do_sysmaint { } else { my @fields = split ' '; push @{$obsolete_conffiles{$curr_pkg}}, $fields[0] - if $fields[$#fields] eq "obsolete"; + if $fields[$#fields] eq "obsolete" + and not exists $known_bad_obsolete_conffiles{$fields[0]}; } } unless (keys %obsolete_conffiles == 0) { my @all_obsolete_conffiles; - say_bold("Obsolete conffiles:"); + say_bold "Obsolete conffiles:\n"; foreach my $pkg (keys %obsolete_conffiles) { foreach my $file (@{$obsolete_conffiles{$pkg}}) { print " $pkg\t$file\n"; push @all_obsolete_conffiles, $file; } } - if (prompt_yn - ("Fix by deleting each conffile and reinstalling its package (is not the right fix if conffile has moved between packages)?")) { + print "\nPlease report bugs if these files unedited by the local administrator,\n" + . "and then, can attempt to fix by deleting each conffile and reinstalling\n" + . "its package -- but note that this is not the right fix if the conffile has\n" + . "moved between packages.\n\n"; + if (prompt_yn "Attempt the fix?") { system as_root("rm @all_obsolete_conffiles"); system as_root("apt-get install -y --reinstall " . join(' ', keys %obsolete_conffiles)); |