1
0
mirror of https://git.openwrt.org/feed/packages.git synced 2024-06-29 12:24:17 +02:00
openwrt-packages/net/ibrdtnd/files/mkcontainer.sh
Johannes Morgenroth 02f1617c00 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>
2014-08-20 12:44:14 +02:00

44 lines
963 B
Bash

#!/bin/sh
#
# This script creates a bundle storage of a given size.
#
# $1 = container file
# $2 = size of the container in MB
#
help_message() {
echo "usage: "
echo " $0 <container file> <size in MB>"
}
if [ $# -le 1 ]; then
help_message
exit 1
fi
CONTAINER=$(cd "$(dirname "$1")"; pwd)/$(basename $1)
SIZE=$2
# check if the container already exists
if [ -f $CONTAINER ]; then
echo "Aborted! The specified container already exists."
exit 1
fi
# create the container
echo -n "creating the container file..."
/bin/dd if=/dev/zero of=$CONTAINER bs=1M count=$SIZE >/dev/null 2>/dev/null
echo " done"
# create file system
echo -n "initializing ext3 filesystem for the container..."
/usr/sbin/mkfs.ext3 -q -F $CONTAINER > /dev/null
echo " done"
# final hint
echo "The container is now ready. To use it with IBR-DTN set the container with:"
echo "# uci set ibrdtn.storage.container=$CONTAINER"
echo "# uci set ibrdtn.storage.container_size=$SIZE"
exit 0