From f600cd00900e4d46edd4dce4379c46d35bdcb4cf Mon Sep 17 00:00:00 2001 From: Chris Novakovic Date: Wed, 28 Mar 2018 00:31:03 +0100 Subject: [PATCH] Added "removestate" function for hook scripts Added a "removestate" function to pm/functions, so that hook scripts can delete pieces of state that they have previously stored. --- pm/functions.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pm/functions.in b/pm/functions.in index bd649db..d72cb9c 100644 --- a/pm/functions.in +++ b/pm/functions.in @@ -191,6 +191,13 @@ restorestate() state_exists "$1" && cat "${STORAGEDIR}/state:$1" } +# Delete a piece of state if it exists. +removestate() +{ + # $1 = name of state + state_exists "$1" && rm "${STORAGEDIR}/state:$1" +} + # Inhibit suspend/resume and running any more hooks. # Any parameters passed ti this function will be saved in the inhibit file. inhibit() -- 2.14.1