summaryrefslogtreecommitdiffstats
path: root/src/cmd
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-01-16 12:54:31 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-01-16 12:54:31 (EST)
commiteabfb0bdb89b980d0b4823dd308407fe711466bb (patch)
tree568df6a16783683cceb6cc2a8f863ad32b06f1ab /src/cmd
parentfcfa0430e97efbc07ce0fc9a56304ddf3f4ba0c0 (diff)
cmd/mkinitramfs: Accept block device as root
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()