core-admin/linux/aux-tools/prepare-volatile-img.sh
HW42 09b49feea6
prepare-volatile-img.sh: don't run as root
This is no longer necessary since volatile.img is formated inside the
VM. This also fixes DispVM creation if the user sets a restrictive umask
for root. Maybe related to #2200.
2016-08-07 00:41:59 +02:00

25 lines
418 B
Bash
Executable File

#!/bin/sh
set -e
if ! echo $PATH | grep -q sbin; then
PATH=$PATH:/sbin:/usr/sbin
fi
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
TOTAL_SIZE=$[ $ROOT_SIZE + $SWAP_SIZE + 512 ]
truncate -s ${TOTAL_SIZE}M "$FILENAME"