core-admin/linux/aux-tools/prepare-volatile-img.sh
Marek Marczykowski-Górecki 2908992741
prepare-volatile-img.sh: create volatile.img group accessible
Otherwise qvm-create-default-dvm may fail to include it in
saved-cows.tar, which will lead to DispVM being not really disposable.

Fixes QubesOS/qubes-issues#2200
2016-08-07 16:07:30 +02:00

26 lines
428 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
umask 002
TOTAL_SIZE=$[ $ROOT_SIZE + $SWAP_SIZE + 512 ]
truncate -s ${TOTAL_SIZE}M "$FILENAME"