添加用户以在 Buildroot 中为自定义包创建

Add users to create for a custom package in Buildroot

我正在 buildroot 中添加一个包。特别是 fcron-3.2.1。文档说将其放入包 makefile (fcron.mk) 中:

LIBFOO_USERS

Lists the users to create for this package, if it 
installs a program you want to run as a specific user (e.g. as a 
daemon, or as a cron-job). The syntax is similar in spirit to the 
makedevs one, and is described in the Chapter 24, Makeusers syntax 
documentation. This variable is optional.

所以我的 fcron.mk 文件如下所示:

#############################################################
#
# fcron
#
#############################################################

FCRON_VERSION = 3.2.1
FCRON_OVERRIDE_SRCDIR = ../fcron-3.2.1
FCRON_OVERRIDE_RSYNC = YES
FCRON_INSTALL_STAGING = YES
FCRON_INSTALL_TARGET = YES
FCRON_SITE_METHOD = local
FCRON_CONF_OPTS = --enable-shared
FCRON_SITE = www.nomad-digital.com

define FCRON_USERS
    fcron -1 fcron -1 * - - - Fcron daemon
endef

$(eval $(autotools-package))

当我尝试在 buildroot 中安装时,出现以下错误。

>>> fcron custom Installing to staging directory
Checking if group fcron exists ... no.
Would you like to add fcron in /etc/passwd with the following command ?
    groupadd fcron
If you use NYS, ldap, etc, you should add the group manually (say no here)
Please answer with 'y' or 'n' (default: 'y'): y
groupadd: Permission denied
groupadd cannot lock /etc/group; try again later.
Group "fcron" does not exists : please create it or choose another groupname with configure script.

我有一种感觉,我试图在主机上创建一个用户,而不是在我的 buildroot 映像中,但即使我用上面的 'n' 回答,它仍然没有通过,只是说请创建一个用户。我是否在 buildroot 中正确创建了所需的用户和组?

fcron 构建系统试图将用户和组添加到主机,因为它显然不考虑在临时目录中安装。您需要告诉 fcron 构建系统不要在安装期间添加用户和组。如果这从 fcron 配置选项中不是很明显,你可以看看发行版是如何解决它的,它们也会有同样的问题。可能您需要修补其 Makefile.am 并在 fcron.mk.

中设置 FCRON_AUTORECONF = YES