Gra*_*per 6 apt software-installation package-management
如何找出软件包运行以安装软件的命令apt-get install <package>
?
例如,如果我安装了一个创建用户的包,我如何知道它是如何创建该用户的?
你看看安装后的脚本,它实际上是由 dpkg 运行的。您可以在/var/lib/dpkg/info
. 此类脚本包含相关二进制包的名称,并具有后缀.postinst
.
请注意,还有后缀为 的预安装脚本,.preinst
但我认为包更有可能在postinst
脚本中创建新用户。
你有没有想到一个特别的例子?
一个例子是 postgresql-common,它创建postgres
用户。这是文件的摘录/var/lib/dpkg/info/postgresql-common.postinst
。
# Make sure the administrative user exists
if ! getent passwd postgres > /dev/null; then
adduser --system --quiet --home /var/lib/postgresql --no-create-home \
--shell /bin/bash --group --gecos "PostgreSQL administrator" postgres
fi
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
387 次 |
最近记录: |