From: git@ipfire.org
To: ipfire-scm@lists.ipfire.org
Subject: [git.ipfire.org] IPFire 2.x development tree branch, master, updated. 5946f1f9d0cc021b6db9f5127cdc46d7123cbdf1
Date: Thu, 01 Jan 2015 16:37:59 +0100 [thread overview]
Message-ID: <20150101153759.414DA21833@argus.ipfire.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 3476 bytes --]
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".
The branch, master has been updated
via 5946f1f9d0cc021b6db9f5127cdc46d7123cbdf1 (commit)
from 91e56a59a4adc968b3fed8a95a9a3f569230f145 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5946f1f9d0cc021b6db9f5127cdc46d7123cbdf1
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Thu Jan 1 16:36:51 2015 +0100
update-bootloader: Search for /boot first and then /
The bootloader is usually installed on the /boot partition
if that exists. Some installations may mount / from a different
device, so we make sure to update the bootloader on the
right device.
-----------------------------------------------------------------------
Summary of changes:
src/scripts/update-bootloader | 45 ++++++++++++++++++++++++++-----------------
1 file changed, 27 insertions(+), 18 deletions(-)
Difference in files:
diff --git a/src/scripts/update-bootloader b/src/scripts/update-bootloader
index b011b72..ad6fdb6 100644
--- a/src/scripts/update-bootloader
+++ b/src/scripts/update-bootloader
@@ -23,8 +23,19 @@
GRUB_INSTALL_ARGS="--no-floppy --recheck"
-function find_root_device() {
- # rootfs / rootfs rw 0 0
+function find_bootloader_device() {
+ local mp
+ for mp in /boot /; do
+ if find_device "${mp}"; then
+ return 0
+ fi
+ done
+
+ return 1
+}
+
+function find_device() {
+ local mountpoint="${1}"
local root
local dev mp fs flags rest
@@ -32,29 +43,27 @@ function find_root_device() {
# Skip unwanted entries
[ "${dev}" = "rootfs" ] && continue
- if [ "${mp}" = "/" ] && [ -b "${dev}" ]; then
+ if [ "${mp}" = "${mountpoint}" ] && [ -b "${dev}" ]; then
root="$(basename "${dev}")"
break
fi
done < /proc/mounts
# Get the actual device from the partition that holds /
- if [ -n "${root}" ]; then
- while [ -n "${root}" ]; do
- if [ -e "/sys/block/${root}" ]; then
- echo "${root}"
- return 0
- fi
-
- # Remove last character
- root="${root::-1}"
- done
- fi
+ while [ -n "${root}" ]; do
+ if [ -e "/sys/block/${root}" ]; then
+ echo "${root}"
+ return 0
+ fi
+
+ # Remove last character
+ root="${root::-1}"
+ done
return 1
}
-function root_device_is_mdraid() {
+function device_is_mdraid() {
local device="${1}"
[ -d "/sys/block/${device}/md" ]
@@ -103,19 +112,19 @@ function grub_install() {
function main() {
# Find the root device
- local device="$(find_root_device)"
+ local device="$(find_bootloader_device)"
if [ -z "${device}" ]; then
echo "Could not find root device. Aborting." >&2
exit 1
fi
- echo "Found root device: /dev/${device}"
+ echo "Found bootloader device: /dev/${device}"
# Update configuration files
grub_update_config || exit $?
# Handle mdraid devices
- if root_device_is_mdraid "${device}"; then
+ if device_is_mdraid "${device}"; then
local slave
for slave in $(mdraid_get_slaves "${device}"); do
grub_install "/dev/${slave}"
hooks/post-receive
--
IPFire 2.x development tree
reply other threads:[~2015-01-01 15:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20150101153759.414DA21833@argus.ipfire.org \
--to=git@ipfire.org \
--cc=ipfire-scm@lists.ipfire.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