mirror of
https://github.com/linuxkit/linuxkit.git
synced 2026-05-15 07:45:41 +00:00
58 lines
1.2 KiB
Plaintext
Executable File
58 lines
1.2 KiB
Plaintext
Executable File
#!/sbin/openrc-run
|
|
|
|
description="vsock socket proxy client"
|
|
|
|
depend()
|
|
{
|
|
need bootmisc
|
|
}
|
|
|
|
start()
|
|
{
|
|
[ "$(mobyplatform)" != "mac" ] && [ "$(mobyplatform)" != "windows" ] && exit 0
|
|
|
|
ebegin "Starting vsock proxy"
|
|
|
|
if [ "$(mobyplatform)" = "windows" ]; then
|
|
DOCKER_PORT=23a432c2-537a-4291-bcb5-d62504644739
|
|
SYSLOG_PORT="" #TBD
|
|
else
|
|
DOCKER_PORT=2376
|
|
SYSLOG_PORT=514
|
|
fi
|
|
|
|
[ -n "${PIDFILE}" ] || PIDFILE=/var/run/vsudd.pid
|
|
|
|
if [ -n "$SYSLOG_PORT" ] ; then
|
|
# Can be inlined below once Windows defines syslog port
|
|
SYSLOG_SOCK=/var/run/syslog.vsock
|
|
SYSLOG_OPT="-syslog ${SYSLOG_PORT}:${SYSLOG_SOCK}"
|
|
fi
|
|
|
|
start-stop-daemon --start --quiet \
|
|
--background \
|
|
--exec /sbin/vsudd \
|
|
--stdout /dev/console \
|
|
--stderr /dev/console \
|
|
-- -inport "${DOCKER_PORT}:unix:/var/run/docker.sock" \
|
|
${SYSLOG_OPT} \
|
|
-pidfile ${PIDFILE}
|
|
|
|
ewaitfile 10 ${SYSLOG_SOCK} ${PIDFILE}
|
|
|
|
eend $? "Failed to start vsudd"
|
|
}
|
|
|
|
stop()
|
|
{
|
|
[ "$(mobyplatform)" != "mac" ] && [ "$(mobyplatform)" != "windows" ] && exit 0
|
|
|
|
ebegin "Stopping docker socket passthrough"
|
|
|
|
[ -n "${PIDFILE}" ] || PIDFILE=/var/run/vsudd.pid
|
|
|
|
start-stop-daemon --stop --quiet --pidfile ${PIDFILE}
|
|
|
|
eend $? "Failed to stop vsudd"
|
|
}
|