[Pm-utils] Speaking about the new layout...

Peter Jones pjones at redhat.com
Fri Mar 16 09:41:20 PDT 2007


On Fri, 2007-03-16 at 17:29 +0100, Stefan Seyfried wrote:
> ...which seems to work quite well, but one question popped up:
> 
> What do we recommend to users who ask "how do i disable the $FOO hook"?
> 
> "chmod -x /usr/lib/pm-utils/...." does not sound good, since this is not
> the location for admin-defined stuff.

I already thought of this before we switched ;)

The code in find_sleepd_hooks (with some minor reformatting for email)
is:

  flist="/etc/pm/sleep.d/*[^~] /usr/lib/pm-utils/sleep.d/*[^~]"
  bases=$(for file in $flist ; do echo $(basename $file) ; done | sort -n)
  for base in $bases ; do
    if [ -e "/etc/pm/sleep.d/$base" ]; then
      if [ -x "/etc/pm/sleep.d/$base" ]; then
        echo /etc/pm/sleep.d/$base
      fi
    elif [ -x "/usr/lib/pm-utils/sleep.d/$base" ]; then
      echo /usr/lib/pm-utils/sleep.d/$base
    fi
  done

Which is to say that if /etc/pm/sleep.d/$base exists, we won't use a
script with same name in /usr/lib/pm-utils/sleep.d/ .  But if the
sleep.d variant isn't executable, we won't use it _either_.

Which is to say, the simple way to stop $FOO from running is:

touch /etc/pm/sleep.d/$FOO

-- 
  Peter


More information about the Pm-utils mailing list