我在rpm安装程序的build.spec中添加了以下“Pre”部分。当我安装rpm时,没有创建新的组或用户?
如果我将其粘贴到脚本中并运行,那么它会按预期工作。我错过了什么?
提前致谢,
-Ed
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
答案 0 :(得分:1)