Documentation ¶
Overview ¶
Package runinhibit contains operations for establishing, removing and querying snap run inhibition lock.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var InhibitDir = defaultInhibitDir
InhibitDir is the directory where inhibition files are stored. This value can be changed by calling dirs.SetRootDir.
Functions ¶
func LockWithHint ¶
LockWithHint sets a persistent "snap run" inhibition lock, for the given snap, with a given hint.
The hint cannot be empty. It should be one of the Hint constants defined in this package. With the hint in place "snap run" will not allow the snap to start and will block, presenting a user interface if possible.
func RemoveLockFile ¶
RemoveLockFile removes the run inhibition lock for the given snap.
This function should not be used as a substitute of Unlock, as race-free ability to inspect the inhibition state relies on flock(2) which requires the file to exist in the first place and non-privileged processes cannot create it.
The function does not fail if the inhibition lock does not exist.
Types ¶
type Hint ¶
type Hint string
Hint is a string representing reason for the inhibition of "snap run".
const ( // HintNotInhibited is used when "snap run" is not inhibited. HintNotInhibited Hint = "" // HintInhibitedGateRefresh represents inhibition of a "snap run" while gate-auto-refresh hook is run. HintInhibitedGateRefresh Hint = "gate-refresh" // HintInhibitedForRefresh represents inhibition of a "snap run" while a refresh change is being performed. HintInhibitedForRefresh Hint = "refresh" )