2013-02-27 05:29:27 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2015-07-31 00:29:09 +02:00
|
|
|
if ! echo $PATH | grep -q sbin; then
|
|
|
|
PATH=$PATH:/sbin:/usr/sbin
|
|
|
|
fi
|
|
|
|
|
2013-02-27 05:29:27 +01:00
|
|
|
FILENAME=$1
|
|
|
|
ROOT_SIZE=$2
|
|
|
|
SWAP_SIZE=$[ 1024 ]
|
|
|
|
|
|
|
|
if [ -z "$ROOT_SIZE" -o -z "$FILENAME" ]; then
|
|
|
|
echo "Usage: $0 <filename> <root.img size in MB>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -e "$FILENAME" ]; then
|
|
|
|
echo "$FILENAME already exists, not overriding"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-08-07 16:07:30 +02:00
|
|
|
umask 002
|
2013-02-27 05:29:27 +01:00
|
|
|
TOTAL_SIZE=$[ $ROOT_SIZE + $SWAP_SIZE + 512 ]
|
|
|
|
truncate -s ${TOTAL_SIZE}M "$FILENAME"
|