Compare commits
10 Commits
a00ee23b14
...
main
Author | SHA1 | Date | |
---|---|---|---|
465b5abc64 | |||
d0b8c75a9e | |||
f8a8344049 | |||
bad1cf3c23 | |||
1a84bb4286 | |||
354bdce5ab | |||
6099dd399d | |||
9fe316ad44 | |||
e9ba7987b8 | |||
adb9d0095c |
@ -1,32 +0,0 @@
|
|||||||
image: golang:1.10.3
|
|
||||||
|
|
||||||
variables:
|
|
||||||
REPO_NAME: novit.nc/direktil/inits
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- mkdir -p $GOPATH/src/$(dirname $REPO_NAME)
|
|
||||||
- ln -svf $CI_PROJECT_DIR $GOPATH/src/$REPO_NAME
|
|
||||||
- cd $GOPATH/src/$REPO_NAME
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- test
|
|
||||||
- build
|
|
||||||
|
|
||||||
format:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- go fmt ./...
|
|
||||||
- go vet ./...
|
|
||||||
- go test -race ./...
|
|
||||||
|
|
||||||
compile:
|
|
||||||
stage: build
|
|
||||||
script:
|
|
||||||
- go build ./cmd/dkl-apply-config
|
|
||||||
- go build ./cmd/dkl-system-init
|
|
||||||
- CGO_ENABLED=0 go build ./cmd/dkl-initrd-init
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- dkl-apply-config
|
|
||||||
- dkl-system-init
|
|
||||||
- dkl-initrd-init
|
|
@ -1,8 +1,8 @@
|
|||||||
# ------------------------------------------------------------------------
|
# ------------------------------------------------------------------------
|
||||||
from mcluseau/golang-builder:1.15.1 as build
|
from mcluseau/golang-builder:1.21.4 as build
|
||||||
|
|
||||||
# ------------------------------------------------------------------------
|
# ------------------------------------------------------------------------
|
||||||
from alpine:3.12
|
from alpine:3.18.4
|
||||||
|
|
||||||
entrypoint mksquashfs /layer /layer.squashfs -noappend -comp xz >&2 && base64 </layer.squashfs
|
entrypoint mksquashfs /layer /layer.squashfs -noappend -comp xz >&2 && base64 </layer.squashfs
|
||||||
|
|
||||||
|
@ -5,15 +5,17 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"novit.nc/direktil/inits/pkg/cmd/applyconfig"
|
"novit.tech/direktil/inits/pkg/cmd/applyconfig"
|
||||||
cmddynlay "novit.nc/direktil/inits/pkg/cmd/dynlay"
|
cmddynlay "novit.tech/direktil/inits/pkg/cmd/dynlay"
|
||||||
cmdinit "novit.nc/direktil/inits/pkg/cmd/init"
|
cmdinit "novit.tech/direktil/inits/pkg/cmd/init"
|
||||||
|
cmdlogger "novit.tech/direktil/inits/pkg/cmd/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
root := &cobra.Command{}
|
root := &cobra.Command{}
|
||||||
|
|
||||||
root.AddCommand(cmdinit.Command())
|
root.AddCommand(cmdinit.Command())
|
||||||
|
root.AddCommand(cmdlogger.Command())
|
||||||
root.AddCommand(cmddynlay.Command())
|
root.AddCommand(cmddynlay.Command())
|
||||||
root.AddCommand(applyconfig.Command())
|
root.AddCommand(applyconfig.Command())
|
||||||
|
|
||||||
|
35
go.mod
35
go.mod
@ -1,18 +1,27 @@
|
|||||||
module novit.nc/direktil/inits
|
module novit.tech/direktil/inits
|
||||||
|
|
||||||
go 1.15
|
go 1.21
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/antage/mntent v0.0.0-20141129103236-834970000c6c
|
github.com/antage/mntent v0.0.0-20141129103236-834970000c6c
|
||||||
github.com/fsnotify/fsnotify v1.4.9
|
github.com/fsnotify/fsnotify v1.7.0
|
||||||
github.com/go-ping/ping v0.0.0-20201001214134-671c40f29adc
|
github.com/go-ping/ping v1.1.0
|
||||||
github.com/paultag/go-loopback v0.0.0-20180807022812-2589a042248e // indirect
|
github.com/rs/zerolog v1.31.0
|
||||||
github.com/spf13/cobra v1.0.0
|
github.com/spf13/cobra v1.8.0
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
novit.tech/direktil/pkg v0.0.0-20240120131645-39b9b401ba38
|
||||||
github.com/ulikunitz/xz v0.5.8 // indirect
|
)
|
||||||
golang.org/x/net v0.0.0-20200930145003-4acb6c075d10 // indirect
|
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f // indirect
|
require (
|
||||||
gonum.org/v1/gonum v0.8.1 // indirect
|
github.com/google/uuid v1.5.0 // indirect
|
||||||
gopkg.in/yaml.v2 v2.3.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
novit.nc/direktil/pkg v0.0.0-20191211161950-96b0448b84c2
|
github.com/kr/pretty v0.1.0 // indirect
|
||||||
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
|
github.com/ulikunitz/xz v0.5.11 // indirect
|
||||||
|
golang.org/x/net v0.20.0 // indirect
|
||||||
|
golang.org/x/sync v0.6.0 // indirect
|
||||||
|
golang.org/x/sys v0.16.0 // indirect
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
|
||||||
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
)
|
)
|
||||||
|
248
go.sum
248
go.sum
@ -1,184 +1,94 @@
|
|||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
|
||||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
|
||||||
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
|
|
||||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
|
||||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
|
||||||
github.com/antage/mntent v0.0.0-20141129103236-834970000c6c h1:6g5LfUYqDR1rEL54hKdK7edwAp2R4baYmtDpJgm6+5Q=
|
github.com/antage/mntent v0.0.0-20141129103236-834970000c6c h1:6g5LfUYqDR1rEL54hKdK7edwAp2R4baYmtDpJgm6+5Q=
|
||||||
github.com/antage/mntent v0.0.0-20141129103236-834970000c6c/go.mod h1:AsQhRqephGS4znB7Z793C63GgcW2I6xUsInepL9EOdE=
|
github.com/antage/mntent v0.0.0-20141129103236-834970000c6c/go.mod h1:AsQhRqephGS4znB7Z793C63GgcW2I6xUsInepL9EOdE=
|
||||||
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
|
github.com/cavaliergopher/cpio v1.0.1/go.mod h1:pBdaqQjnvXxdS/6CvNDwIANIFSP0xRKI16PX4xejRQc=
|
||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
|
||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
|
||||||
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
|
github.com/go-ping/ping v1.1.0 h1:3MCGhVX4fyEUuhsfwPrsEdQw6xspHkv5zHsiSoDFZYw=
|
||||||
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
github.com/go-ping/ping v1.1.0/go.mod h1:xIFjORFzTxqIV/tDVGO4eDy/bLuSyawEeojSm3GfRGk=
|
||||||
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||||
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
|
||||||
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
|
|
||||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
|
||||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
|
||||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
|
||||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
|
||||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
|
||||||
github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0=
|
|
||||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
|
||||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
|
||||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
|
||||||
github.com/go-ping/ping v0.0.0-20201001214134-671c40f29adc h1:EBQOB1Qyv8xxwUSDoUJpHgNiZQhfj6Trkr4jmfJjc20=
|
|
||||||
github.com/go-ping/ping v0.0.0-20201001214134-671c40f29adc/go.mod h1:35JbSyV/BYqHwwRA6Zr1uVDm1637YlNOU61wI797NPI=
|
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
|
||||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
|
||||||
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
|
||||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
|
||||||
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
|
||||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
|
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
|
||||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
|
||||||
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
|
||||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
|
||||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
|
||||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
|
||||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
|
||||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
|
||||||
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
|
||||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
|
||||||
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
|
|
||||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
|
||||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
|
||||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
|
||||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/paultag/go-loopback v0.0.0-20180807022812-2589a042248e h1:qoHpC8Xx84+Uqod6i8DjIgxMKXUyiv16rinyly8XT7A=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/paultag/go-loopback v0.0.0-20180807022812-2589a042248e/go.mod h1:a8zVTnQlIjBriq5Q5MOS9xmfBQHGCyrBilmLyKZW9Ls=
|
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A=
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
|
||||||
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
|
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
|
||||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
|
||||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
|
||||||
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
|
||||||
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
|
||||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
|
||||||
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
|
||||||
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
|
||||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
|
||||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
|
||||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
|
||||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
|
||||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
|
||||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
|
||||||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
|
||||||
github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8=
|
|
||||||
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
|
|
||||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
|
||||||
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
|
|
||||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
|
||||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
|
github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
|
||||||
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
|
|
||||||
github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
|
|
||||||
github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ=
|
|
||||||
github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
|
||||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
|
||||||
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
|
||||||
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
|
||||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
|
||||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
|
||||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
|
||||||
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||||
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2 h1:y102fOLFqhV41b+4GPiJoa0k/x+pJcEi2/HB1Y5T6fU=
|
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||||
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
|
||||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||||
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/net v0.0.0-20200904194848-62affa334b73 h1:MXfv8rhZWmFeqX3GNZRsd6vOLoaCHjYEX3qkRo3YBUA=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/net v0.0.0-20200930145003-4acb6c075d10 h1:YfxMZzv3PjGonQYNUaeU2+DhAdqOxerQ30JFB6WgAXo=
|
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
|
||||||
golang.org/x/net v0.0.0-20200930145003-4acb6c075d10/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA=
|
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
|
||||||
|
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
|
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||||
|
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||||
|
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||||
golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
gonum.org/v1/gonum v0.8.1 h1:wGtP3yGpc5mCLOLeTeBdjeui9oZSz5De0eOjMLC/QuQ=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
gonum.org/v1/gonum v0.8.1/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0=
|
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||||
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc=
|
|
||||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
|
||||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc=
|
|
||||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
|
||||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
|
||||||
google.golang.org/grpc v1.21.0 h1:G+97AoqBnmZIT91cLG/EkCoK9NSelj64P8bOHHNmGn0=
|
|
||||||
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
novit.tech/direktil/pkg v0.0.0-20240120131645-39b9b401ba38 h1:1Q1X91BwE1g1NFqeA9sJh7G9OS4D75QTWHNnzXZgY70=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
novit.tech/direktil/pkg v0.0.0-20240120131645-39b9b401ba38/go.mod h1:zjezU6tELE880oYHs/WAauGBupKIEQQ7KqWTB69RW10=
|
||||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
novit.nc/direktil/pkg v0.0.0-20191211161950-96b0448b84c2 h1:LN3K19gAJ1GamJXkzXAQmjbl8xCV7utqdxTTrM89MMc=
|
|
||||||
novit.nc/direktil/pkg v0.0.0-20191211161950-96b0448b84c2/go.mod h1:zwTVO6U0tXFEaga73megQIBK7yVIKZJVePaIh/UtdfU=
|
|
||||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
#!/sbin/openrc-run
|
|
||||||
|
|
||||||
description="Direktil boot operations."
|
|
||||||
|
|
||||||
depend()
|
|
||||||
{
|
|
||||||
provide net
|
|
||||||
before sysctl
|
|
||||||
}
|
|
||||||
|
|
||||||
start()
|
|
||||||
{
|
|
||||||
ebegin "Running Direktil boot operations"
|
|
||||||
/sbin/dkl init boot
|
|
||||||
eend $? "Direktil boot operations failed"
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
#!/sbin/openrc-run
|
|
||||||
|
|
||||||
description="Direktil default operations."
|
|
||||||
|
|
||||||
depend()
|
|
||||||
{
|
|
||||||
# need anything?
|
|
||||||
:
|
|
||||||
}
|
|
||||||
|
|
||||||
start()
|
|
||||||
{
|
|
||||||
ebegin "Running Direktil default operations"
|
|
||||||
/sbin/dkl init default
|
|
||||||
eend $? "Direktil default operations failed"
|
|
||||||
}
|
|
@ -2,29 +2,12 @@
|
|||||||
|
|
||||||
description="Direktil user services."
|
description="Direktil user services."
|
||||||
|
|
||||||
pidfile=/run/direktil/services.pid
|
supervisor=supervise-daemon
|
||||||
|
command="/sbin/dkl init services"
|
||||||
|
|
||||||
|
pidfile=/run/dkl-init-services.pid
|
||||||
|
|
||||||
depend()
|
depend()
|
||||||
{
|
{
|
||||||
need dkl-default
|
need dkl-default
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
|
||||||
{
|
|
||||||
mkdir -p $(dirname $pidfile)
|
|
||||||
|
|
||||||
einfo "Starting Direktil services manager"
|
|
||||||
start-stop-daemon --start \
|
|
||||||
--pidfile $pidfile \
|
|
||||||
--background \
|
|
||||||
--exec "/sbin/dkl" \
|
|
||||||
-- init services
|
|
||||||
eend $? "Failed to start Direktil services manager"
|
|
||||||
}
|
|
||||||
|
|
||||||
stop()
|
|
||||||
{
|
|
||||||
einfo "Stopping Direktil services manager"
|
|
||||||
start-stop-daemon --stop --pidfile $pidfile
|
|
||||||
eend $? "Failed to stop Direktil services manager"
|
|
||||||
}
|
|
||||||
|
@ -1,30 +1,6 @@
|
|||||||
# Global OpenRC configuration settings
|
# Global OpenRC configuration settings
|
||||||
rc_shell=/sbin/sulogin
|
rc_shell=/sbin/sulogin
|
||||||
|
|
||||||
# rc_logger launches a logging daemon to log the entire rc process to
|
|
||||||
# /var/log/rc.log
|
|
||||||
# NOTE: Linux systems require the devfs service to be started before
|
|
||||||
# logging can take place and as such cannot log the sysinit runlevel.
|
|
||||||
#rc_logger="NO"
|
|
||||||
|
|
||||||
# Through rc_log_path you can specify a custom log file.
|
|
||||||
# The default value is: /var/log/rc.log
|
|
||||||
#rc_log_path="/var/log/rc.log"
|
|
||||||
|
|
||||||
# By default we assume that all daemons will start correctly.
|
|
||||||
# However, some do not - a classic example is that they fork and return 0 AND
|
|
||||||
# then child barfs on a configuration error. Or the daemon has a bug and the
|
|
||||||
# child crashes. You can set the number of milliseconds start-stop-daemon
|
|
||||||
# waits to check that the daemon is still running after starting here.
|
|
||||||
# The default is 0 - no checking.
|
|
||||||
#rc_start_wait=100
|
|
||||||
|
|
||||||
# Set unicode to YES to turn on unicode support for keyboards and screens.
|
|
||||||
unicode="YES"
|
unicode="YES"
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
# SERVICE CONFIGURATION VARIABLES
|
|
||||||
|
|
||||||
rc_tty_number=12
|
rc_tty_number=12
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@ -35,7 +11,7 @@ rc_tty_number=12
|
|||||||
# cgroups version 1 on /sys/fs/cgroup.
|
# cgroups version 1 on /sys/fs/cgroup.
|
||||||
# "legacy" mounts cgroups version 1 on /sys/fs/cgroup
|
# "legacy" mounts cgroups version 1 on /sys/fs/cgroup
|
||||||
# "unified" mounts cgroups version 2 on /sys/fs/cgroup
|
# "unified" mounts cgroups version 2 on /sys/fs/cgroup
|
||||||
rc_cgroup_mode="legacy"
|
rc_cgroup_mode="hybrid"
|
||||||
|
|
||||||
# This switch controls whether or not cgroups version 1 controllers are
|
# This switch controls whether or not cgroups version 1 controllers are
|
||||||
# individually mounted under
|
# individually mounted under
|
||||||
|
@ -1 +0,0 @@
|
|||||||
../../init.d/dkl-boot
|
|
@ -1 +0,0 @@
|
|||||||
../../init.d/dkl-default
|
|
@ -1 +0,0 @@
|
|||||||
../../init.d/dkl-user-services
|
|
@ -1,12 +1,9 @@
|
|||||||
modd.conf {}
|
modd.conf {}
|
||||||
|
|
||||||
**/*.go layer/**/* test-vm update-test-data {
|
**/*.go go.mod go.sum layer/**/* test-vm update-test-data {
|
||||||
prep: go test ./... #./pkg/... ./cmd/dkl
|
prep: go test ./...
|
||||||
prep: mkdir -p dist
|
prep: mkdir -p dist
|
||||||
prep: CGO_ENABLED=0 go build -o dist -trimpath ./cmd/...
|
prep: CGO_ENABLED=0 go build -o dist/ -trimpath ./...
|
||||||
|
|
||||||
prep: rsync -za --stats dist/dkl bw:/usr/local/bin/
|
|
||||||
prep: ssh bw dkl apply-config config.yaml
|
|
||||||
|
|
||||||
#prep: ./update-test-data
|
#prep: ./update-test-data
|
||||||
#daemon: ./test-vm 1
|
#daemon: ./test-vm 1
|
||||||
|
@ -1,94 +0,0 @@
|
|||||||
package apply
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"novit.nc/direktil/inits/pkg/vars"
|
|
||||||
"novit.nc/direktil/pkg/config"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
authorizedKeysPath = "/root/.ssh/authorized_keys"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Files writes the files from the given config
|
|
||||||
func Files(cfg *config.Config, filters ...string) (err error) {
|
|
||||||
accept := func(n string) bool { return true }
|
|
||||||
|
|
||||||
if len(filters) > 0 {
|
|
||||||
accept = func(n string) bool {
|
|
||||||
for _, filter := range filters {
|
|
||||||
if matched, err := filepath.Match(filter, n); err != nil {
|
|
||||||
log.Printf("ERROR: bad filter ignored: %q: %v", filter, err)
|
|
||||||
} else if matched {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if cfg.RootUser.AuthorizedKeys != nil && accept(authorizedKeysPath) {
|
|
||||||
err = writeFile(
|
|
||||||
authorizedKeysPath,
|
|
||||||
[]byte(strings.Join(cfg.RootUser.AuthorizedKeys, "\n")),
|
|
||||||
0600, 0700, cfg,
|
|
||||||
)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, file := range cfg.Files {
|
|
||||||
if !accept(file.Path) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
mode := file.Mode
|
|
||||||
if mode == 0 {
|
|
||||||
mode = 0644
|
|
||||||
}
|
|
||||||
|
|
||||||
content := []byte(file.Content)
|
|
||||||
|
|
||||||
err = writeFile(
|
|
||||||
file.Path,
|
|
||||||
content,
|
|
||||||
mode,
|
|
||||||
0755,
|
|
||||||
cfg,
|
|
||||||
)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Print("failed to write file ", file.Path, ": ", err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func writeFile(path string, content []byte, fileMode, dirMode os.FileMode, cfg *config.Config) (err error) {
|
|
||||||
if err = os.MkdirAll(filepath.Dir(path), dirMode); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
content = vars.Substitute(content, cfg)
|
|
||||||
|
|
||||||
log.Printf("writing %q, mode %04o, %d bytes", path, fileMode, len(content))
|
|
||||||
if err = ioutil.WriteFile(path, content, fileMode); err != nil {
|
|
||||||
err = fmt.Errorf("failed to write %s: %v", path, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if chmodErr := os.Chmod(path, fileMode); chmodErr != nil {
|
|
||||||
log.Print("- failed chmod: ", chmodErr)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
@ -1,20 +1,19 @@
|
|||||||
package applyconfig
|
package applyconfig
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
|
|
||||||
|
"github.com/rs/zerolog"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"novit.nc/direktil/inits/pkg/apply"
|
|
||||||
"novit.nc/direktil/pkg/config"
|
|
||||||
|
|
||||||
dlog "novit.nc/direktil/pkg/log"
|
"novit.tech/direktil/pkg/config"
|
||||||
|
"novit.tech/direktil/pkg/config/apply"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
filesFilters string
|
filters []string
|
||||||
log = dlog.Get("dkl")
|
pathPrefix string
|
||||||
)
|
)
|
||||||
|
|
||||||
func Command() (c *cobra.Command) {
|
func Command() (c *cobra.Command) {
|
||||||
@ -26,12 +25,16 @@ func Command() (c *cobra.Command) {
|
|||||||
Run: run,
|
Run: run,
|
||||||
}
|
}
|
||||||
|
|
||||||
flag.StringVar(&filesFilters, "files-filters", "", "comma-separated filters to select files to apply")
|
flag := c.Flags()
|
||||||
|
flag.StringArrayVarP(&filters, "filter", "F", []string{}, "glob filter to select files to apply")
|
||||||
|
flag.StringVarP(&pathPrefix, "prefix", "P", "", "path prefix")
|
||||||
|
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
func run(_ *cobra.Command, args []string) {
|
func run(_ *cobra.Command, args []string) {
|
||||||
|
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
|
||||||
|
|
||||||
configPath := args[0]
|
configPath := args[0]
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -40,24 +43,19 @@ func run(_ *cobra.Command, args []string) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if configPath == "-" {
|
if configPath == "-" {
|
||||||
log.Print("loading config from stdin")
|
log.Info().Str("from", "stdin").Msg("loading config")
|
||||||
cfg, err = config.Read(os.Stdin)
|
cfg, err = config.Read(os.Stdin)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
log.Print("loading config from ", configPath)
|
log.Info().Str("from", configPath).Msg("loading config")
|
||||||
cfg, err = config.Load(configPath)
|
cfg, err = config.Load(configPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print("failed to load config: ", err)
|
log.Fatal().Err(err).Msg("failed to load config")
|
||||||
}
|
}
|
||||||
|
|
||||||
filters := []string{}
|
if err = apply.Files(cfg, pathPrefix, filters...); err != nil {
|
||||||
if filesFilters != "" {
|
log.Fatal().Err(err).Msg("failed to apply files")
|
||||||
filters = strings.Split(filesFilters, ",")
|
|
||||||
}
|
|
||||||
if err = apply.Files(cfg /*log,*/, filters...); err != nil {
|
|
||||||
log.Taint(dlog.Fatal, "failed to apply files: ", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
var urlPrefix = "https://dkl.novit.nc/dist/layers"
|
var urlPrefix = "https://dkl.novit.io/dist/layers"
|
||||||
|
|
||||||
func Command() (c *cobra.Command) {
|
func Command() (c *cobra.Command) {
|
||||||
c = &cobra.Command{
|
c = &cobra.Command{
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
pconfig "novit.nc/direktil/pkg/config"
|
pconfig "novit.tech/direktil/pkg/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
pconfig "novit.nc/direktil/pkg/config"
|
pconfig "novit.tech/direktil/pkg/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func listCommand() (cmd *cobra.Command) {
|
func listCommand() (cmd *cobra.Command) {
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
package initboot
|
|
||||||
|
|
||||||
import (
|
|
||||||
"log"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
|
|
||||||
"novit.nc/direktil/inits/pkg/sys"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
doNetwork bool
|
|
||||||
)
|
|
||||||
|
|
||||||
func Command() (c *cobra.Command) {
|
|
||||||
c = &cobra.Command{
|
|
||||||
Use: "boot",
|
|
||||||
Short: "boot stage",
|
|
||||||
Run: run,
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func run(c *cobra.Command, args []string) {
|
|
||||||
step("files", setupFiles)
|
|
||||||
step("modules", setupModules)
|
|
||||||
step("network", setupNetworking)
|
|
||||||
step("lvm", setupLVM)
|
|
||||||
}
|
|
||||||
|
|
||||||
func setupModules() {
|
|
||||||
for _, mod := range sys.Config().Modules {
|
|
||||||
log.Print("loading module ", mod)
|
|
||||||
sys.Run("modprobe", mod)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
package initboot
|
|
||||||
|
|
||||||
import (
|
|
||||||
"log"
|
|
||||||
"strconv"
|
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"novit.nc/direktil/inits/pkg/apply"
|
|
||||||
"novit.nc/direktil/inits/pkg/sys"
|
|
||||||
)
|
|
||||||
|
|
||||||
func setupFiles() {
|
|
||||||
cfg := sys.Config()
|
|
||||||
|
|
||||||
// make root rshared (default in systemd, required by Kubernetes 1.10+)
|
|
||||||
// equivalent to "mount --make-rshared /"
|
|
||||||
// see kernel's Documentation/sharedsubtree.txt (search rshared)
|
|
||||||
if err := syscall.Mount("", "/", "", syscall.MS_SHARED|syscall.MS_REC, ""); err != nil {
|
|
||||||
log.Fatalf("FATAL: mount --make-rshared / failed: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// - setup root user
|
|
||||||
if passwordHash := cfg.RootUser.PasswordHash; passwordHash == "" {
|
|
||||||
sys.MustRun("/usr/bin/passwd", "-d", "root")
|
|
||||||
} else {
|
|
||||||
sys.MustRun("/bin/sh", "-c", "chpasswd --encrypted <<EOF\nroot:"+passwordHash+"\nEOF")
|
|
||||||
}
|
|
||||||
|
|
||||||
// - groups
|
|
||||||
for _, group := range cfg.Groups {
|
|
||||||
opts := make([]string, 0)
|
|
||||||
opts = append(opts, "-r")
|
|
||||||
if group.Gid != 0 {
|
|
||||||
opts = append(opts, "-g", strconv.Itoa(group.Gid))
|
|
||||||
}
|
|
||||||
opts = append(opts, group.Name)
|
|
||||||
|
|
||||||
sys.MustRun("groupadd", opts...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// - user
|
|
||||||
for _, user := range cfg.Users {
|
|
||||||
opts := make([]string, 0)
|
|
||||||
opts = append(opts, "-r")
|
|
||||||
if user.Gid != 0 {
|
|
||||||
opts = append(opts, "-g", strconv.Itoa(user.Gid))
|
|
||||||
}
|
|
||||||
if user.Uid != 0 {
|
|
||||||
opts = append(opts, "-u", strconv.Itoa(user.Uid))
|
|
||||||
}
|
|
||||||
opts = append(opts, user.Name)
|
|
||||||
|
|
||||||
sys.MustRun("useradd", opts...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// - files
|
|
||||||
if err := apply.Files(cfg); err != nil {
|
|
||||||
log.Fatal("FATAL: ", err)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,186 +0,0 @@
|
|||||||
package initboot
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
"syscall"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"novit.nc/direktil/pkg/config"
|
|
||||||
|
|
||||||
"novit.nc/direktil/inits/pkg/sys"
|
|
||||||
"novit.nc/direktil/inits/pkg/vars"
|
|
||||||
)
|
|
||||||
|
|
||||||
func setupLVM() {
|
|
||||||
if !dmInProc() {
|
|
||||||
sys.MustRun("modprobe", "dm-mod")
|
|
||||||
}
|
|
||||||
|
|
||||||
// start lvmetad
|
|
||||||
sys.Mkdir("/run/lvm", 0700)
|
|
||||||
sys.Mkdir("/run/lock/lvm", 0700)
|
|
||||||
sys.Run("lvmetad")
|
|
||||||
|
|
||||||
sys.WaitFile("/run/lvm/lvmetad.socket", time.After(30*time.Second))
|
|
||||||
|
|
||||||
// scan devices
|
|
||||||
sys.Run("lvm", "pvscan")
|
|
||||||
sys.Run("lvm", "vgscan", "--mknodes")
|
|
||||||
sys.Run("lvm", "vgchange", "--sysinit", "-a", "ly")
|
|
||||||
|
|
||||||
cfg := sys.Config()
|
|
||||||
|
|
||||||
// setup storage
|
|
||||||
log.Print("checking storage")
|
|
||||||
if err := exec.Command("vgdisplay", "storage").Run(); err != nil {
|
|
||||||
log.Print("- creating VG storage")
|
|
||||||
setupVG(vars.BootArgValue("storage", cfg.Storage.UdevMatch))
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, name := range cfg.Storage.RemoveVolumes {
|
|
||||||
dev := "/dev/storage/" + name
|
|
||||||
|
|
||||||
if _, err := os.Stat(dev); os.IsNotExist(err) {
|
|
||||||
continue
|
|
||||||
|
|
||||||
} else if err != nil {
|
|
||||||
log.Fatal("failed to stat ", dev, ": ", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Print("- removing LV ", name)
|
|
||||||
cmd := exec.Command("lvremove", "-f", "storage/"+name)
|
|
||||||
cmd.Stderr = os.Stderr
|
|
||||||
if err := cmd.Run(); err != nil {
|
|
||||||
log.Fatal("failed to remove LV ", name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// setup volumes
|
|
||||||
for _, volume := range cfg.Storage.Volumes {
|
|
||||||
if err := exec.Command("lvdisplay", "storage/"+volume.Name).Run(); err != nil {
|
|
||||||
log.Print("- creating LV ", volume.Name)
|
|
||||||
setupLV(volume)
|
|
||||||
}
|
|
||||||
|
|
||||||
dev := "/dev/storage/" + volume.Name
|
|
||||||
|
|
||||||
sys.WaitFile(dev, time.After(30*time.Second))
|
|
||||||
|
|
||||||
log.Printf("checking filesystem on %s", dev)
|
|
||||||
sys.MustRun("fsck", "-p", dev)
|
|
||||||
|
|
||||||
sys.Mount(dev, volume.Mount.Path, volume.FS,
|
|
||||||
syscall.MS_NOATIME|syscall.MS_RELATIME,
|
|
||||||
volume.Mount.Options)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func dmInProc() bool {
|
|
||||||
for _, f := range []string{"devices", "misc"} {
|
|
||||||
c, err := ioutil.ReadFile("/proc/" + f)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("failed to read %s: %v", f, err)
|
|
||||||
}
|
|
||||||
if !bytes.Contains(c, []byte("device-mapper")) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func setupVG(udevMatch string) {
|
|
||||||
const pDevName = "DEVNAME="
|
|
||||||
|
|
||||||
dev := ""
|
|
||||||
try := 0
|
|
||||||
|
|
||||||
retry:
|
|
||||||
paths, err := filepath.Glob("/sys/class/block/*")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal("failed to list block devices: ", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, path := range paths {
|
|
||||||
// ignore loop devices
|
|
||||||
if strings.HasPrefix("loop", filepath.Base(path)) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// fetch udev informations
|
|
||||||
out, err := exec.Command("udevadm", "info", "-q", "property", path).CombinedOutput()
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("WARNING: udev query of %q failed: %v\n%s", path, err, string(out))
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
propertyLines := strings.Split(strings.TrimSpace(string(out)), "\n")
|
|
||||||
|
|
||||||
devPath := ""
|
|
||||||
matches := false
|
|
||||||
|
|
||||||
for _, line := range propertyLines {
|
|
||||||
if strings.HasPrefix(line, pDevName) {
|
|
||||||
devPath = line[len(pDevName):]
|
|
||||||
}
|
|
||||||
|
|
||||||
if matched, err := filepath.Match(udevMatch, line); err != nil {
|
|
||||||
log.Fatalf("FATAL: invalid match: %q: %v", udevMatch, err)
|
|
||||||
|
|
||||||
} else if matched {
|
|
||||||
matches = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if devPath != "" && matches {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if devPath != "" && matches {
|
|
||||||
dev = devPath
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if dev == "" {
|
|
||||||
time.Sleep(1 * time.Second)
|
|
||||||
try++
|
|
||||||
if try > 30 {
|
|
||||||
log.Fatal("FATAL: storage device not found after 30s: ", udevMatch)
|
|
||||||
}
|
|
||||||
goto retry
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Print("found storage device at ", dev)
|
|
||||||
|
|
||||||
sys.MustRun("pvcreate", dev)
|
|
||||||
sys.MustRun("vgcreate", "storage", dev)
|
|
||||||
}
|
|
||||||
|
|
||||||
func setupLV(volume config.VolumeDef) {
|
|
||||||
if volume.Extents != "" {
|
|
||||||
sys.MustRun("lvcreate", "-l", volume.Extents, "-n", volume.Name, "storage")
|
|
||||||
} else {
|
|
||||||
sys.MustRun("lvcreate", "-L", volume.Size, "-n", volume.Name, "storage")
|
|
||||||
}
|
|
||||||
|
|
||||||
// wait the device link
|
|
||||||
devPath := "/dev/storage/" + volume.Name
|
|
||||||
sys.WaitFile(devPath, time.After(30*time.Second))
|
|
||||||
|
|
||||||
args := make([]string, 0)
|
|
||||||
|
|
||||||
switch volume.FS {
|
|
||||||
case "btrfs":
|
|
||||||
args = append(args, "-f")
|
|
||||||
case "ext4":
|
|
||||||
args = append(args, "-F")
|
|
||||||
}
|
|
||||||
|
|
||||||
sys.MustRun("mkfs."+volume.FS, append(args, devPath)...)
|
|
||||||
}
|
|
@ -1,156 +0,0 @@
|
|||||||
package initboot
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"net"
|
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
"path/filepath"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/go-ping/ping"
|
|
||||||
"novit.nc/direktil/pkg/config"
|
|
||||||
|
|
||||||
"novit.nc/direktil/inits/pkg/sys"
|
|
||||||
"novit.nc/direktil/inits/pkg/vars"
|
|
||||||
)
|
|
||||||
|
|
||||||
var networkStarted = map[string]bool{}
|
|
||||||
|
|
||||||
func setupNetworking() {
|
|
||||||
cfg := sys.Config()
|
|
||||||
for idx, network := range cfg.Networks {
|
|
||||||
step(fmt.Sprintf("network:%d", idx), func() { setupNetwork(idx, network) })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func setupNetwork(idx int, network config.NetworkDef) {
|
|
||||||
tries := 0
|
|
||||||
retry:
|
|
||||||
ifaces, err := net.Interfaces()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("FATAL: failed to get network interfaces: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
match := false
|
|
||||||
for _, iface := range ifaces {
|
|
||||||
if networkStarted[iface.Name] {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if network.Match.Name != "" {
|
|
||||||
if ok, err := filepath.Match(network.Match.Name, iface.Name); err != nil {
|
|
||||||
log.Fatalf("FATAL: network[%d] name match error: %v", idx, err)
|
|
||||||
} else if !ok {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if network.Match.Ping != nil {
|
|
||||||
log.Printf("network[%d] ping check on %s", idx, iface.Name)
|
|
||||||
|
|
||||||
if ok, err := networkPingCheck(iface.Name, network); err != nil {
|
|
||||||
log.Printf("ERROR: network[%d] ping check failed: %v", idx, err)
|
|
||||||
|
|
||||||
} else if !ok {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Printf("network[%d] matches interface %s", idx, iface.Name)
|
|
||||||
match = true
|
|
||||||
|
|
||||||
startNetwork(iface.Name, idx, network)
|
|
||||||
|
|
||||||
if !network.Match.All {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !match {
|
|
||||||
log.Printf("WARNING: network[%d] did not match any interface", idx)
|
|
||||||
|
|
||||||
tries++
|
|
||||||
if network.Optional && tries > 3 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
time.Sleep(1 * time.Second)
|
|
||||||
log.Printf("WARNING: network[%d] retrying (try: %d)", idx, tries)
|
|
||||||
goto retry
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func startNetwork(ifaceName string, idx int, network config.NetworkDef) {
|
|
||||||
cfg := sys.Config()
|
|
||||||
|
|
||||||
log.Printf("starting network[%d]", idx)
|
|
||||||
|
|
||||||
script := vars.Substitute([]byte(network.Script), cfg)
|
|
||||||
|
|
||||||
c := exec.Command("/bin/sh")
|
|
||||||
c.Stdin = bytes.NewBuffer(script)
|
|
||||||
c.Stdout = os.Stdout
|
|
||||||
c.Stderr = os.Stderr
|
|
||||||
|
|
||||||
// TODO doc
|
|
||||||
c.Env = append(append(make([]string, 0), os.Environ()...), "IFNAME="+ifaceName)
|
|
||||||
|
|
||||||
if err := c.Run(); err != nil {
|
|
||||||
links, _ := exec.Command("ip", "link", "ls").CombinedOutput()
|
|
||||||
log.Fatalf("FATAL: network setup failed (link list below): %v\n%s", err, string(links))
|
|
||||||
}
|
|
||||||
|
|
||||||
networkStarted[ifaceName] = true
|
|
||||||
}
|
|
||||||
|
|
||||||
func networkPingCheck(ifName string, network config.NetworkDef) (b bool, err error) {
|
|
||||||
check := network.Match.Ping
|
|
||||||
|
|
||||||
source := string(vars.Substitute([]byte(check.Source), sys.Config()))
|
|
||||||
|
|
||||||
if err = sys.Run("ip", "addr", "add", source, "dev", ifName); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err = sys.Run("ip", "link", "set", ifName, "up"); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
defer func() {
|
|
||||||
sys.MustRun("ip", "link", "set", ifName, "down")
|
|
||||||
sys.MustRun("ip", "addr", "del", source, "dev", ifName)
|
|
||||||
}()
|
|
||||||
|
|
||||||
count := 3
|
|
||||||
if check.Count != 0 {
|
|
||||||
count = check.Count
|
|
||||||
}
|
|
||||||
|
|
||||||
for n := 0; n < count; n++ {
|
|
||||||
// TODO probably better to use golang.org/x/net/icmp directly
|
|
||||||
pinger, e := ping.NewPinger(network.Match.Ping.Target)
|
|
||||||
if e != nil {
|
|
||||||
err = e
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
pinger.Count = 1
|
|
||||||
|
|
||||||
pinger.Timeout = 1 * time.Second
|
|
||||||
if check.Timeout > 0 {
|
|
||||||
pinger.Timeout = time.Duration(check.Timeout) * time.Second
|
|
||||||
}
|
|
||||||
|
|
||||||
pinger.SetPrivileged(true)
|
|
||||||
pinger.Run()
|
|
||||||
|
|
||||||
if pinger.Statistics().PacketsRecv > 0 {
|
|
||||||
b = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package initboot
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
)
|
|
||||||
|
|
||||||
var stateFile = "/run/dkl-boot.state"
|
|
||||||
|
|
||||||
func readState() (state map[string]bool) {
|
|
||||||
state = map[string]bool{}
|
|
||||||
|
|
||||||
ba, err := ioutil.ReadFile(stateFile)
|
|
||||||
if err != nil {
|
|
||||||
if os.IsNotExist(err) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log.Fatal("failed to read state: ", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = json.Unmarshal(ba, &state)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal("failed to parse state: ", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func writeState(state map[string]bool) {
|
|
||||||
ba, err := json.Marshal(state)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal("failed to serialize state: ", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
ioutil.WriteFile(stateFile, ba, 0600)
|
|
||||||
}
|
|
||||||
|
|
||||||
func step(step string, operation func()) {
|
|
||||||
state := readState()
|
|
||||||
if !state[step] {
|
|
||||||
operation()
|
|
||||||
|
|
||||||
state[step] = true
|
|
||||||
writeState(state)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package initdefault
|
|
||||||
|
|
||||||
import "github.com/spf13/cobra"
|
|
||||||
|
|
||||||
func Command() (c *cobra.Command) {
|
|
||||||
c = &cobra.Command{
|
|
||||||
Use: "default",
|
|
||||||
Short: "default stage",
|
|
||||||
Run: run,
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func run(c *cobra.Command, args []string) {
|
|
||||||
}
|
|
@ -6,9 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
initboot "novit.nc/direktil/inits/pkg/cmd/init/boot"
|
initservice "novit.tech/direktil/inits/pkg/cmd/init/service"
|
||||||
initdefault "novit.nc/direktil/inits/pkg/cmd/init/default"
|
|
||||||
initservice "novit.nc/direktil/inits/pkg/cmd/init/service"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func Command() (c *cobra.Command) {
|
func Command() (c *cobra.Command) {
|
||||||
@ -26,8 +24,6 @@ func Command() (c *cobra.Command) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
c.AddCommand(initboot.Command())
|
|
||||||
c.AddCommand(initdefault.Command())
|
|
||||||
c.AddCommand(initservice.Command())
|
c.AddCommand(initservice.Command())
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -3,12 +3,13 @@ package initservices
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
plog "novit.nc/direktil/pkg/log"
|
plog "novit.tech/direktil/pkg/log"
|
||||||
|
|
||||||
|
cmdlogger "novit.tech/direktil/inits/pkg/cmd/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -58,18 +59,13 @@ func run(c *cobra.Command, args []string) {
|
|||||||
|
|
||||||
func runService(svcPath string) {
|
func runService(svcPath string) {
|
||||||
svc := filepath.Base(svcPath)
|
svc := filepath.Base(svcPath)
|
||||||
|
|
||||||
logger := plog.Get(svc)
|
logger := plog.Get(svc)
|
||||||
plog.EnableFiles()
|
|
||||||
|
|
||||||
n := 0
|
n := 0
|
||||||
for {
|
for {
|
||||||
lastStart := time.Now()
|
lastStart := time.Now()
|
||||||
|
|
||||||
cmd := exec.Command(svcPath)
|
err := cmdlogger.Run("", svcPath)
|
||||||
cmd.Stdout = logger
|
|
||||||
cmd.Stderr = logger
|
|
||||||
err := cmd.Run()
|
|
||||||
|
|
||||||
if time.Since(lastStart) > crashForgiveDelay {
|
if time.Since(lastStart) > crashForgiveDelay {
|
||||||
n = 0
|
n = 0
|
||||||
|
49
pkg/cmd/logger/logger.go
Normal file
49
pkg/cmd/logger/logger.go
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
package cmdlogger
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
plog "novit.tech/direktil/pkg/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Command() (c *cobra.Command) {
|
||||||
|
c = &cobra.Command{
|
||||||
|
Use: "logger [--] <command> [args]",
|
||||||
|
Short: "run a command through the dkl logger",
|
||||||
|
Args: cobra.MinimumNArgs(1),
|
||||||
|
Run: run,
|
||||||
|
}
|
||||||
|
c.Flags().StringP("name", "n", "", "log name")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func run(c *cobra.Command, args []string) {
|
||||||
|
logName, _ := c.Flags().GetString("name")
|
||||||
|
err := Run(logName, args[0], args[1:]...)
|
||||||
|
if err == nil {
|
||||||
|
os.Exit(0)
|
||||||
|
} else if exitErr, ok := err.(*exec.ExitError); ok {
|
||||||
|
os.Exit(exitErr.ExitCode())
|
||||||
|
} else {
|
||||||
|
fmt.Fprintln(os.Stderr, "failed to run command: "+err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Run(logName, command string, args ...string) (err error) {
|
||||||
|
if logName == "" {
|
||||||
|
logName = filepath.Base(command)
|
||||||
|
}
|
||||||
|
|
||||||
|
logger := plog.Get(logName)
|
||||||
|
plog.EnableFiles()
|
||||||
|
|
||||||
|
cmd := exec.Command(command, args...)
|
||||||
|
cmd.Stdout = logger
|
||||||
|
cmd.Stderr = logger
|
||||||
|
return cmd.Run()
|
||||||
|
}
|
@ -4,7 +4,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"novit.nc/direktil/pkg/config"
|
"novit.tech/direktil/pkg/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
const cfgPath = "/config.yaml"
|
const cfgPath = "/config.yaml"
|
||||||
|
@ -3,7 +3,7 @@ package vars
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
"novit.nc/direktil/pkg/config"
|
"novit.tech/direktil/pkg/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Var struct {
|
type Var struct {
|
||||||
|
Reference in New Issue
Block a user