CyberShadow / aconfmgr

A configuration manager for Arch Linux
1.13k stars 40 forks source link

Add `IgnorePath` defaults for new configurations/packages #37

Open bashton-ajenkins opened 5 years ago

bashton-ajenkins commented 5 years ago

Hey Cybershadow,

This is basically a request for sane defaults or documentation on a default suggested IgnorePath list.

For example it is safe to assume that any Arch user will want to ignore /var/log from the scans and I can't imagine anyone wanting to include the pacman cache either.

I have only just started to test aconfmgr but my list is already 21 lines long and I don't think I have excluded everything that needs excluding as yet (it is still scanning).

Thanks,

Alan Jenkins

CyberShadow commented 5 years ago

Thanks for filing this. It has been on my list of things for a while. Excerpt from my TODO file:

  • [ ] Move default ignore list to default configuration preset; add stuff from my own ignore list
    • [ ] Migration: if none of the default ignore paths exist in the configuration, warn and add them (to 10-aconfmgr-default-ignores.sh)
    • [ ] Add per-package presets
    • [ ] /var/log

and I can't imagine anyone wanting to include the pacman cache either

That should already be excluded by default (/var/cache/pacman is under /var/cache, which is in the current initial value of ignore_paths).

grugnog commented 5 years ago

I have been using aconfmgr on my workstation recently and really loving it - thank you for working on this @CyberShadow!

Here is my ignore list - this might be too broad for some people, but I think might be a useful starting place for people who want a more manageable list of configs starting out:

# Boot binaries
IgnorePath '/boot/*.img'
IgnorePath '/boot/*/*.EFI'
IgnorePath '/boot/*/*.efi'
IgnorePath '/boot/vmlin*'
# Certificate databases
IgnorePath '/etc/ca-certificates/extracted/*'
IgnorePath '/etc/ssl/certs/*'
IgnorePath '/etc/pacman.d/gnupg/*'
# Cache and generated files
IgnorePath '/etc/*.cache'
IgnorePath '/etc/*.gen'
# Password files
IgnorePath '/etc/*shadow*'
IgnorePath '/usr/share/*'
# Configuration database
IgnorePath '/etc/dconf'
# Mount files
IgnorePath '*/.updated'
IgnorePath '*/lost+found/*'
# Opt packages (check that they don't include config)
IgnorePath '/opt/*'
# Binary libraries
IgnorePath '/usr/lib/*'
# Local binaries
IgnorePath '/usr/local/include/*'
IgnorePath '/usr/local/lib/*'
IgnorePath '/usr/local/share/applications/mimeinfo.cache'
# Var databases, logs, swap and temp files
IgnorePath '/var/db/sudo'
IgnorePath '/var/lib/*'
IgnorePath '/var/log/*'
IgnorePath '/var/swap*'
IgnorePath '/var/tmp/*'
Dieterbe commented 2 years ago

How certain are you that everything in '/usr/share/*' is safe to ignore? I am surprised by the amount of files in there that aren't owned by any package. E.g. i have ~1000 stray files in /usr/share/mime, a couple tens in /usr/share/icons/ and /usr/share/fonts/, and a one off /usr/share/glib-2.0/schemas/gschemas.compiled

I was expecting these to be installed by postinstall/preinstall hooks, but grepping around a bit in /var/abs looks like many package include fonts and icons as normal (tracked) files in the package, and i couldn't find a reference to the gschemas.compiled. Checking for some "really popular ones" that aconfmgr took as stray, like /usr/share/mime/application/gzip.xml gave me no hits in /var/abs. So not sure where these are coming from.

CyberShadow commented 2 years ago

Checking for some "really popular ones" that aconfmgr took as stray, like /usr/share/mime/application/gzip.xml gave me no hits in /var/abs. So not sure where these are coming from.

Well, there is a comment at the top that says Created automatically by update-mime-database, so that's probably who created it. (Also, it's nice that that comment is there - all auto-generated files ideally ought to have one like that.)

Dieterbe commented 2 years ago

Well, there is a comment at the top that says Created automatically by update-mime-database, so that's probably who created it. (Also, it's nice that that comment is there - all auto-generated files ideally ought to have one like that.)

Ah, good point. I wrote a quick script to confirm that indeed the majority of the files are autogenerated. A bunch are not, but are owned by a package. and a couple of them don't have the header and are not package owned. But inspecting them reveals they're either binary files or probably autogenerated in which case i would consider it a bug that they don't have the header. It seems to me that not tracking files which are package owned but possibly modified, or not marked as autogenerated, may result in an improperly function system when doing an aconfmgr apply, so i'm still skeptical of ignoring all of them. Perhaps we could ignore them if they have the "autogenerated" header...

~ ❯❯❯ cat inspect-usr-share-mime.sh                                                                                                                                                                             ✘ 1 
#!/bin/bash
for file in $(find /usr/share/mime -type f); do
  if egrep -q 'Created automatically by update-mime-database|update-mime-database command' $file; then
    continue
  fi
  if pacman -Qo $file &>/dev/null; then
    continue
  fi
  echo "$file"
done
~ ❯❯❯ ./inspect-usr-share-mime.sh
/usr/share/mime/magic
/usr/share/mime/XMLnamespaces
/usr/share/mime/treemagic
/usr/share/mime/version
/usr/share/mime/icons
/usr/share/mime/mime.cache
/usr/share/mime/types
/usr/share/mime/generic-icons
/usr/share/mime/subclasses
/usr/share/mime/aliases
bfcns commented 10 months ago

Are there any improvements on this request yet?

PoutineSyropErable commented 1 month ago

2024, Any Idea of what I should ignore? Mine is 16 Gb and growing. Will probably be 24Gig by the end.