Compare commits
4 Commits
f50101ac97
...
2371abc9fd
Author | SHA1 | Date | |
---|---|---|---|
2371abc9fd | |||
fb60f838bc | |||
43a13664f2 | |||
258fa0a275 |
4
Makefile
4
Makefile
@ -15,7 +15,7 @@ GOARM ?=
|
|||||||
|
|
||||||
BUILD_DIR = ./.build
|
BUILD_DIR = ./.build
|
||||||
PKG_DIR = $(BUILD_DIR)/$(ARCH)
|
PKG_DIR = $(BUILD_DIR)/$(ARCH)
|
||||||
BIN_DIR = $(PKG_DIR)/data/opt/usr/bin
|
BIN_DIR = $(PKG_DIR)/data/opt/bin
|
||||||
PARAMS = -v -a -trimpath -ldflags="-X 'kvas2/constant.Version=$(VERSION)' -X 'kvas2/constant.Commit=$(COMMIT)' -w -s"
|
PARAMS = -v -a -trimpath -ldflags="-X 'kvas2/constant.Version=$(VERSION)' -X 'kvas2/constant.Commit=$(COMMIT)' -w -s"
|
||||||
|
|
||||||
all: build_daemon package
|
all: build_daemon package
|
||||||
@ -31,7 +31,7 @@ package:
|
|||||||
@echo 'Architecture: $(ARCH)' >> $(PKG_DIR)/control/control
|
@echo 'Architecture: $(ARCH)' >> $(PKG_DIR)/control/control
|
||||||
@echo 'Maintainer: $(APP_MAINTAINER)' >> $(PKG_DIR)/control/control
|
@echo 'Maintainer: $(APP_MAINTAINER)' >> $(PKG_DIR)/control/control
|
||||||
@echo 'Description: $(APP_DESCRIPTION)' >> $(PKG_DIR)/control/control
|
@echo 'Description: $(APP_DESCRIPTION)' >> $(PKG_DIR)/control/control
|
||||||
@echo 'Section: base' >> $(PKG_DIR)/control/control
|
@echo 'Section: net' >> $(PKG_DIR)/control/control
|
||||||
@echo 'Priority: optional' >> $(PKG_DIR)/control/control
|
@echo 'Priority: optional' >> $(PKG_DIR)/control/control
|
||||||
@echo 'Depends: libc, iptables, socat' >> $(PKG_DIR)/control/control
|
@echo 'Depends: libc, iptables, socat' >> $(PKG_DIR)/control/control
|
||||||
@mkdir -p $(PKG_DIR)/data/opt/usr/bin
|
@mkdir -p $(PKG_DIR)/data/opt/usr/bin
|
||||||
|
@ -86,6 +86,15 @@ func (g *Group) Disable() []error {
|
|||||||
return errs
|
return errs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *Group) Destroy() []error {
|
||||||
|
errs := g.Disable()
|
||||||
|
err := g.ipset.Destroy()
|
||||||
|
if err != nil {
|
||||||
|
errs = append(errs, err)
|
||||||
|
}
|
||||||
|
return errs
|
||||||
|
}
|
||||||
|
|
||||||
func (g *Group) Sync(records *records.Records) error {
|
func (g *Group) Sync(records *records.Records) error {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
|
2
kvas2.go
2
kvas2.go
@ -164,7 +164,7 @@ func (a *App) start(ctx context.Context) (err error) {
|
|||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
for _, group := range a.Groups {
|
for _, group := range a.Groups {
|
||||||
_ = group.Disable()
|
_ = group.Destroy()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
10
opt/etc/init.d/S99kvas2
Normal file
10
opt/etc/init.d/S99kvas2
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
ENABLED=yes
|
||||||
|
PROCS=kvas2d
|
||||||
|
ARGS=""
|
||||||
|
PREARGS=""
|
||||||
|
DESC=$PROCS
|
||||||
|
PATH=/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
|
|
||||||
|
. /opt/etc/init.d/rc.func
|
Loading…
x
Reference in New Issue
Block a user