Mailinglist Archive: opensuse-buildservice (269 mails)
| < Previous | Next > |
Re: [opensuse-buildservice] service_add macro
- From: Christian <chris@xxxxxxxxxxxxxxxx>
- Date: Tue, 09 Sep 2008 02:05:58 +0000
- Message-id: <48C5DA06.50509@xxxxxxxxxxxxxxxx>
Hi Florian,
/sbin/groupadd ......
/sbin/useradd .....
do not using it while building because packages are build as "abuild" and not as "root".
So you can only use it inside %pre
Example:
#----------------------------------------------------------------------------------
%pre
#----------------------------------------------------------------------------------
#echo "PARAM_pre: "$1
# on `rpm -ivh` PARAM is 1
# on `rpm -Uvh` PARAM is 2
if [ "$1" = "1" ]; then
echo "Adding %{vmusr} user"
if [ -z "`%__grep "^%{vmusr}:" /etc/group 2>/dev/null`" ]; then
%{_sbindir}/groupadd -r -g %{vmgid} %{vmusr}
fi
if [ -z "`%__grep "^%{vmusr}" /etc/passwd 2>/dev/null`" ]; then
%{_sbindir}/useradd -c "maildirs chef" -d %{vmdir} -g %{vmusr} -u %{vmid} -r -s /bin/false %{vmusr}
fi
fi
Cheers
Chris
Florian Richter schrieb:
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx
/sbin/groupadd ......
/sbin/useradd .....
do not using it while building because packages are build as "abuild" and not as "root".
So you can only use it inside %pre
Example:
#----------------------------------------------------------------------------------
%pre
#----------------------------------------------------------------------------------
#echo "PARAM_pre: "$1
# on `rpm -ivh` PARAM is 1
# on `rpm -Uvh` PARAM is 2
if [ "$1" = "1" ]; then
echo "Adding %{vmusr} user"
if [ -z "`%__grep "^%{vmusr}:" /etc/group 2>/dev/null`" ]; then
%{_sbindir}/groupadd -r -g %{vmgid} %{vmusr}
fi
if [ -z "`%__grep "^%{vmusr}" /etc/passwd 2>/dev/null`" ]; then
%{_sbindir}/useradd -c "maildirs chef" -d %{vmdir} -g %{vmusr} -u %{vmid} -r -s /bin/false %{vmusr}
fi
fi
Cheers
Chris
Florian Richter schrieb:
Hi,---------------------------------------------------------------------
I'd like to generate a package for different distributions using OBS.
The package requires to create a user and install a service.
Via a search engine, I found this PDFs:
http://files.opensuse.org/opensuse/en/9/9b/LinuxTag2006_Build_Service_2.pdf
http://files.opensuse.org/opensuse/en/5/57/FOSDEM_building.pdf
But when I use user_group_add, I get following error:
fg: no job control
Are these macros supported by OBS or the distributions?
Is there an example package?
Are was this just an idea and I have to write if clauses for every distribution (openSUSE, Fedora, Mandriva)
Thanks,
Florian
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx
| < Previous | Next > |