diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f200566e..211c13e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: strategy: matrix: - go: [ '1.18.x', '1.19.x' ] + go: [ '1.19.x', '1.20.x' ] steps: - name: Set up Go @@ -86,7 +86,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: '1.18.x' + go-version: '1.19.x' - name: Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/docker-push.yml b/.github/workflows/docker-push.yml index baa0f425..e083cff4 100644 --- a/.github/workflows/docker-push.yml +++ b/.github/workflows/docker-push.yml @@ -149,7 +149,7 @@ jobs: - name: Build and push Docker images (Docker) if: ${{ steps.build_check.outputs.build == 'true' }} - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v4 with: push: true context: . @@ -160,7 +160,7 @@ jobs: - name: Build and push Docker images (GHCR) if: ${{ steps.build_check.outputs.build == 'true' }} - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v4 with: push: true context: . diff --git a/COOKBOOK.md b/COOKBOOK.md index 44e114da..0feb1183 100644 --- a/COOKBOOK.md +++ b/COOKBOOK.md @@ -399,7 +399,9 @@ Also, there are some run-time variables: | `DATE` | Current date | | `HOSTNAME` | Hostname | | `IP` | Host IP | +| `OS` | OS name (_linux/darwin/freebsd…_) | | `ARCH` | System architecture (_i386/i686/x86_64/arm…_) | +| `ARCH_NAME` | System architecture name (_386/686/amd64/arm…_) | | `ARCH_BITS` | System architecture (_32/64_) | | `LIBDIR` | Path to directory with shared libraries | | `PYTHON_SITELIB`
`PYTHON2_SITELIB` | Path to directory where pure Python 2 modules are installed (`/usr/lib/python2.X/site-packages`) | diff --git a/action/auxi.go b/action/auxi.go index 0960b9cc..3b083c9c 100644 --- a/action/auxi.go +++ b/action/auxi.go @@ -2,7 +2,7 @@ package action // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/action/backup.go b/action/backup.go index b1ae93c4..1e73d8c5 100644 --- a/action/backup.go +++ b/action/backup.go @@ -2,7 +2,7 @@ package action // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/action/basic.go b/action/basic.go index 21ad8899..289ae5dd 100644 --- a/action/basic.go +++ b/action/basic.go @@ -2,7 +2,7 @@ package action // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/action/fs.go b/action/fs.go index 91f10399..89073d65 100644 --- a/action/fs.go +++ b/action/fs.go @@ -2,7 +2,7 @@ package action // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/action/http.go b/action/http.go index edad59a5..4f976c17 100644 --- a/action/http.go +++ b/action/http.go @@ -2,7 +2,7 @@ package action // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/action/io.go b/action/io.go index cea964f3..75af8d98 100644 --- a/action/io.go +++ b/action/io.go @@ -2,7 +2,7 @@ package action // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/action/libs.go b/action/libs.go index 71a3c29d..8e30a39e 100644 --- a/action/libs.go +++ b/action/libs.go @@ -2,7 +2,7 @@ package action // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/action/python.go b/action/python.go index 98aab445..c8ceb481 100644 --- a/action/python.go +++ b/action/python.go @@ -2,7 +2,7 @@ package action // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/action/service.go b/action/service.go index 4f473b21..4860d40f 100644 --- a/action/service.go +++ b/action/service.go @@ -2,7 +2,7 @@ package action // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/action/system.go b/action/system.go index eba0dd45..2c5c9875 100644 --- a/action/system.go +++ b/action/system.go @@ -2,7 +2,7 @@ package action // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/action/users.go b/action/users.go index 166b7d72..1351d6b3 100644 --- a/action/users.go +++ b/action/users.go @@ -2,7 +2,7 @@ package action // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/bibop.go b/bibop.go index 49947a53..85559eb7 100644 --- a/bibop.go +++ b/bibop.go @@ -5,7 +5,7 @@ package main // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/cli/cli.go b/cli/cli.go index 18c57c58..d1283455 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -2,7 +2,7 @@ package cli // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // @@ -38,7 +38,7 @@ import ( // Application info const ( APP = "bibop" - VER = "6.1.1" + VER = "6.2.0" DESC = "Utility for testing command-line tools" ) diff --git a/cli/executor/executor.go b/cli/executor/executor.go index f1c84643..e37e1a7e 100644 --- a/cli/executor/executor.go +++ b/cli/executor/executor.go @@ -2,7 +2,7 @@ package executor // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/cli/executor/validators.go b/cli/executor/validators.go index 959dcbde..f517e659 100644 --- a/cli/executor/validators.go +++ b/cli/executor/validators.go @@ -2,7 +2,7 @@ package executor // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/go.mod b/go.mod index 2afdf575..f540d0b5 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/buger/jsonparser v1.1.1 github.com/essentialkaos/check v1.3.0 github.com/essentialkaos/depsy v1.0.0 - github.com/essentialkaos/ek/v12 v12.57.1 + github.com/essentialkaos/ek/v12 v12.58.0 github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 ) diff --git a/go.sum b/go.sum index affc69bc..b77d96ad 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,8 @@ github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrb github.com/essentialkaos/check v1.3.0/go.mod h1:PhxzfJWlf5L/skuyhzBLIvjMB5Xu9TIyDIsqpY5MvB8= github.com/essentialkaos/depsy v1.0.0 h1:FikBtTnNhk+xFO/hFr+CfiKs6QnA3wMD6tGL0XTEUkc= github.com/essentialkaos/depsy v1.0.0/go.mod h1:XVsB2eVUonEzmLKQP3ig2P6v2+WcHVgJ10zm0JLqFMM= -github.com/essentialkaos/ek/v12 v12.57.1 h1:9dj32HLCVmseBoa43F6HaZz1qbKts5GNBCtFdrpQPno= -github.com/essentialkaos/ek/v12 v12.57.1/go.mod h1:G8ghiSKh8ToJQCdB2bAhE3CnI6dn9nTJdWH3bQIVr1U= +github.com/essentialkaos/ek/v12 v12.58.0 h1:k0HIBV4w0te4Yr/j5apowXvq1tLP3kbmZdyvxP4YkN0= +github.com/essentialkaos/ek/v12 v12.58.0/go.mod h1:G8ghiSKh8ToJQCdB2bAhE3CnI6dn9nTJdWH3bQIVr1U= github.com/essentialkaos/go-linenoise/v3 v3.4.0/go.mod h1:t1kNLY2bSMQCy1JXOefD2BDLs/TTPMtTv3DFNV5uDSI= github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 h1:CVuJwN34x4xM2aT4sIKhmeib40NeBPhRihNjQmpJsA4= github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2/go.mod h1:nOFQdrUlIlx6M6ODdSpBj1NVA+VgLC6kmw60mkw34H4= diff --git a/parser/fuzz.go b/parser/fuzz.go index 8baa0af7..373ba300 100644 --- a/parser/fuzz.go +++ b/parser/fuzz.go @@ -5,7 +5,7 @@ package parser // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/parser/parser.go b/parser/parser.go index 4791b104..accdbe36 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -2,7 +2,7 @@ package parser // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/parser/parser_test.go b/parser/parser_test.go index d3b07c0e..7be1567b 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -2,7 +2,7 @@ package parser // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/recipe/recipe.go b/recipe/recipe.go index 303e5b3c..a0e74c5c 100644 --- a/recipe/recipe.go +++ b/recipe/recipe.go @@ -2,7 +2,7 @@ package recipe // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/recipe/recipe_test.go b/recipe/recipe_test.go index b89b10f1..1f42ea68 100644 --- a/recipe/recipe_test.go +++ b/recipe/recipe_test.go @@ -2,7 +2,7 @@ package recipe // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // @@ -201,7 +201,9 @@ func (s *RecipeSuite) TestDynamicVariables(c *C) { c.Assert(r.GetVariable("HOSTNAME"), Not(Equals), "") c.Assert(r.GetVariable("IP"), Not(Equals), "") c.Assert(r.GetVariable("ARCH"), Not(Equals), "") + c.Assert(r.GetVariable("ARCH_NAME"), Not(Equals), "") c.Assert(r.GetVariable("ARCH_BITS"), Not(Equals), "") + c.Assert(r.GetVariable("OS"), Not(Equals), "") c.Assert(r.GetVariable("LIBDIR"), Not(Equals), "") diff --git a/recipe/runtime_variables.go b/recipe/runtime_variables.go index 771a1a48..37bb0de5 100644 --- a/recipe/runtime_variables.go +++ b/recipe/runtime_variables.go @@ -2,7 +2,7 @@ package recipe // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // @@ -30,6 +30,8 @@ var DynamicVariables = []string{ "IP", "ARCH", "ARCH_BITS", + "ARCH_NAME", + "OS", "PYTHON_SITELIB", "PYTHON2_SITELIB", "PYTHON_SITEARCH", @@ -50,6 +52,9 @@ var DynamicVariables = []string{ // dynVarCache is dynamic variables cache var dynVarCache map[string]string +// systemInfoCache is cached system info +var systemInfoCache *system.SystemInfo + // prefixDir is path to base prefix dir var prefixDir = "/usr" @@ -88,26 +93,40 @@ func getRuntimeVariable(name string, r *Recipe) string { return time.Now().String() case "HOSTNAME": - systemInfo, err := system.GetSystemInfo() + systemInfo := getSystemInfo() - if err == nil { + if systemInfo != nil { dynVarCache[name] = systemInfo.Hostname } case "ARCH": - systemInfo, err := system.GetSystemInfo() + systemInfo := getSystemInfo() - if err == nil { + if systemInfo != nil { dynVarCache[name] = systemInfo.Arch } case "ARCH_BITS": - systemInfo, err := system.GetSystemInfo() + systemInfo := getSystemInfo() - if err == nil { + if systemInfo != nil { dynVarCache[name] = strconv.Itoa(systemInfo.ArchBits) } + case "ARCH_NAME": + systemInfo := getSystemInfo() + + if systemInfo != nil { + dynVarCache[name] = systemInfo.ArchName + } + + case "OS": + systemInfo := getSystemInfo() + + if systemInfo != nil { + dynVarCache[name] = strings.ToLower(systemInfo.OS) + } + case "IP": dynVarCache[name] = netutil.GetIP() @@ -148,6 +167,17 @@ func getRuntimeVariable(name string, r *Recipe) string { return dynVarCache[name] } +// getSystemInfo returns struct with system info +func getSystemInfo() *system.SystemInfo { + if systemInfoCache != nil { + return systemInfoCache + } + + systemInfoCache, _ = system.GetSystemInfo() + + return systemInfoCache +} + // getPythonSitePackages return path Python site packages directory func getPythonSitePackages(version string, arch, local bool) string { prefix := getPrefixDir(local) diff --git a/recipe/tokens.go b/recipe/tokens.go index 79e782ca..3f58834f 100644 --- a/recipe/tokens.go +++ b/recipe/tokens.go @@ -2,7 +2,7 @@ package recipe // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/render/render.go b/render/render.go index c0bbc864..8478e2b7 100644 --- a/render/render.go +++ b/render/render.go @@ -2,7 +2,7 @@ package render // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/render/renderer_json.go b/render/renderer_json.go index a8f0745b..6a1c1236 100644 --- a/render/renderer_json.go +++ b/render/renderer_json.go @@ -2,7 +2,7 @@ package render // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/render/renderer_quiet.go b/render/renderer_quiet.go index 71b1ae22..d0174e70 100644 --- a/render/renderer_quiet.go +++ b/render/renderer_quiet.go @@ -2,7 +2,7 @@ package render // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/render/renderer_tap13.go b/render/renderer_tap13.go index 7cc83d63..1d74c766 100644 --- a/render/renderer_tap13.go +++ b/render/renderer_tap13.go @@ -2,7 +2,7 @@ package render // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/render/renderer_tap14.go b/render/renderer_tap14.go index b309c105..cb8b1617 100644 --- a/render/renderer_tap14.go +++ b/render/renderer_tap14.go @@ -2,7 +2,7 @@ package render // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/render/renderer_terminal.go b/render/renderer_terminal.go index c8aa65f5..2913efc4 100644 --- a/render/renderer_terminal.go +++ b/render/renderer_terminal.go @@ -2,7 +2,7 @@ package render // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/render/renderer_xml.go b/render/renderer_xml.go index 5892b3a0..f363e15d 100644 --- a/render/renderer_xml.go +++ b/render/renderer_xml.go @@ -2,7 +2,7 @@ package render // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/support/support.go b/support/support.go index 74d65cb7..29cfc120 100644 --- a/support/support.go +++ b/support/support.go @@ -2,7 +2,7 @@ package support // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // @@ -61,7 +61,7 @@ func showApplicationInfo(app, ver, gitRev string) { printInfo(7, "Name", app) printInfo(7, "Version", ver) - printInfo(7, "Git SHA", fmtc.Sprintf( + printInfo(7, "Go", fmtc.Sprintf( "%s {s}(%s/%s){!}", strings.TrimLeft(runtime.Version(), "go"), runtime.GOOS, runtime.GOARCH, diff --git a/support/support_darwin.go b/support/support_darwin.go index 074e99d5..8d1c69b6 100644 --- a/support/support_darwin.go +++ b/support/support_darwin.go @@ -2,7 +2,7 @@ package support // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // @@ -22,10 +22,19 @@ func showOSInfo() { return } + osInfo, err := system.GetOSInfo() + + if err == nil { + fmtutil.Separator(false, "OS INFO") + + printInfo(12, "Name", osInfo.Name) + printInfo(12, "Version", osInfo.VersionID) + printInfo(12, "Build", osInfo.Build) + } + fmtutil.Separator(false, "SYSTEM INFO") printInfo(7, "Name", systemInfo.OS) - printInfo(7, "Version", systemInfo.Version) printInfo(7, "Arch", systemInfo.Arch) printInfo(7, "Kernel", systemInfo.Kernel) } diff --git a/support/support_linux.go b/support/support_linux.go index 6f0ab97e..7e89883b 100644 --- a/support/support_linux.go +++ b/support/support_linux.go @@ -2,7 +2,7 @@ package support // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2022 ESSENTIAL KAOS // +// Copyright (c) 2023 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // @@ -44,7 +44,6 @@ func showOSInfo() { if osInfo == nil { fmtutil.Separator(false, "SYSTEM INFO") printInfo(12, "Name", systemInfo.OS) - printInfo(12, "Version", systemInfo.Version) } }