build_fn: fix image path
This commit is contained in:
parent
bb8a5520ad
commit
1799df1479
|
@ -26,7 +26,7 @@ setup_inet()
|
|||
|
||||
create_image()
|
||||
{
|
||||
name="$(get_image_path "$1")"
|
||||
local name="$(get_image_path "$1")"
|
||||
if [ -z "$2" ]; then
|
||||
size="$DEFAULT_IMAGE_SIZE"
|
||||
else
|
||||
|
@ -41,13 +41,16 @@ create_image()
|
|||
log "Failed to cretae image [$name]" ierror
|
||||
return 1
|
||||
}
|
||||
mkfs.ext4 "$name"
|
||||
log "Creating ext4 fs on $name" internal
|
||||
mkfs.ext4 "$name" || {
|
||||
log "Failed to create new fs" ierror
|
||||
}
|
||||
}
|
||||
|
||||
trim_image()
|
||||
{
|
||||
{
|
||||
name="$1"
|
||||
local name="$(get_image_path "$1")"
|
||||
e2fsck -f "$name"
|
||||
resize2fs -M "$name"
|
||||
} || {
|
||||
|
@ -62,8 +65,10 @@ mount_image()
|
|||
{
|
||||
local mountdir="$(mktemp --tmpdir=./tmp/ -d)"
|
||||
local mountdir="$(realpath "$mountdir")"
|
||||
|
||||
local name="$(get_image_path "$1")"
|
||||
|
||||
mount -o loop "$1" "$mountdir" || {
|
||||
mount -o loop "$name" "$mountdir" || {
|
||||
log "Failed to mount image" ierror
|
||||
return 1
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue