我在我的 rpm 安装程序的 build.spec 中添加了以下“Pre”部分。当我安装 rpm 时没有创建新的组或用户?
如果我将其粘贴到脚本中并运行,那么它会按预期工作。我错过了什么?
提前致谢,
-埃德
RHEL 5.2
#######################
# pre
#######################
%pre
# This works when run as a script by root. Why not from the RPM?
if grep ^frontier: /etc/group >> /dev/null ; then
: # group already exists
else
%{_sbindir}/groupadd frontier -g 2000
fi
if ! id diagnostics >& /dev/null; then
%{_sbindir}/adduser diagnostics -g diaguser -d /home/diagnostics -u 2001 -p secretPassword
usermod -a -G frontier diagnostics
fi