new initrd with diagnostics

Signed-off-by: Justin Cormack <justin.cormack@unikernel.com>
This commit is contained in:
Justin Cormack 2015-12-21 10:57:30 +00:00
parent 9276dc01fd
commit d5b9f7ec1d
3 changed files with 35 additions and 0 deletions

View File

@ -24,6 +24,8 @@ COPY packages/mdnstool/mdnstool /sbin/
COPY packages/mdnstool/etc /etc/
COPY packages/docker/docker /usr/bin/
COPY packages/docker/etc /etc/
COPY packages/diagnostics/diagnostics /usr/bin/
COPY packages/diagnostics/etc /etc/
RUN \
setup-timezone -z UTC && \
@ -54,6 +56,7 @@ RUN \
rc-update add 9pudc default && \
rc-update add mdnstool default && \
rc-update add automount boot && \
rc-update add diagnostics default && \
ln -s /bin/busybox /init
CMD ["/bin/sh"]

View File

@ -0,0 +1,19 @@
#!/bin/sh
printf '\n'
DEV=$(ls /dev | grep '[sxv]da$')
[ $? -eq 0 ] && printf "✓ Drive found: $DEV\n" || printf "✗ No drive found\n"
DEV=$(mount | grep '/dev/[sxv]da. on /var type')
[ $? -eq 0 ] && printf "✓ Drive mounted: $DEV\n" || printf "✗ No drive mounted\n"
INET=$(ifconfig eth0 2> /dev/null | grep 'inet addr')
[ $? -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"
MDNS=$(ps -eo args | grep '^/sbin/mdnstool')
[ $? -eq 0 ] && printf "✓ Process mdnstool running: $MDNS\n" || printf "✗ No mdnstool process\n"
DOCKER=$(ps -eo args | grep '^/usr/bin/docker')
[ $? -eq 0 ] && printf "✓ Process docker running: $DOCKER\n" || printf "✗ No docker process\n"
DOCKERPS=$(docker ps 2>&1)
[ $? -eq 0 ] && printf "✓ Docker daemon working\n" || printf "✗ Docker ps failed: $DOCKERPS\n"
exit 0

View File

@ -0,0 +1,13 @@
#!/sbin/openrc-run
depend()
{
after docker
}
start()
{
ebegin "Checking system state"
/usr/bin/diagnostics
}