aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2012-03-22 15:07:23 (GMT)
committerSebastian Pipping <sebastian@pipping.org>2012-03-22 15:15:51 (GMT)
commit7ee9306c7d68bd8b54219788b61558abc8732e9e (patch)
treeef11acad889277aba35eb0a1d4c471363b72bb20
parentMake errors stand out more (diff)
downloadgenkernel-7ee9306c7d68bd8b54219788b61558abc8732e9e.zip
genkernel-7ee9306c7d68bd8b54219788b61558abc8732e9e.tar.gz
genkernel-7ee9306c7d68bd8b54219788b61558abc8732e9e.tar.bz2
Fail hard on LUKS inclusion error (bug #409277), advise about sys-fs/cryptsetup[static], drop support for cryptsetup binary from /bin/
-rw-r--r--ChangeLog4
-rwxr-xr-xgen_initramfs.sh27
2 files changed, 17 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index b2529bf..b6319e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@
# Distributed under the GPL v2
# $Id$
+ 22 Mar 2012; Sebastian Pipping <sping@gentoo.org> gen_initramfs.sh:
+ Fail hard on LUKS inclusion error (bug #409277), advise about
+ sys-fs/cryptsetup[static], drop support for cryptsetup binary from /bin/
+
22 Mar 2012; Sebastian Pipping <sping@gentoo.org> gen_funcs.sh,
gen_initramfs.sh:
Make errors stand out more
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index 9a17b3a..419d557 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -391,6 +391,10 @@ append_overlay(){
}
append_luks() {
+ local _luks_error_format="LUKS support cannot be included: %s. Please emerge sys-fs/cryptsetup[static]."
+ local _luks_source=/sbin/cryptsetup
+ local _luks_dest=/sbin/cryptsetup
+
if [ -d "${TEMP}/initramfs-luks-temp" ]
then
rm -r "${TEMP}/initramfs-luks-temp/"
@@ -402,20 +406,15 @@ append_luks() {
if isTrue ${LUKS}
then
- if is_static /bin/cryptsetup
- then
- print_info 1 "Including LUKS support"
- cp /bin/cryptsetup ${TEMP}/initramfs-luks-temp/sbin/cryptsetup
- chmod +x "${TEMP}/initramfs-luks-temp/sbin/cryptsetup"
- elif is_static /sbin/cryptsetup
- then
- print_info 1 "Including LUKS support"
- cp /sbin/cryptsetup ${TEMP}/initramfs-luks-temp/sbin/cryptsetup
- chmod +x "${TEMP}/initramfs-luks-temp/sbin/cryptsetup"
- else
- print_info 1 "LUKS support requires static cryptsetup at /bin/cryptsetup or /sbin/cryptsetup"
- print_info 1 "Not including LUKS support"
- fi
+ [ -x "${_luks_source}" ] \
+ || gen_die "$(printf "${_luks_error_format}" "no file ${_luks_source}")"
+
+ is_static "${_luks_source}" \
+ || gen_die "$(printf "${_luks_error_format}" "${_luks_source} not a static binary")"
+
+ print_info 1 "Including LUKS support"
+ cp "${_luks_source}" ${TEMP}/initramfs-luks-temp${_luks_dest}
+ chmod +x "${TEMP}/initramfs-luks-temp${_luks_dest}"
fi
find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \