mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
moved the lockfile definition out to snappy.dirs
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ubuntu-core/snappy/dirs"
|
||||
"github.com/ubuntu-core/snappy/i18n"
|
||||
"github.com/ubuntu-core/snappy/logger"
|
||||
"github.com/ubuntu-core/snappy/priv"
|
||||
@@ -32,8 +33,6 @@ import (
|
||||
"github.com/jessevdk/go-flags"
|
||||
)
|
||||
|
||||
const snappyLockFile = "/run/snappy.lock"
|
||||
|
||||
func isAutoPilotRunning() bool {
|
||||
unitName := "snappy-autopilot"
|
||||
bs, err := exec.Command("systemctl", "show", "--property=SubState", unitName).CombinedOutput()
|
||||
@@ -48,7 +47,7 @@ func isAutoPilotRunning() bool {
|
||||
// automatic re-try and helpful messages if the lock is already taken
|
||||
func withMutexAndRetry(f func() error) error {
|
||||
for {
|
||||
err := priv.WithMutex(snappyLockFile, f)
|
||||
err := priv.WithMutex(dirs.SnapLockFile, f)
|
||||
// if already locked, auto-retry
|
||||
if err == priv.ErrAlreadyLocked {
|
||||
var msg string
|
||||
|
||||
@@ -35,6 +35,7 @@ var (
|
||||
LocaleDir string
|
||||
SnapIconsDir string
|
||||
SnapMetaDir string
|
||||
SnapLockFile string
|
||||
|
||||
SnapBinariesDir string
|
||||
SnapServicesDir string
|
||||
@@ -59,6 +60,7 @@ func SetRootDir(rootdir string) {
|
||||
SnapSeccompDir = filepath.Join(rootdir, SnappyDir, "seccomp", "profiles")
|
||||
SnapIconsDir = filepath.Join(rootdir, SnappyDir, "icons")
|
||||
SnapMetaDir = filepath.Join(rootdir, SnappyDir, "meta")
|
||||
SnapLockFile = filepath.Join(rootdir, "/run/snappy.lock")
|
||||
|
||||
SnapBinariesDir = filepath.Join(SnapAppsDir, "bin")
|
||||
SnapServicesDir = filepath.Join(rootdir, "/etc/systemd/system")
|
||||
|
||||
Reference in New Issue
Block a user