File tree Expand file tree Collapse file tree 4 files changed +45
-2
lines changed Expand file tree Collapse file tree 4 files changed +45
-2
lines changed Original file line number Diff line number Diff line change 11package main
22
33import (
4+ "flag"
5+ "fmt"
6+
47 "github.com/jetkvm/kvm"
8+ "github.com/prometheus/common/version"
59)
610
11+ func printVersion () {
12+ version .Version = kvm .GetBuiltAppVersion ()
13+ app_version := version .Print ("JetKVM Application" )
14+ fmt .Println (app_version )
15+
16+ nativeVersion , err := kvm .GetNativeVersion ()
17+ if err == nil {
18+ fmt .Println ("\n JetKVM Native, version" , nativeVersion )
19+ }
20+ }
21+
722func main () {
23+ versionPtr := flag .Bool ("version" , false , "print version and exit" )
24+ flag .Parse ()
25+
26+ if * versionPtr {
27+ printVersion ()
28+ return
29+ }
30+
831 kvm .Main ()
932}
Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ cd "${REMOTE_PATH}"
174174chmod +x jetkvm_app_debug
175175
176176# Run the application in the background
177- PION_LOG_TRACE=${LOG_TRACE_SCOPES} ./jetkvm_app_debug
177+ PION_LOG_TRACE=${LOG_TRACE_SCOPES} ./jetkvm_app_debug | tee -a /tmp/jetkvm_app_debug.log
178178EOF
179179
180180echo " Deployment complete."
Original file line number Diff line number Diff line change @@ -282,14 +282,30 @@ func shouldOverwrite(destPath string, srcHash []byte) bool {
282282 return ! bytes .Equal (srcHash , dstHash )
283283}
284284
285+ func getNativeSha256 () ([]byte , error ) {
286+ version , err := resource .ResourceFS .ReadFile ("jetkvm_native.sha256" )
287+ if err != nil {
288+ return nil , err
289+ }
290+ return version , nil
291+ }
292+
293+ func GetNativeVersion () (string , error ) {
294+ version , err := getNativeSha256 ()
295+ if err != nil {
296+ return "" , err
297+ }
298+ return string (version ), nil
299+ }
300+
285301func ensureBinaryUpdated (destPath string ) error {
286302 srcFile , err := resource .ResourceFS .Open ("jetkvm_native" )
287303 if err != nil {
288304 return err
289305 }
290306 defer srcFile .Close ()
291307
292- srcHash , err := resource . ResourceFS . ReadFile ( "jetkvm_native.sha256" )
308+ srcHash , err := getNativeSha256 ( )
293309 if err != nil {
294310 nativeLogger .Debug ().Msg ("error reading embedded jetkvm_native.sha256, proceeding with update" )
295311 srcHash = nil
Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ const UpdateMetadataUrl = "https://api.jetkvm.com/releases"
5050
5151var builtAppVersion = "0.1.0+dev"
5252
53+ func GetBuiltAppVersion () string {
54+ return builtAppVersion
55+ }
56+
5357func GetLocalVersion () (systemVersion * semver.Version , appVersion * semver.Version , err error ) {
5458 appVersion , err = semver .NewVersion (builtAppVersion )
5559 if err != nil {
You can’t perform that action at this time.
0 commit comments