#!/bin/sh
# Small snippet of code used to detect which proceses 
#_really_ needs a re-start after upgrade
# 
# Licence: BSDLike - http://rickvanderzwet.nl/LICENSE
# Rick van der Zwet <info@rickvanderzwet.nl>

TMPFILE=`basename $0 .sh`
TMPFILE=`mktemp -t $TMPFILE`

pkg_version -vIL= | awk '{print $1}' > $TMPFILE

if [ ! -s $TMPFILE ]; then
    exit 0
fi

SIZE=0
NEWSIZE=1

while [ $NEWSIZE -gt $SIZE ]; do
    SIZE=`cat $TMPFILE | wc -l`
    pkg_info -qR `cat $TMPFILE` >> $TMPFILE
    sort -u -o $TMPFILE $TMPFILE
    NEWSIZE=`cat $TMPFILE | wc -l`
done

pkg_info -L `cat $TMPFILE` | grep -F 'rc.d'


rm -f $TMPFILE
