%addusertogroup macro

Elan Ruusamäe glen at delfi.ee
Mon Mar 28 20:23:46 CEST 2005


On Monday 28 March 2005 20:49, Andrzej Krzysztofowicz wrote:
> =?iso-8859-2?Q?Pawe=B3_=AFurowski?= wrote:
> > Dnia 28-03-2005, pon o godzinie 19:19 +0300, Elan Ruusamäe napisał(a):
> > > is it possible that the macro returns true or false in case the group
> > > was added or not.
> > >
> > > this way i could test do i need to restart some service or not,
> > > depending was the group membership modified of daemon's UID or not.
> > >
> > > # Usage:
> > > #   %addusertogroup myuser agroup
> >
> > macro just substitutes some text by other. if /usr/lib/rpm/user_group.sh
> > return true or false, you will be able to check this
>
> But carefully check where the macro / script is used.
> Some scripts (esp. %post, %preun) almost never should fail.
i did something like this:

m=$(%addusertogroup http blah)
if [ -n "$m" ]; then
    echo >&2 "$m"
    if [ -f /var/lock/subsys/apache ]; then
        /etc/rc.d/init.d/apache restart 1>&2
    fi
    if [ -f /var/lock/subsys/httpd ]; then
        /etc/rc.d/init.d/httpd restart 1>&2
    fi                                                                                                                         
fi 

but this doesn't look cool at all

and changing %addusertogroup to return something else than true, i don't want 
to do, it would break existing packages. altho mass commit on them is also an 
answer.


-- 
glen




More information about the pld-devel-en mailing list