mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-22 10:31:35 +00:00
remove 9pudc, unused and not being fixed
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
parent
7d11cd267b
commit
6b0b4e05cb
@ -23,8 +23,6 @@ ADD kernel/aufs-utils.tar /
|
|||||||
COPY mkinitrd.sh /bin/
|
COPY mkinitrd.sh /bin/
|
||||||
COPY kernel/kernel-source-info /etc/
|
COPY kernel/kernel-source-info /etc/
|
||||||
|
|
||||||
COPY packages/9pudc/9pudc /sbin/
|
|
||||||
COPY packages/9pudc/etc /etc/
|
|
||||||
COPY packages/proxy/proxy /sbin/
|
COPY packages/proxy/proxy /sbin/
|
||||||
COPY packages/transfused/transfused /sbin/
|
COPY packages/transfused/transfused /sbin/
|
||||||
COPY packages/transfused/etc /etc/
|
COPY packages/transfused/etc /etc/
|
||||||
@ -80,7 +78,6 @@ RUN \
|
|||||||
rc-update add klogd && \
|
rc-update add klogd && \
|
||||||
rc-update add docker default && \
|
rc-update add docker default && \
|
||||||
rc-update add 9pinit boot && \
|
rc-update add 9pinit boot && \
|
||||||
rc-update add 9pudc default && \
|
|
||||||
rc-update add transfused default && \
|
rc-update add transfused default && \
|
||||||
rc-update add mdnstool default && \
|
rc-update add mdnstool default && \
|
||||||
rc-update add automount boot && \
|
rc-update add automount boot && \
|
||||||
|
1
alpine/packages/9pudc/.gitignore
vendored
1
alpine/packages/9pudc/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
/9pudc
|
|
@ -1,13 +0,0 @@
|
|||||||
FROM golang:alpine
|
|
||||||
|
|
||||||
RUN mkdir -p /go/src/9pudc
|
|
||||||
WORKDIR /go/src/9pudc
|
|
||||||
|
|
||||||
COPY . /go/src/9pudc/
|
|
||||||
|
|
||||||
ARG GOARCH
|
|
||||||
ARG GOOS
|
|
||||||
|
|
||||||
RUN go install
|
|
||||||
|
|
||||||
RUN [ -f /go/bin/*/9pudc ] && mv /go/bin/*/9pudc /go/bin/ || true
|
|
@ -1,10 +0,0 @@
|
|||||||
all: 9pudc
|
|
||||||
|
|
||||||
9pudc: Dockerfile main.go
|
|
||||||
docker build --build-arg GOOS=$(OS) --build-arg GOARCH=$(ARCH) -t 9pudc:build .
|
|
||||||
docker run --rm 9pudc:build cat /go/bin/9pudc > 9pudc
|
|
||||||
chmod 755 9pudc
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f 9pudc
|
|
||||||
docker images -q 9pudc:build | xargs docker rmi -f
|
|
@ -1,41 +0,0 @@
|
|||||||
#!/sbin/openrc-run
|
|
||||||
|
|
||||||
description="9p socket proxy client"
|
|
||||||
|
|
||||||
depend()
|
|
||||||
{
|
|
||||||
need 9pinit
|
|
||||||
}
|
|
||||||
|
|
||||||
start()
|
|
||||||
{
|
|
||||||
|
|
||||||
[ -d /Socket ] || exit 0
|
|
||||||
|
|
||||||
ebegin "Starting docker socket passthrough"
|
|
||||||
|
|
||||||
[ -n "${PIDFILE}" ] || PIDFILE=/var/run/9pudc.pid
|
|
||||||
[ -n "${LOGFILE}" ] || LOGFILE=/var/log/9pudc.log
|
|
||||||
|
|
||||||
start-stop-daemon --start --quiet \
|
|
||||||
--background \
|
|
||||||
--exec /sbin/9pudc \
|
|
||||||
--make-pidfile --pidfile ${PIDFILE} \
|
|
||||||
--stderr "${LOGFILE}" --stdout "${LOGFILE}" \
|
|
||||||
-- -path /Socket -sock /var/run/docker.sock
|
|
||||||
|
|
||||||
eend $? "Failed to start 9pudc"
|
|
||||||
}
|
|
||||||
|
|
||||||
stop()
|
|
||||||
{
|
|
||||||
[ -d /Socket ] || exit 0
|
|
||||||
|
|
||||||
ebegin "Stopping docker socket passthrough"
|
|
||||||
|
|
||||||
[ -n "${PIDFILE}" ] || PIDFILE=/var/run/9pudc.pid
|
|
||||||
|
|
||||||
start-stop-daemon --stop --quiet --pidfile ${PIDFILE}
|
|
||||||
|
|
||||||
eend $? "Failed to stop 9pudc"
|
|
||||||
}
|
|
@ -1,142 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"log"
|
|
||||||
"net"
|
|
||||||
"os"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"syscall"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
path string
|
|
||||||
sock string
|
|
||||||
detach bool
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
flag.StringVar(&path, "path", "/9puds", "path of the 9P-mounted Unix domain socket tree")
|
|
||||||
flag.StringVar(&sock, "sock", "/tmp/forwarded.sock", "path of the local Unix domain socket to forward to")
|
|
||||||
flag.BoolVar(&detach, "detach", false, "detach from terminal")
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
log.SetFlags(0)
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
if detach {
|
|
||||||
logFile, err := os.Create("/var/log/9pudc.log")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalln("Failed to open log file", err)
|
|
||||||
}
|
|
||||||
log.SetOutput(logFile)
|
|
||||||
null, err := os.OpenFile("/dev/null", os.O_RDWR, 0)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalln("Failed to open /dev/null", err)
|
|
||||||
}
|
|
||||||
fd := null.Fd()
|
|
||||||
syscall.Dup2(int(fd), int(os.Stdin.Fd()))
|
|
||||||
syscall.Dup2(int(fd), int(os.Stdout.Fd()))
|
|
||||||
syscall.Dup2(int(fd), int(os.Stderr.Fd()))
|
|
||||||
}
|
|
||||||
|
|
||||||
eventsPath := path + "/events"
|
|
||||||
events, err := os.Open(eventsPath)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalln("Failed to open file", eventsPath, err)
|
|
||||||
}
|
|
||||||
// 512 bytes is easily big enough to read a whole connection id
|
|
||||||
buf := make([]byte, 512)
|
|
||||||
for {
|
|
||||||
n, err := events.Read(buf)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalln("Error reading events file", err)
|
|
||||||
}
|
|
||||||
id, err := strconv.Atoi(strings.TrimSpace(string(buf[0:n])))
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalln("Failed to parse integer connection id", err)
|
|
||||||
}
|
|
||||||
go handleOne(id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleOne(id int) {
|
|
||||||
log.Println(id, "handleOne")
|
|
||||||
readPath := fmt.Sprintf("%s/connections/%d/read", path, id)
|
|
||||||
// Remove will cause the server end to close
|
|
||||||
defer func(){
|
|
||||||
log.Println(id, "handleOne closing, removing", readPath)
|
|
||||||
os.Remove(readPath)
|
|
||||||
}()
|
|
||||||
|
|
||||||
read, err := os.Open(readPath)
|
|
||||||
if err != nil {
|
|
||||||
// Fatal because this is a bug in the server implementation
|
|
||||||
log.Fatalln("Failed to open read file", readPath, err)
|
|
||||||
}
|
|
||||||
defer read.Close()
|
|
||||||
|
|
||||||
var conn *net.UnixConn
|
|
||||||
// Cope with the server socket appearing up to 10s later
|
|
||||||
for i := 0; i < 200; i++ {
|
|
||||||
conn, err = net.DialUnix("unix", nil, &net.UnixAddr{sock, "unix"})
|
|
||||||
if err == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
time.Sleep(50 * time.Millisecond)
|
|
||||||
}
|
|
||||||
defer conn.Close()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
// If the forwarding program has broken then close and continue
|
|
||||||
log.Println("Failed to connect to Unix domain socket after 10s", sock, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
w := make(chan int64)
|
|
||||||
go func() {
|
|
||||||
writePath := fmt.Sprintf("%s/connections/%d/write", path, id)
|
|
||||||
write, err := os.OpenFile(writePath, os.O_WRONLY, 0666)
|
|
||||||
if err != nil {
|
|
||||||
// Fatal because this is a bug in the server implementation
|
|
||||||
log.Fatalln("Failed to open write file", writePath, err)
|
|
||||||
}
|
|
||||||
log.Println(id, "copying from", sock, "to", writePath)
|
|
||||||
n, err := io.Copy(write, conn)
|
|
||||||
if err != nil {
|
|
||||||
log.Println("error copying from Unix domain socket to 9P", err)
|
|
||||||
}
|
|
||||||
log.Println(id, "wrote", n, "bytes to", writePath)
|
|
||||||
conn.CloseRead()
|
|
||||||
write.Close()
|
|
||||||
os.Remove(writePath)
|
|
||||||
w <- n
|
|
||||||
}()
|
|
||||||
|
|
||||||
totalRead := int64(0)
|
|
||||||
log.Println(id, "copying from", readPath, "to", sock)
|
|
||||||
for {
|
|
||||||
// EOF is used to signal a chunk/packet of data
|
|
||||||
n, err := io.Copy(conn, read)
|
|
||||||
totalRead = totalRead + n
|
|
||||||
log.Println(id, "copied a packet of size", n, "bytes from stream")
|
|
||||||
if err != nil {
|
|
||||||
log.Println(id, "error copying from stream file to Unix domain socket:", err)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if n == 0 {
|
|
||||||
log.Println(id, "read zero-length chunk from stream file: treating as EOF")
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
conn.CloseWrite();
|
|
||||||
|
|
||||||
log.Println(id, "waiting for writer to close")
|
|
||||||
totalWritten := <-w
|
|
||||||
log.Println(id, "read", totalRead, "written", totalWritten)
|
|
||||||
}
|
|
@ -1,5 +1,4 @@
|
|||||||
all:
|
all:
|
||||||
$(MAKE) -C 9pudc OS=linux
|
|
||||||
$(MAKE) -C proxy OS=linux
|
$(MAKE) -C proxy OS=linux
|
||||||
$(MAKE) -C transfused OS=linux
|
$(MAKE) -C transfused OS=linux
|
||||||
$(MAKE) -C mdnstool OS=linux
|
$(MAKE) -C mdnstool OS=linux
|
||||||
@ -8,7 +7,6 @@ all:
|
|||||||
$(MAKE) -C docker OS=Linux
|
$(MAKE) -C docker OS=Linux
|
||||||
|
|
||||||
arm:
|
arm:
|
||||||
$(MAKE) -C 9pudc OS=linux ARCH=arm
|
|
||||||
$(MAKE) -C proxy OS=linux ARCH=arm
|
$(MAKE) -C proxy OS=linux ARCH=arm
|
||||||
$(MAKE) -C transfused OS=linux ARCH=arm
|
$(MAKE) -C transfused OS=linux ARCH=arm
|
||||||
$(MAKE) -C mdnstool OS=linux ARCH=arm
|
$(MAKE) -C mdnstool OS=linux ARCH=arm
|
||||||
@ -16,7 +14,6 @@ arm:
|
|||||||
$(MAKE) -C docker OS=Linux ARCH=arm
|
$(MAKE) -C docker OS=Linux ARCH=arm
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(MAKE) -C 9pudc clean
|
|
||||||
$(MAKE) -C proxy clean
|
$(MAKE) -C proxy clean
|
||||||
$(MAKE) -C transfused clean
|
$(MAKE) -C transfused clean
|
||||||
$(MAKE) -C mdnstool clean
|
$(MAKE) -C mdnstool clean
|
||||||
|
@ -7,8 +7,6 @@ DEV=$(mount | grep '/dev/[sxv]da. on /var type')
|
|||||||
[ $? -eq 0 ] && printf "✓ Drive mounted: $DEV\n" || printf "✗ No drive mounted\n"
|
[ $? -eq 0 ] && printf "✓ Drive mounted: $DEV\n" || printf "✗ No drive mounted\n"
|
||||||
INET=$(ifconfig eth0 2> /dev/null | grep 'inet addr')
|
INET=$(ifconfig eth0 2> /dev/null | grep 'inet addr')
|
||||||
[ $? -eq 0 ] && printf "✓ Network connected: $INET\n" || printf "✗ No network connection\n"
|
[ $? -eq 0 ] && printf "✓ Network connected: $INET\n" || printf "✗ No network connection\n"
|
||||||
UDC=$(ps -eo args | grep '^/sbin/9pudc')
|
|
||||||
[ $? -eq 0 ] && printf "✓ Process 9pudc running: $UDC\n" || printf "✗ No 9pudc process\n"
|
|
||||||
if [ -d /Transfuse ]
|
if [ -d /Transfuse ]
|
||||||
then
|
then
|
||||||
FUSE=$(ps -eo args | grep '^/sbin/transfused')
|
FUSE=$(ps -eo args | grep '^/sbin/transfused')
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
depend()
|
depend()
|
||||||
{
|
{
|
||||||
after docker mdnstool 9pudc hupper
|
after docker mdnstool hupper
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
depend()
|
depend()
|
||||||
{
|
{
|
||||||
after 9pudc transfused
|
after transfused
|
||||||
before chronyd
|
before chronyd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user