summaryrefslogtreecommitdiffstats
path: root/src/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/mkinitramfs.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cmd/mkinitramfs.sh b/src/cmd/mkinitramfs.sh
index 7dd0502..a68467d 100644
--- a/src/cmd/mkinitramfs.sh
+++ b/src/cmd/mkinitramfs.sh
@@ -25,6 +25,7 @@ cmd_mkinitramfs_main()
local linux_output=
local initramfs_output=
local root=
+ local dev=
if ! get_options "${@}"; then
print_cmd_usage 'mkinitramfs' >&2
@@ -48,18 +49,28 @@ cmd_mkinitramfs_main()
linux_output="${cmd_mkinitramfs_opt_l}"
initramfs_output="${cmd_mkinitramfs_opt_i}"
root="${1}"
+ shift 1
+
+ dev=''
+ if is_block "${root}"; then
+ dev="${root}"
+ root="$(block_mount "${dev}")"
+ fi
profile_set "$(. "${root}/etc/os-release" && printf '%s' "${ID}")"
arch="$(cat "${root}/etc/proteanos_arch")"
plat="$(cat "${root}/etc/proteanos_plat")"
if ! img="$(profile_find_kernel "${root}" "${arch}" "${plat}")"; then
+ [ "x${dev}" != 'x' ] && block_umount "${root}"
error 2 "$(get_msg 'cmd_mkinitramfs_kernel_not_found')"
fi
cp -p "${root}/${img}" "${linux_output}"
(cd "${root}" && profile_make_initramfs "${arch}" "${plat}") \
>"${initramfs_output}"
+
+ [ "x${dev}" != 'x' ] && block_umount "${root}"
}
cmd_mkinitramfs_register()