|
@@ -285,6 +285,19 @@ func forcePathSeparator(path string) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func IsRunUserMatchCurrentUser(runUser string) (string, bool) {
|
|
|
+ if IsWindows {
|
|
|
+ return "", true
|
|
|
+ }
|
|
|
+
|
|
|
+ currentUser := user.CurrentUsername()
|
|
|
+ return currentUser, runUser == currentUser
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
|
|
|
func NewContext() {
|
|
@@ -431,10 +444,12 @@ func NewContext() {
|
|
|
}[Cfg.Section("time").Key("FORMAT").MustString("RFC1123")]
|
|
|
|
|
|
RunUser = Cfg.Section("").Key("RUN_USER").String()
|
|
|
- curUser := user.CurrentUsername()
|
|
|
|
|
|
- if InstallLock && RunUser != curUser {
|
|
|
- log.Fatal(4, "Expect user(%s) but current user is: %s", RunUser, curUser)
|
|
|
+ if InstallLock {
|
|
|
+ currentUser, match := IsRunUserMatchCurrentUser(RunUser)
|
|
|
+ if !match {
|
|
|
+ log.Fatal(4, "Expect user '%s' but current user is: %s", RunUser, currentUser)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|