summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2019-07-14 11:47:19 +0200
committerThomas Deutschmann <whissi@gentoo.org>2019-07-14 13:58:16 +0200
commit3a756304719c40443e2e26d942a46c3ab4276d6b (patch)
tree860cc9f7ff1a45d7b4c83e9f95e58e5f9bc2c44e
parentRework --luks support (diff)
downloadgenkernel-3a756304719c40443e2e26d942a46c3ab4276d6b.tar.gz
genkernel-3a756304719c40443e2e26d942a46c3ab4276d6b.tar.bz2
genkernel-3a756304719c40443e2e26d942a46c3ab4276d6b.zip
gen_initramfs.sh: Refactor append_modprobed()
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
-rwxr-xr-xgen_initramfs.sh18
1 files changed, 10 insertions, 8 deletions
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index fd26410..c46721a 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -1167,19 +1167,21 @@ append_modprobed() {
local TDIR="${TEMP}/initramfs-modprobe.d-temp"
if [ -d "${TDIR}" ]
then
- rm -r "${TDIR}"
+ rm -r "${TDIR}" || gen_die "Failed to clean out existing '${TDIR}'!"
fi
- mkdir -p "${TDIR}/etc"
- cp -r "/etc/modprobe.d" "${TDIR}/etc/modprobe.d"
+ mkdir "${TDIR}" || gen_die "Failed to create '${TDIR}'!"
+ cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!"
+
+ mkdir -p "${TDIR}"/etc || gen_die "Failed to create '${TDIR}/etc'!"
- cd "${TDIR}"
+ cp -rL "/etc/modprobe.d" "${TDIR}"/etc/ 2>/dev/null \
+ || gen_die "Failed to copy '/etc/modprobe.d'!"
+
+ cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!"
log_future_cpio_content
find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
- || gen_die "compressing modprobe.d cpio"
-
- cd "${TEMP}"
- rm -rf "${TDIR}" > /dev/null
+ || gen_die "Failed to append modprobe.d to cpio!"
}
# check for static linked file with objdump