Commit a461eafa authored by Martin Roukala's avatar Martin Roukala
Browse files

initscript: factor out the partition-formating code

It will be used in a third place soon :)
parent ac819e46
......@@ -95,13 +95,18 @@ function find_container_partition {
fi
}
function format_cache_partition {
log "Formating the partition $CONTAINER_PART_DEV"
mkfs.ext4 -F -L "$CACHE_PARTITION_LABEL" "$CONTAINER_PART_DEV"
}
function format_disk {
if [ -n "$1" ]; then
parted --script $1 mklabel gpt
parted --script $1 mkpart primary ext4 2048s 100%
CONTAINER_PART_DEV=`lsblk -no PATH $1 | tail -n -1`
mkfs.ext4 -F -L "$CACHE_PARTITION_LABEL" "$CONTAINER_PART_DEV"
format_cache_partition
return $?
fi
......@@ -149,8 +154,7 @@ function try_to_use_cache_device {
part)
CONTAINER_PART_DEV="$path"
if [ -z "$label" ]; then
log "Formating the partition $CONTAINER_PART_DEV"
mkfs.ext4 -F -L "$CACHE_PARTITION_LABEL" "$CONTAINER_PART_DEV"
format_cache_partition
return $?
fi
;;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment