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

Bug#568313: Suggestion: forbid the use of dpkg-statoverride in postinst scripts, except for --list



To give everyone an idea of how much simpler the package scripts are
that don't use dpkg-statoverride to set permissions, here is the example
from the policy document:

postinst:
     for i in /usr/bin/foo /usr/sbin/bar
     do
       # only do something when no setting exists
       if ! dpkg-statoverride --list $i >/dev/null 2>&1
       then
         #include: debconf processing, question about foo and bar
         if [ "$RET" = "true" ] ; then
           dpkg-statoverride --update --add sysuser root 4755 $i
         fi
       fi
     done

The corresponding code to remove the override when the package is
purged would be:

     for i in /usr/bin/foo /usr/sbin/bar
     do
       if dpkg-statoverride --list $i >/dev/null 2>&1
       then
         dpkg-statoverride --remove $i
       fi
     done

And here is what it would be with chown/chmod instead:

postinst:
     for i in /usr/bin/foo /usr/sbin/bar
     do
       # only do something when no setting exists
       if ! dpkg-statoverride --list $i >/dev/null 2>&1
       then
         #include: debconf processing, question about foo and bar
         if [ "$RET" = "true" ] ; then
           chown sysuser:root $i
           chmod 4755 $i
         fi
       fi
     done

The corresponding code to remove the override when the package is
purged would be: nothing.

-Brandon

Attachment: signature.asc
Description: PGP signature


Reply to: