From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/genkernel:master commit in: /, defaults/
Date: Tue, 5 Jan 2016 19:39:42 +0000 (UTC) [thread overview]
Message-ID: <1452022436.7316481040d27ac85c5663b51c74d5547671166f.robbat2@gentoo> (raw)
commit: 7316481040d27ac85c5663b51c74d5547671166f
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 5 19:33:50 2016 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Tue Jan 5 19:33:56 2016 +0000
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=73164810
lvm: be more robust in build & init
Commit ed52f905b6 was a good start, but missed that the cleanup nuked
the moved file. Improve the unpacking as well as usage of the LVM binary
to be much safer, and give useful errors if something is not as it
should be.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
defaults/initrd.scripts | 17 ++++++++++-------
gen_initramfs.sh | 13 ++++++++++++-
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 1bab361..94cb0cc 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -985,17 +985,22 @@ startVolumes() {
if [ "${USE_LVM_NORMAL}" = '1' ]
then
- if [ -x '/sbin/lvm' ]
+ for lvm_path in /sbin/lvm /bin/lvm MISSING ; do
+ [ -x "$lvm_path" ] && break
+ fi
+ if [ "${lvm_path}" = "MISSING" ]
then
+ bad_msg "dolvm invoked, but LVM binary not available! skipping LVM volume group activation!"
+ else
for dev in ${RAID_DEVICES}
do
setup_md_device "${dev}"
done
- # This is needed for /sbin/lvm to accept the following logic
- lvm_commands="#! /sbin/lvm"
+ # This is needed for LVM to accept the following logic
+ lvm_commands="#! ${lvm_path}"
- # If there is a cahe, update it. Unbreak at least dmcrypt
+ # If there is a cache, update it. Unbreak at least dmcrypt
[ -d /etc/lvm/cache ] && lvm_commands="${lvm_commands} \nvgscan"
# To activate volumegroups on all devices in the cache
@@ -1008,9 +1013,7 @@ startVolumes() {
# And finally execute it all (/proc/... needed if lvm is compiled without readline)
good_msg "Scanning for and activating Volume Groups"
- printf "%b\n" "${lvm_commands}" | /sbin/lvm /proc/self/fd/0
- else
- bad_msg "vgscan or vgchange not found: skipping LVM volume group activation!"
+ printf "%b\n" "${lvm_commands}" | $lvm_path /proc/self/fd/0
fi
fi
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index 9c9dfec..7dce2cf 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -366,13 +366,24 @@ append_lvm(){
compile_lvm || gen_die "Could not compile LVM"
/bin/tar -jxpf "${LVM_BINCACHE}" -C "${TEMP}/initramfs-lvm-temp" ||
gen_die "Could not extract lvm binary cache!";
+ # Remove any dynamic binaries that exist, so the rest of the code will
+ # fail better if something is missing
+ for f in ${TEMP}/initramfs-lvm-temp/{bin,sbin}/* ; do
+ [ -x "$f" ] && LC_ALL="C" ldd $f | grep -sq '(' && rm -f "$f"
+ done
+ # Now move the static binaries into good places.
mv ${TEMP}/initramfs-lvm-temp/sbin/lvm.static ${TEMP}/initramfs-lvm-temp/sbin/lvm ||
gen_die 'LVM error: Could not move lvm.static to lvm!'
# See bug 382555
mv ${TEMP}/initramfs-lvm-temp/sbin/dmsetup.static ${TEMP}/initramfs-lvm-temp/bin/dmsetup ||
gen_die 'LVM error: Could not move dmsetup.static to dmsetup!'
- rm -rf ${TEMP}/initramfs-lvm-temp/{lib,share,man,include,sbin/{lvm,dmsetup}}
+ # Clean up other stuff we don't need
+ rm -rf ${TEMP}/initramfs-lvm-temp/{lib*,share,man,include,sbin/dmeventd.static}
fi
+ # Include a symlink in the old location, for people with other appended
+ # scripts that might look for it in the old location.
+ ln -s ../sbin/lvm "${TEMP}/initramfs-lvm-temp/bin/lvm"
+ # Include the LVM config now
if [ -x /sbin/lvm -o -x /bin/lvm ]
then
# lvm dumpconfig 2>&1 > /dev/null || gen_die 'Could not copy over lvm.conf!'
next reply other threads:[~2016-01-05 19:39 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-05 19:39 Robin H. Johnson [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-07-23 23:57 [gentoo-commits] proj/genkernel:master commit in: /, defaults/ Thomas Deutschmann
2019-11-26 13:50 Thomas Deutschmann
2019-07-21 16:26 Thomas Deutschmann
2017-09-04 5:36 Robin H. Johnson
2017-01-08 1:57 Robin H. Johnson
2017-01-07 23:50 Robin H. Johnson
2017-01-02 23:25 Robin H. Johnson
2016-05-16 6:55 Robin H. Johnson
2016-01-05 19:39 Robin H. Johnson
2013-06-06 3:36 [gentoo-commits] proj/genkernel:ryao " Richard Yao
2013-06-03 23:49 ` [gentoo-commits] proj/genkernel:master " Richard Yao
2013-04-25 6:22 Fabio Erculiani
2012-10-16 0:03 Robin H. Johnson
2012-10-03 16:24 Sebastian Pipping
2012-08-30 16:20 Fabio Erculiani
2012-08-12 19:04 Sebastian Pipping
2012-07-24 18:01 Robin H. Johnson
2012-07-24 17:29 Robin H. Johnson
2012-07-24 8:29 Robin H. Johnson
2012-07-19 20:12 Richard Yao
2012-07-09 17:51 Sebastian Pipping
2012-07-08 17:05 Sebastian Pipping
2012-05-17 18:34 Sebastian Pipping
2012-03-17 1:27 Sebastian Pipping
2012-03-17 1:27 Sebastian Pipping
2012-03-17 1:27 Sebastian Pipping
2012-03-17 1:27 Sebastian Pipping
2012-02-20 6:58 Robin H. Johnson
2012-02-09 7:42 Robin H. Johnson
2012-02-06 9:35 Robin H. Johnson
2012-02-06 8:19 Robin H. Johnson
2012-01-14 23:22 Sebastian Pipping
2012-01-13 23:19 Sebastian Pipping
2012-01-13 23:19 Sebastian Pipping
2012-01-06 6:37 Robin H. Johnson
2011-11-08 17:21 Sebastian Pipping
2011-10-08 21:22 Fabio Erculiani
2011-09-13 9:54 Fabio Erculiani
2011-09-11 7:40 Fabio Erculiani
2011-08-30 15:34 Sebastian Pipping
2011-07-27 17:38 Sebastian Pipping
2011-05-31 10:58 Sebastian Pipping
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1452022436.7316481040d27ac85c5663b51c74d5547671166f.robbat2@gentoo \
--to=robbat2@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox