mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 06:07:57 +00:00
Make sure that the command socket exists and is a socket.
This handles the case of running an updated supervisor on an old image which doesn't support host commands - printing out a nice message and waiting rather than exiting silently.
This commit is contained in:
parent
33441c74e7
commit
a9672bd5af
@ -3,10 +3,16 @@ SOCKET_NAME=test-${1}-${2}-${3}
|
||||
HOST_DATA_PATH=/resin-data/resin-supervisor
|
||||
HOST_SOCKET=${HOST_DATA_PATH}/${SOCKET_NAME}
|
||||
SUPERVISOR_SOCKET_PATH=/data
|
||||
COMMAND_SOCKET=${SUPERVISOR_SOCKET_PATH}/host
|
||||
|
||||
echo "
|
||||
rm -f ${HOST_SOCKET}
|
||||
socat UNIX-LISTEN:${HOST_SOCKET} EXEC:'${HOST_DATA_PATH}/enter.sh ${1}',pty,setsid,setpgid,stderr,ctty &
|
||||
exit
|
||||
" | socat UNIX:${SUPERVISOR_SOCKET_PATH}/host - >& /dev/null
|
||||
socat UNIX:${SUPERVISOR_SOCKET_PATH}/${SOCKET_NAME} -,raw,echo=0
|
||||
if [ ! -S ${COMMAND_SOCKET} ]; then
|
||||
echo 'TTY mode not supported on this image, please update.'
|
||||
sleep infinity
|
||||
else
|
||||
echo "
|
||||
rm -f ${HOST_SOCKET}
|
||||
socat UNIX-LISTEN:${HOST_SOCKET} EXEC:'${HOST_DATA_PATH}/enter.sh ${1}',pty,setsid,setpgid,stderr,ctty &
|
||||
exit
|
||||
" | socat UNIX:${COMMAND_SOCKET} - >& /dev/null
|
||||
socat UNIX:${SUPERVISOR_SOCKET_PATH}/${SOCKET_NAME} -,raw,echo=0
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user