|
@@ -21,7 +21,9 @@ import (
|
21
|
21
|
"golang.org/x/crypto/ssh/terminal"
|
22
|
22
|
)
|
23
|
23
|
|
24
|
|
-var commit = ""
|
|
24
|
+// set via linker flags, either by make or by goreleaser:
|
|
25
|
+var commit = "" // git hash
|
|
26
|
+var version = "" // tagged version
|
25
|
27
|
|
26
|
28
|
// get a password from stdin from the user
|
27
|
29
|
func getPassword() string {
|
|
@@ -89,7 +91,7 @@ func doMkcerts(configFile string, quiet bool) {
|
89
|
91
|
}
|
90
|
92
|
|
91
|
93
|
func main() {
|
92
|
|
- version := irc.SemVer
|
|
94
|
+ irc.SetVersionString(version, commit)
|
93
|
95
|
usage := `oragono.
|
94
|
96
|
Usage:
|
95
|
97
|
oragono initdb [--conf <filename>] [--quiet]
|
|
@@ -105,7 +107,7 @@ Options:
|
105
|
107
|
-h --help Show this screen.
|
106
|
108
|
--version Show version.`
|
107
|
109
|
|
108
|
|
- arguments, _ := docopt.ParseArgs(usage, nil, version)
|
|
110
|
+ arguments, _ := docopt.ParseArgs(usage, nil, irc.Ver)
|
109
|
111
|
|
110
|
112
|
// don't require a config file for genpasswd
|
111
|
113
|
if arguments["genpasswd"].(bool) {
|
|
@@ -167,22 +169,11 @@ Options:
|
167
|
169
|
}
|
168
|
170
|
} else if arguments["run"].(bool) {
|
169
|
171
|
if !arguments["--quiet"].(bool) {
|
170
|
|
- logman.Info("server", fmt.Sprintf("Oragono v%s starting", irc.SemVer))
|
171
|
|
- if commit == "" {
|
172
|
|
- logman.Debug("server", fmt.Sprintf("Could not get current commit"))
|
173
|
|
- } else {
|
174
|
|
- logman.Info("server", fmt.Sprintf("Running commit %s", commit))
|
175
|
|
- }
|
176
|
|
- }
|
177
|
|
-
|
178
|
|
- // set current git commit
|
179
|
|
- irc.Commit = commit
|
180
|
|
- if commit != "" {
|
181
|
|
- irc.Ver = fmt.Sprintf("%s-%s", irc.Ver, commit)
|
|
172
|
+ logman.Info("server", fmt.Sprintf("%s starting", irc.Ver))
|
182
|
173
|
}
|
183
|
174
|
|
184
|
175
|
// warning if running a non-final version
|
185
|
|
- if strings.Contains(irc.SemVer, "unreleased") {
|
|
176
|
+ if strings.Contains(irc.Ver, "unreleased") {
|
186
|
177
|
logman.Warning("server", "You are currently running an unreleased beta version of Oragono that may be unstable and could corrupt your database.\nIf you are running a production network, please download the latest build from https://oragono.io/downloads.html and run that instead.")
|
187
|
178
|
}
|
188
|
179
|
|