> > > Ok, I'm tired of having to track all services that might need to be > > > restarted after a libc6 upgrade. So here's what I am going to do. I want > > > to require all packages that need this to declare a new reply in it's init > > > script. It's very simple, I check your init script like this: > > > > Is it posible to detect if the service needs a restart by examining the > > executable file? > > > > E.g.: > > objdump -T $( readlink -f /proc/$PID/exe ) | egrep 'symbol1|symbol2' > > > > The processes to restart could be taken from ps AND /etc/init.d/*. > > How would it know that it is a service as opposed to a running "ls" or > cronjob? How would it know how to restart simple executables?
This is my solution. Its only problem is that it depends on fuser, which is not in base, but it shows that a cleaner solution is posible. The list of afected libc functions is far from complete.
for file in /sbin/* /usr/sbin/* ; do if objdump -T "$file" 2> /dev/null | egrep -q 'initgroups|getgrent|getgrnam|getpwent|getpwnam' ; then pids="" for j in $( fuser $file ) ; do pids="$(echo $j | sed -ne 's/^\([0-9]*\)[em]$/\1/p' ) " done if [ "$pids" ]; then echo \# $file: $pids daemons="$daemons $file" fi fi done for d in $daemons; do package=$(grep -l ^${d}\$ /var/lib/dpkg/info/*.list | head -1) package=${package##*/} package=${package%%.list} if [ "$package" ]; then rcs="$(grep /etc/init.d/ /var/lib/dpkg/info/${package}.list )" if [ "$rcs" ]; then for rc in $rcs; do if [ -x "$rc" ]; then echo $rc restart fi done fi fi done