mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 07:28:39 +01:00
ibrdtnd: add new package
This package contains the daemon (dtnd) of IBR-DTN, a modular and lightweight implementation of the bundle protocol (RFC 5050). https://github.com/ibrdtn/ibrdtn Signed-off-by: Johannes Morgenroth <morgenroth@ibr.cs.tu-bs.de>
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
|
||||
check_mounted() {
|
||||
DIR=$1
|
||||
while [ "$DIR" != "/" ]; do
|
||||
if [ -n "`mount | grep "$DIR"`" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
DIR=`dirname $DIR`
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
check_writable() {
|
||||
CHECKFILE="$1/.container-lock"
|
||||
/bin/touch $CHECKFILE
|
||||
|
||||
if [ $? -gt 0 ]; then
|
||||
return 1;
|
||||
fi
|
||||
|
||||
/bin/echo "0123456789" >> $CHECKFILE
|
||||
|
||||
if [ $? -gt 0 ]; then
|
||||
return 2;
|
||||
fi
|
||||
|
||||
/bin/rm $CHECKFILE
|
||||
|
||||
if [ $? -gt 0 ]; then
|
||||
return 3;
|
||||
fi
|
||||
}
|
||||
|
||||
check_mountdev() {
|
||||
# get wait_mount option
|
||||
WAIT_MOUNT_DEV=`uci -q get ibrdtn.safemode.wait_mount`
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
DATA=`mount | grep ${WAIT_MOUNT_DEV}`
|
||||
|
||||
if [ -n "${DATA}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# check the storage device
|
||||
check_mountdev
|
||||
RET=$?
|
||||
|
||||
if [ ${RET} -ne 0 ]; then
|
||||
WAIT_SECONDS=60
|
||||
/usr/bin/logger -t "systemcheck.sh" -p 2 "disk storage not ready, wait max. ${WAIT_SECONDS} seconds until it is mounted"
|
||||
while [ ${RET} -ne 0 ] && [ ${WAIT_SECONDS} -ne 0 ]; do
|
||||
sleep 1
|
||||
let WAIT_SECONDS=WAIT_SECONDS-1
|
||||
check_mountdev
|
||||
RET=$?
|
||||
done
|
||||
fi
|
||||
|
||||
if [ ${RET} -ne 0 ]; then
|
||||
# failed, storage not mounted
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# get the path for the container
|
||||
CONTAINER=`uci -q get ibrdtn.storage.container`
|
||||
|
||||
if [ -z "$CONTAINER" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
CONTAINER_PATH=`dirname $CONTAINER`
|
||||
|
||||
if [ -n "$CONTAINER_PATH" ]; then
|
||||
# check if the container is on a mounted device
|
||||
check_mounted $CONTAINER_PATH
|
||||
|
||||
if [ $? -gt 0 ]; then
|
||||
# failed
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check if the device is writable
|
||||
check_writable $CONTAINER_PATH
|
||||
|
||||
if [ $? -gt 0 ]; then
|
||||
# failed
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user