[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rpms that require a service restart



On Thu, May 16, 2013 at 9:56 PM,  <dsavage@peaknet.net> wrote:
> To be absolutely sure you might have to examine the .spec files and any
> referenced post-install scripts in all .src.rpm packages. Unless you
> suffer from OCD, doing this for all 1,000+ packages in a minimum
> installation will be a massive PITA.

I imagine you wouldn't have to check all installed packages, just the
ones that will be updated.  But I could be mistaken.

For example, on this one system, openssh-server needs to be updated.
I used the yum-download package to only download (not install) the rpm
to have a look at it.  I don't see anything in the scripts section
that would indicate that installing the package would start or restart
the service:

# rpm -qp --scripts
/var/cache/yum/base/packages/openssh-server-4.3p2-82.el5.x86_64.rpm |
cat -n
     1    preinstall scriptlet (using /bin/sh):
     2    /usr/sbin/useradd -c "Privilege-separated SSH" -u 74 \
     3        -s /sbin/nologin -r -d /var/empty/sshd sshd 2> /dev/null || :
     4    postinstall scriptlet (using /bin/sh):
     5    /sbin/chkconfig --add sshd
     6    preuninstall scriptlet (using /bin/sh):
     7    if [ "$1" = 0 ]
     8    then
     9        /sbin/service sshd stop > /dev/null 2>&1 || :
    10        /sbin/chkconfig --del sshd
    11    fi
    12    postuninstall scriptlet (using /bin/sh):
    13    /sbin/service sshd condrestart > /dev/null 2>&1 || :

In contrast, uninstalling does stop the service (line 9).  And I'm
confused by line 13.  Why conditionally restart a service that has
been uninstalled?

The triggerscripts look more like they may handle restarts, maybe:

# rpm -qp --triggers
/var/cache/yum/base/packages/openssh-server-4.3p2-82.el5.x86_64.rpm |
cat -n
     1    triggerun scriptlet (using /bin/sh) -- ssh-server
     2    if [ "$1" != 0 -a -r /var/run/sshd.pid ] ; then
     3        touch /var/run/sshd.restart
     4    fi
     5    triggerun scriptlet (using /bin/sh) -- openssh-server  2.5.0p1
     6    # Count the number of HostKey and HostDsaKey statements we have.
     7    gawk    'BEGIN {IGNORECASE=1}
     8         /^hostkey/ || /^hostdsakey/ {sawhostkey = sawhostkey + 1}
     9         END {exit sawhostkey}' /etc/ssh/sshd_config
    10    # And if we only found one, we know the client was relying
on the old default
    11    # behavior, which loaded the the SSH2 DSA host key when
HostDsaKey wasn't
    12    # specified.  Now that HostKey is used for both SSH1 and
SSH2 keys, specifying
    13    # one nullifies the default, which would have loaded both.
    14    if [ $? -eq 1 ] ; then
    15        echo HostKey /etc/ssh/ssh_host_rsa_key >> /etc/ssh/sshd_config
    16        echo HostKey /etc/ssh/ssh_host_dsa_key >> /etc/ssh/sshd_config
    17    fi
    18    triggerpostun scriptlet (using /bin/sh) -- ssh-server
    19    if [ "$1" != 0 ] ; then
    20        /sbin/chkconfig --add sshd
    21        if test -f /var/run/sshd.restart ; then
    22            rm -f /var/run/sshd.restart
    23            /sbin/service sshd start > /dev/null 2>&1 || :
    24        fi
    25    fi

Looks like, perhaps, a combination of lines 3 and 23.  But I'm not
familiar enough with triggers to fully understand what is happening.

Anyone have more insight?

Regards,
- Robert

-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.