also, when supervise targets (dirs) were moved from /var into
/run the runit package never did a cleanup of /var.
We should attempt a clean up on upgrade (postinst) of the following:

/var/lib/supervise/*
/var/lib/runit/supervise/*

but make sure to check that there is no runsv process still using the
directory before removing it, for example

for supervise in /var/lib/supervise/* /var/lib/runit/supervise/* ; do
        #should not list as removable if there is a service active on this 
supervise dir
        if which chpst > /dev/null ; then
                if chpst -L "$supervise"/lock true 2>/dev/null ; then
                        echo "$supervise"
                else
                        continue #supervise is used by a runsv process, can't 
be removed
                fi
        elif which flock >/dev/null ; then # fallback on flock
                if flock -F -n "$supervise"/lock true ; then
                        echo "$supervise"
                else
                        continue
                fi
        else #wtf, Hurd port?  without runit installed
                echo "unreliable: $supervise"
        fi
done

and the top dir itself ( /var/lib/supervise, var/lib/runit/supervise )
can't be removed because there could be some service that still uses it
even if temporary disabled, so this requires a NEWS entry

Reply via email to