如何命名 /etc/apt/sources.list.d/ 中的文件以将其忽略而不发出警告?

如何命名 /etc/apt/sources.list.d/ 中的文件以将其忽略而不发出警告?
N: Ignoring file 'cloudera.list_' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
N: Ignoring file 'opera.list_' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
...
N: Ignoring file 'tor.list_' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension

如何正确地“注释掉”那里的文件?

答案1

cat >> /etc/apt/apt.conf.d/98ignore_extensions << \EOF
# Follow the pattern to add more extensions to ignore.
Dir::Ignore-Files-Silently:: "\.gz$";
Dir::Ignore-Files-Silently:: "\.save$";
Dir::Ignore-Files-Silently:: "\.distUpgrade$";
Dir::Ignore-Files-Silently:: "\.list_$";
EOF

答案2

我只是将文件移动到../sources.list.disabled/

答案3

[Ubuntu 18.04]

当没有任何明确设置的东西时, 我无法理解为什么后缀.distUpgrade会被忽略。.save

然后我发现apt-config dump | grep -i ignore有这些和其他的条目:

Dir::Ignore-Files-Silently "";
Dir::Ignore-Files-Silently:: "~$";
Dir::Ignore-Files-Silently:: "\.disabled$";
Dir::Ignore-Files-Silently:: "\.bak$";
Dir::Ignore-Files-Silently:: "\.dpkg-[a-z]+$";
Dir::Ignore-Files-Silently:: "\.ucf-[a-z]+$";
Dir::Ignore-Files-Silently:: "\.save$";
Dir::Ignore-Files-Silently:: "\.orig$";
Dir::Ignore-Files-Silently:: "\.distUpgrade$";

我刚刚将我的可疑文件重命名为这些扩展名之一。(我选择了.orig

答案4

类似于 larsks回答/etc/apache2:我使用与 Apache ( ) 或 Fontconfig ( )相同类型的目录层次结构/etc/fonts

我们的想法是有两个目录:

  • something.avail适用于您的所有文件。
  • something.d其中包含您实际使用的文件的符号链接。

代码比语言更有说服力,所以就来吧。

cd /etc/apt
mv sources.list.d sources.list.avail
mkdir sources.list.d
cd sources.list.d
# Now you can symlink the files you want to use
ln -s ../sources.list.avail/liquorix.list
ln -s ../sources.list.avail/goodvibes.list
...

相关内容