summaryrefslogtreecommitdiffstats
path: root/src/cmd/mkinitramfs.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/mkinitramfs.sh')
-rw-r--r--src/cmd/mkinitramfs.sh22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/cmd/mkinitramfs.sh b/src/cmd/mkinitramfs.sh
index 0ff0923..41e6327 100644
--- a/src/cmd/mkinitramfs.sh
+++ b/src/cmd/mkinitramfs.sh
@@ -29,21 +29,21 @@ cmd_mkinitramfs_main()
if ! get_options "${@}"; then
print_cmd_usage 'mkinitramfs' >&2
- exit 1
+ return 1
fi
shift $(($OPTIND - 1))
if [ "x${cmd_mkinitramfs_opt_l-}" = 'x' ]; then
print_cmd_usage 'mkinitramfs' >&2
- exit 1
+ return 1
fi
if [ "x${cmd_mkinitramfs_opt_i-}" = 'x' ]; then
print_cmd_usage 'mkinitramfs' >&2
- exit 1
+ return 1
fi
if [ ${#} -lt 1 ]; then
print_cmd_usage 'mkinitramfs' >&2
- exit 1
+ return 1
fi
linux_output="${cmd_mkinitramfs_opt_l}"
@@ -54,16 +54,22 @@ cmd_mkinitramfs_main()
dev=''
if is_block "${root}"; then
dev="${root}"
- root="$(block_mount "${dev}")"
+ if ! root="$(block_mount "${dev}")"; then
+ return 2
+ fi
fi
- profile_detect "${root}"
+ if ! profile_detect "${root}"; then
+ [ "x${dev}" != 'x' ] && block_umount "${root}"
+ return 2
+ fi
arch="$(cat "${root}/etc/proteanos_arch")"
plat="$(cat "${root}/etc/proteanos_plat")"
if ! img="$(profile_find_kernel "${root}" "${arch}" "${plat}")"; then
+ error "$(get_msg 'cmd_mkinitramfs_kernel_not_found')"
[ "x${dev}" != 'x' ] && block_umount "${root}"
- error 2 "$(get_msg 'cmd_mkinitramfs_kernel_not_found')"
+ return 2
fi
cp -p "${root}/${img}" "${linux_output}"
@@ -71,6 +77,8 @@ cmd_mkinitramfs_main()
>"${initramfs_output}"
[ "x${dev}" != 'x' ] && block_umount "${root}"
+
+ return 0
}
cmd_mkinitramfs_register()