linux - 如何在没有镜头的情况下使用 augtool?

标签 linux bash puppet augeas

augtool Augeas接缝是 Puppet 修改配置文件的流行程序,但是如何修改 augtool 没有镜头的配置文件?例如:

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Compiz
Exec=compiz
NoDisplay=false
# name of loadable control center module
X-GNOME-WMSettingsModule=metacity

在这个特定的示例中,我想将 NoDisplay 更改为 true

问题

是否可以在没有镜头的情况下修改配置文件? augtool 可以尝试猜测配置文件的树结构吗?

最佳答案

Augeas 无法猜测使用哪个镜头。例如,对于桌面文件(您的示例),可以使用许多镜头(MySQL.lnsPHP.lns 等),但它们中的每一个会引入与桌面格式不兼容的限制。

在你的例子中,你想使用 Desktop.lns 镜头:

$ augtool --autosave --noautoload --transform "Desktop.lns incl /path/to/your/example.desktop" set "/files/path/to/your/example.desktop/Desktop Entry/NoDisplay" true

关于linux - 如何在没有镜头的情况下使用 augtool?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23176261/

相关文章:

linux - 如何在后台运行 wget 以进行无人值守的文件下载?

c++ - 如何使用 Linux glibc 获取 LWP?

linux - 工头数据库导入失败

Python、gevent、urllib2.urlopen.read()、下载加速器

bash - 并行运行 bash 命令,跟踪结果并计数

linux - 从 File2 中提取行已经找到 File1

Linux sed 命令 - 使用带反斜杠的变量

ruby - ERB:迭代数组并将每个值作为单行字符串的一部分输出

puppet - 如何修复 'Could not parse for environment production'错误?

linux - 观察一个文件的变化