Browse Source

fixes for version

Jon Lundy 2 years ago
parent
commit
df8f998c92
4 changed files with 20 additions and 9 deletions
  1. 1 1
      VERSION
  2. 13 2
      cmd/skillet/config.go
  3. 5 5
      cmd/skillet/skillet.go
  4. 1 1
      debian/ROOT/DEBIAN/prerm

+ 1 - 1
VERSION

@@ -1 +1 @@
-0.5.8
+0.5.14

+ 13 - 2
cmd/skillet/config.go

@@ -2,11 +2,12 @@ package main
 
 import (
 	"bytes"
+	"os"
+	"strings"
+
 	"github.com/docopt/docopt-go"
 	"github.com/spf13/viper"
-	"os"
 	"sour.is/x/toolbox/log"
-	"strings"
 )
 
 var (
@@ -145,7 +146,17 @@ func initAppInfo() {
 		viper.Set("app.build", AppBuild)
 	}
 
+	host, err := os.Hostname()
+	if err != nil {
+		log.Fatal(err)
+	}
+	viper.Set("app.hostname", host)
+
 	mode := os.Getenv("MODE")
+	if mode == "" {
+		mode = host
+	}
+
 	if mode != "" {
 		viper.Set("app.name", AppName+" "+mode)
 	}

+ 5 - 5
cmd/skillet/skillet.go

@@ -36,6 +36,7 @@ func main() {
 	cfg.SSLConfig = &tls.Config{ServerName: HOST, InsecureSkipVerify: true}
 	cfg.Server = HOST
 	cfg.NewNick = func(n string) string { return n + "^" }
+	cfg.Version = fmt.Sprintf("Skillet @ %v (v%v)", NODE, AppVersion)
 
 	c := irc.Client(cfg)
 
@@ -58,9 +59,8 @@ func main() {
 		func(conn *irc.Conn, line *irc.Line) {
 			log.Printf("JOIN %v", line.Target())
 			if line.Target() == CHAN {
-				log.Notice("JOIN %v: %v@%v reporting for duty!", line.Target(), line.Nick, NODE)
-
-				conn.Notice(line.Target(), fmt.Sprintf("%v@%v reporting for duty!", line.Nick, NODE))
+				log.Noticef("JOIN %v: %v@%v (v%v) reporting for duty!", line.Target(), line.Nick, NODE, AppVersion)
+				conn.Notice(line.Target(), fmt.Sprintf("%v@%v (v%v) reporting for duty!", line.Nick, NODE, AppVersion))
 			}
 		})
 
@@ -188,8 +188,8 @@ QUIT:
 			break QUIT
 		case <-trap:
 			log.Notice("Shutting Down")
-			c.Notice(CHAN, fmt.Sprintf("So long and thanks for all the fish! - Douglas Adams - %v@%v", NICK, NODE))
-			c.Quit("So long and thanks for all the fish!")
+			c.Notice(CHAN, fmt.Sprintf("So long and thanks for all the fish! -Douglas Adams -%v@%v", NICK, NODE))
+			c.Quit("So long and thanks for all the fish! -Douglas Adams -%s@%v v%v", NICK, NODE, AppVersion)
 		}
 	}
 }

+ 1 - 1
debian/ROOT/DEBIAN/prerm

@@ -3,7 +3,7 @@ set -e
 
 case "$1" in
 remove|upgrade)
-    for service in systemctl list-dependencies multi-user.target --plain | grep sour.is-skillet@
+    for service in $(systemctl list-dependencies multi-user.target --plain | grep sour.is-skillet@)
     do
         if systemctl is-active "$service"; then
             systemctl stop "$service"