package files

import "slices"

func ownedByFilesystem(path string) bool {
	p := ToNixPath(path)
	return slices.Contains(append(fsPaths, logrotatePaths...), p)
}

// yum install yum-utils

// repoquery --installed -l filesystem | while read -r f; do test -d "\"$f\"," && echo $f; done
var fsPaths = []string{
	"/afs",
	"/bin",
	"/boot",
	"/dev",
	"/etc",
	"/etc/X11",
	"/etc/X11/applnk",
	"/etc/X11/fontpath.d",
	"/etc/X11/xinit",
	"/etc/X11/xinit/xinitrc.d",
	"/etc/X11/xinit/xinput.d",
	"/etc/bash_completion.d",
	"/etc/keys",
	"/etc/keys/ima",
	"/etc/opt",
	"/etc/pki",
	"/etc/pm",
	"/etc/pm/config.d",
	"/etc/pm/power.d",
	"/etc/pm/sleep.d",
	"/etc/rwtab.d",
	"/etc/skel",
	"/etc/statetab.d",
	"/etc/sysconfig",
	"/etc/xdg",
	"/etc/xdg/autostart",
	"/home",
	"/lib",
	"/lib64",
	"/media",
	"/mnt",
	"/opt",
	"/proc",
	"/root",
	"/run",
	"/sbin",
	"/srv",
	"/sys",
	"/tmp",
	"/usr",
	"/usr/bin",
	"/usr/games",
	"/usr/include",
	"/usr/lib",
	"/usr/lib/debug",
	"/usr/lib/debug/.dwz",
	"/usr/lib/debug/bin",
	"/usr/lib/debug/lib",
	"/usr/lib/debug/lib64",
	"/usr/lib/debug/sbin",
	"/usr/lib/debug/usr",
	"/usr/lib/debug/usr/.dwz",
	"/usr/lib/debug/usr/bin",
	"/usr/lib/debug/usr/lib",
	"/usr/lib/debug/usr/lib64",
	"/usr/lib/debug/usr/sbin",
	"/usr/lib/games",
	"/usr/lib/locale",
	"/usr/lib/modules",
	"/usr/lib/sysimage",
	"/usr/lib/systemd",
	"/usr/lib/systemd/system",
	"/usr/lib/systemd/user",
	"/usr/lib/sysusers.d",
	"/usr/lib/tmpfiles.d",
	"/usr/lib64",
	"/usr/lib64/X11",
	"/usr/lib64/bpf",
	"/usr/lib64/games",
	"/usr/lib64/pm-utils",
	"/usr/lib64/pm-utils/module.d",
	"/usr/lib64/pm-utils/power.d",
	"/usr/lib64/pm-utils/sleep.d",
	"/usr/libexec",
	"/usr/local",
	"/usr/local/bin",
	"/usr/local/etc",
	"/usr/local/games",
	"/usr/local/include",
	"/usr/local/lib",
	"/usr/local/lib64",
	"/usr/local/lib64/bpf",
	"/usr/local/libexec",
	"/usr/local/sbin",
	"/usr/local/share",
	"/usr/local/share/applications",
	"/usr/local/share/info",
	"/usr/local/share/man",
	"/usr/local/share/man/man1",
	"/usr/local/share/man/man1x",
	"/usr/local/share/man/man2",
	"/usr/local/share/man/man2x",
	"/usr/local/share/man/man3",
	"/usr/local/share/man/man3x",
	"/usr/local/share/man/man4",
	"/usr/local/share/man/man4x",
	"/usr/local/share/man/man5",
	"/usr/local/share/man/man5x",
	"/usr/local/share/man/man6",
	"/usr/local/share/man/man6x",
	"/usr/local/share/man/man7",
	"/usr/local/share/man/man7x",
	"/usr/local/share/man/man8",
	"/usr/local/share/man/man8x",
	"/usr/local/share/man/man9",
	"/usr/local/share/man/man9x",
	"/usr/local/share/man/mann",
	"/usr/local/src",
	"/usr/sbin",
	"/usr/share",
	"/usr/share/X11",
	"/usr/share/X11/fonts",
	"/usr/share/aclocal",
	"/usr/share/appdata",
	"/usr/share/applications",
	"/usr/share/augeas",
	"/usr/share/augeas/lenses",
	"/usr/share/backgrounds",
	"/usr/share/bash-completion",
	"/usr/share/bash-completion/completions",
	"/usr/share/bash-completion/helpers",
	"/usr/share/desktop-directories",
	"/usr/share/dict",
	"/usr/share/doc",
	"/usr/share/empty",
	"/usr/share/fish",
	"/usr/share/fish/vendor_completions.d",
	"/usr/share/games",
	"/usr/share/gnome",
	"/usr/share/help",
	"/usr/share/icons",
	"/usr/share/idl",
	"/usr/share/info",
	"/usr/share/licenses",
	"/usr/share/locale",
	"/usr/share/locale/en_US",
	"/usr/share/locale/en_US/LC_MESSAGES",
	"/usr/share/man",
	"/usr/share/man/man0p",
	"/usr/share/man/man1",
	"/usr/share/man/man1p",
	"/usr/share/man/man1x",
	"/usr/share/man/man2",
	"/usr/share/man/man2x",
	"/usr/share/man/man3",
	"/usr/share/man/man3p",
	"/usr/share/man/man3x",
	"/usr/share/man/man4",
	"/usr/share/man/man4x",
	"/usr/share/man/man5",
	"/usr/share/man/man5x",
	"/usr/share/man/man6",
	"/usr/share/man/man6x",
	"/usr/share/man/man7",
	"/usr/share/man/man7x",
	"/usr/share/man/man8",
	"/usr/share/man/man8x",
	"/usr/share/man/man9",
	"/usr/share/man/man9x",
	"/usr/share/man/mann",
	"/usr/share/metainfo",
	"/usr/share/mime-info",
	"/usr/share/misc",
	"/usr/share/omf",
	"/usr/share/pixmaps",
	"/usr/share/sounds",
	"/usr/share/themes",
	"/usr/share/wayland-sessions",
	"/usr/share/xsessions",
	"/usr/share/zsh",
	"/usr/share/zsh/site-functions",
	"/usr/src",
	"/usr/src/debug",
	"/usr/src/kernels",
	"/usr/tmp",
	"/var",
	"/var/adm",
	"/var/cache",
	"/var/db",
	"/var/empty",
	"/var/ftp",
	"/var/games",
	"/var/lib",
	"/var/lib/games",
	"/var/lib/misc",
	"/var/lib/rpm-state",
	"/var/local",
	"/var/log",
	"/var/mail",
	"/var/nis",
	"/var/opt",
	"/var/preserve",
	"/var/run",
	"/var/spool",
	"/var/spool/lpd",
	"/var/spool/mail",
	"/var/tmp",
	"/var/yp",
}

// repoquery --installed -l logrotate | while read -r f; do test -d "\"$f\"," && echo $f; done
var logrotatePaths = []string{
	"/etc/logrotate.d",
	"/usr/lib/.build-id",
	"/usr/lib/.build-id/ae",
	"/usr/share/licenses/logrotate",
	"/var/lib/logrotate",
}
