mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-24 19:28:09 +00:00
commit
05a519a7b6
@ -56,8 +56,6 @@ COPY packages/ntp15m/etc /etc/
|
||||
COPY packages/binfmt_misc/etc /etc/
|
||||
COPY packages/dnsfix/etc /etc/
|
||||
COPY packages/hostsettings/etc /etc/
|
||||
COPY packages/hupper/hupper /bin/
|
||||
COPY packages/hupper/etc /etc/
|
||||
COPY packages/hvtools/hv_kvp_daemon /sbin/
|
||||
COPY packages/hvtools/hv_vss_daemon /sbin/
|
||||
COPY packages/hvtools/etc /etc/
|
||||
@ -109,7 +107,6 @@ RUN \
|
||||
rc-update add binfmt_misc sysinit && \
|
||||
rc-update add dnsfix boot && \
|
||||
rc-update add hostsettings boot && \
|
||||
rc-update add hupper default && \
|
||||
rc-update add hv_kvp_daemon default && \
|
||||
rc-update add hv_vss_daemon default && \
|
||||
rc-update add vsudd default && \
|
||||
|
@ -3,7 +3,6 @@ all:
|
||||
$(MAKE) -C diagnostics OS=linux
|
||||
$(MAKE) -C transfused OS=linux
|
||||
$(MAKE) -C tap-vsockd OS=linux
|
||||
$(MAKE) -C hupper OS=linux
|
||||
$(MAKE) -C hvtools OS=linux
|
||||
$(MAKE) -C docker OS=Linux
|
||||
$(MAKE) -C nc-vsock OS=linux
|
||||
@ -14,7 +13,6 @@ all:
|
||||
|
||||
arm:
|
||||
$(MAKE) -C transfused OS=linux ARCH=arm
|
||||
$(MAKE) -C hupper OS=linux ARCH=arm
|
||||
$(MAKE) -C docker arm OS=Linux ARCH=arm
|
||||
# Not cross building at present (C code)
|
||||
# $(MAKE) -C tap-vsockd OS=linux ARCH=arm
|
||||
@ -29,7 +27,6 @@ clean:
|
||||
$(MAKE) -C transfused clean
|
||||
$(MAKE) -C tap-vsockd clean
|
||||
$(MAKE) -C docker clean
|
||||
$(MAKE) -C hupper clean
|
||||
$(MAKE) -C hvtools clean
|
||||
$(MAKE) -C nc-vsock clean
|
||||
$(MAKE) -C vsudd clean
|
||||
|
@ -14,8 +14,6 @@ then
|
||||
TAPVS=$(ps -eo args | grep '^/sbin/tap-vsockd')
|
||||
[ $? -eq 0 ] && printf "✓ Process tap-vsockd running\n" || printf "✗ No tap-vsockd process\n"
|
||||
fi
|
||||
HUPPER=$(ps -eo args | grep '^/bin/hupper')
|
||||
[ $? -eq 0 ] && printf "✓ Process hupper running: $HUPPER\n" || printf "✗ No hupper process\n"
|
||||
DOCKER=$(ps -eo args | grep '^/usr/bin/docker')
|
||||
[ $? -eq 0 ] && printf "✓ Process docker running: $DOCKER\n" || printf "✗ No docker process\n"
|
||||
CONTAINERD=$(ps -eo args | grep '^docker-containerd')
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
depend()
|
||||
{
|
||||
after docker hupper
|
||||
after docker
|
||||
}
|
||||
|
||||
start()
|
||||
|
1
alpine/packages/hupper/.gitignore
vendored
1
alpine/packages/hupper/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/hupper
|
@ -1,13 +0,0 @@
|
||||
FROM golang:alpine
|
||||
|
||||
RUN mkdir -p /go/src/hupper
|
||||
WORKDIR /go/src/hupper
|
||||
|
||||
COPY . /go/src/hupper/
|
||||
|
||||
ARG GOARCH
|
||||
ARG GOOS
|
||||
|
||||
RUN go install
|
||||
|
||||
RUN [ -f /go/bin/*/hupper ] && mv /go/bin/*/hupper /go/bin/ || true
|
@ -1,10 +0,0 @@
|
||||
all: hupper
|
||||
|
||||
hupper: Dockerfile main.go
|
||||
docker build --build-arg GOOS=$(OS) --build-arg GOARCH=$(ARCH) -t hupper:build .
|
||||
docker run --rm hupper:build cat /go/bin/hupper > hupper
|
||||
chmod 755 hupper
|
||||
|
||||
clean:
|
||||
rm -f hupper
|
||||
docker images -q hupper:build | xargs docker rmi -f
|
@ -1,41 +0,0 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="docker config update manager"
|
||||
|
||||
depend()
|
||||
{
|
||||
after docker
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
ebegin "Starting docker config update manager"
|
||||
|
||||
PIDFILE=/run/hupper.pid
|
||||
DOCKERPIDFILE=/run/docker.pid
|
||||
WATCH_CONFIG=$(mobyconfig watch /etc/docker/daemon.json)
|
||||
WATCH_PROXY=""
|
||||
PROXY="$(mobyconfig watch proxy)"
|
||||
[ -n "${PROXY}" ] && WATCH_PROXY="-path ${PROXY}"
|
||||
[ -z "${WATCH_CONFIG}" ] && exit 1
|
||||
|
||||
start-stop-daemon --start --quiet \
|
||||
--background \
|
||||
--exec /bin/hupper \
|
||||
--make-pidfile --pidfile ${PIDFILE} \
|
||||
-- -pidfile ${PIDFILE} -huppidfile ${DOCKERPIDFILE} \
|
||||
-path ${WATCH_CONFIG} ${WATCH_PROXY}
|
||||
|
||||
eend $? "Failed to start hupper"
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
ebegin "Stopping docker config update manager"
|
||||
|
||||
PIDFILE=/run/hupper.pid
|
||||
|
||||
start-stop-daemon --stop --quiet --pidfile ${PIDFILE}
|
||||
|
||||
eend $? "Failed to stop hupper"
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"sync"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var (
|
||||
paths stringSlice
|
||||
huppidfile string
|
||||
pidfile string
|
||||
)
|
||||
|
||||
type stringSlice []string
|
||||
|
||||
func (s *stringSlice) String() string {
|
||||
return fmt.Sprintf("%s", *s)
|
||||
}
|
||||
|
||||
func (s *stringSlice) Set(value string) error {
|
||||
*s = append(*s, value)
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
flag.Var(&paths, "path", "paths of the files to watch")
|
||||
flag.StringVar(&huppidfile, "huppidfile", "", "pidfile for process to signal")
|
||||
flag.StringVar(&pidfile, "pidfile", "", "my pidfile")
|
||||
}
|
||||
|
||||
func main() {
|
||||
log.SetFlags(0)
|
||||
flag.Parse()
|
||||
|
||||
if len(paths) < 1 {
|
||||
log.Fatal("watch path not set")
|
||||
}
|
||||
|
||||
if huppidfile == "" {
|
||||
log.Fatal("huppidfile not set")
|
||||
}
|
||||
|
||||
if pidfile != "" {
|
||||
pid := os.Getpid()
|
||||
pidbytes := []byte(strconv.Itoa(pid))
|
||||
_ = ioutil.WriteFile(pidfile, pidbytes, 0644)
|
||||
}
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(paths))
|
||||
|
||||
for _, path := range paths {
|
||||
watch, err := os.Open(path)
|
||||
if err != nil {
|
||||
log.Fatalln("Failed to open file", path, err)
|
||||
}
|
||||
// 43 bytes is the record size of the watch
|
||||
buf := make([]byte, 43)
|
||||
// initial state
|
||||
_, err = watch.Read(buf)
|
||||
if err != nil && err != io.EOF {
|
||||
log.Fatalln("Error reading watch file", err)
|
||||
}
|
||||
|
||||
go func() {
|
||||
for {
|
||||
_, err := watch.Read(buf)
|
||||
if err != nil && err != io.EOF {
|
||||
log.Fatalln("Error reading watch file", err)
|
||||
}
|
||||
if err == io.EOF {
|
||||
continue
|
||||
}
|
||||
// a few changes eg debug do not require a daemon restart
|
||||
// however at present we cannot check changes, and most do
|
||||
restart := true
|
||||
if restart {
|
||||
log.Println("Restarting docker")
|
||||
cmd := exec.Command("service", "docker", "restart")
|
||||
// not much we can do if it does not restart
|
||||
_ = cmd.Run()
|
||||
} else {
|
||||
bytes, err := ioutil.ReadFile(huppidfile)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
pidstring := string(bytes[:])
|
||||
pid, err := strconv.Atoi(pidstring)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
syscall.Kill(pid, syscall.SIGHUP)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
if [ $# -ne 2 ]
|
||||
then
|
||||
printf "usage: $0 [get|exists|watch|path|dir|find] key\n"
|
||||
printf "usage: $0 [get|exists|path|dir|find] key\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@ -84,21 +84,5 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
# might be nicer if watch returned a file descriptor not a path
|
||||
# /Database/branch/master/watch/com.docker.driver.amd64-linux.node/etc.node/docker.node/daemon.json.node/tree.live
|
||||
if [ $1 == "watch" ]
|
||||
then
|
||||
WATCHBASE="/Database/branch/master/watch/${DATABASE}.node"
|
||||
WATCH="${WATCHBASE}/$(echo ${KEY} | sed 's@/@.node/@g').node/tree.live"
|
||||
if [ -f ${WATCH} ]
|
||||
then
|
||||
printf ${WATCH}
|
||||
exit 0
|
||||
else
|
||||
printf "No such watch: ${WATCH}\n" 2>&1
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
printf "usage: $0 [get|exists|watch|path|dir|find] key\n"
|
||||
printf "usage: $0 [get|exists|path|dir|find] key\n"
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user