|
Harald Hoyer |
53bced |
From ccb8ce0403056fc9af5b010a8d279d3891cbc399 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
53bced |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
53bced |
Date: Fri, 15 Aug 2014 14:58:02 +0200
|
|
Harald Hoyer |
53bced |
Subject: [PATCH] 50-dracut.install: fixed /proc/cmdline reading
|
|
Harald Hoyer |
53bced |
|
|
Harald Hoyer |
53bced |
and beautified the code a bit
|
|
Harald Hoyer |
53bced |
---
|
|
Harald Hoyer |
53bced |
50-dracut.install | 40 ++++++++++++++++++++++------------------
|
|
Harald Hoyer |
53bced |
1 file changed, 22 insertions(+), 18 deletions(-)
|
|
Harald Hoyer |
53bced |
|
|
Harald Hoyer |
53bced |
diff --git a/50-dracut.install b/50-dracut.install
|
|
Harald Hoyer |
53bced |
index 0282741..b0cc7c3 100755
|
|
Harald Hoyer |
53bced |
--- a/50-dracut.install
|
|
Harald Hoyer |
53bced |
+++ b/50-dracut.install
|
|
Harald Hoyer |
53bced |
@@ -2,31 +2,35 @@
|
|
Harald Hoyer |
53bced |
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
|
Harald Hoyer |
53bced |
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
|
Harald Hoyer |
53bced |
|
|
Harald Hoyer |
53bced |
-if [[ -f /etc/kernel/cmdline ]]; then
|
|
Harald Hoyer |
53bced |
- readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
|
|
Harald Hoyer |
53bced |
-fi
|
|
Harald Hoyer |
53bced |
+COMMAND="$1"
|
|
Harald Hoyer |
53bced |
+KERNEL_VERSION="$2"
|
|
Harald Hoyer |
53bced |
+BOOT_DIR_ABS="$3"
|
|
Harald Hoyer |
53bced |
+KERNEL_IMAGE="$4"
|
|
Harald Hoyer |
53bced |
|
|
Harald Hoyer |
53bced |
-if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
|
|
Harald Hoyer |
53bced |
- readarray -t BOOT_OPTIONS < /proc/cmdline
|
|
Harald Hoyer |
53bced |
-fi
|
|
Harald Hoyer |
53bced |
+ret=0
|
|
Harald Hoyer |
53bced |
+case "$COMMAND" in
|
|
Harald Hoyer |
53bced |
+ add)
|
|
Harald Hoyer |
53bced |
+ if [[ -f /etc/kernel/cmdline ]]; then
|
|
Harald Hoyer |
53bced |
+ readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
|
|
Harald Hoyer |
53bced |
+ fi
|
|
Harald Hoyer |
53bced |
|
|
Harald Hoyer |
53bced |
-unset noimageifnotneeded
|
|
Harald Hoyer |
53bced |
+ if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
|
|
Harald Hoyer |
53bced |
+ read -ar BOOT_OPTIONS < /proc/cmdline
|
|
Harald Hoyer |
53bced |
+ fi
|
|
Harald Hoyer |
53bced |
|
|
Harald Hoyer |
53bced |
-for ((i=0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
|
|
Harald Hoyer |
53bced |
- if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
|
|
Harald Hoyer |
53bced |
- noimageifnotneeded="yes"
|
|
Harald Hoyer |
53bced |
- break
|
|
Harald Hoyer |
53bced |
- fi
|
|
Harald Hoyer |
53bced |
-done
|
|
Harald Hoyer |
53bced |
+ unset noimageifnotneeded
|
|
Harald Hoyer |
53bced |
|
|
Harald Hoyer |
53bced |
-ret=0
|
|
Harald Hoyer |
53bced |
-case "$1" in
|
|
Harald Hoyer |
53bced |
- add)
|
|
Harald Hoyer |
53bced |
- dracut ${noimageifnotneeded:+--noimageifnotneeded} "$3"/initrd "$2"
|
|
Harald Hoyer |
53bced |
+ for ((i=0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
|
|
Harald Hoyer |
53bced |
+ if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
|
|
Harald Hoyer |
53bced |
+ noimageifnotneeded="yes"
|
|
Harald Hoyer |
53bced |
+ break
|
|
Harald Hoyer |
53bced |
+ fi
|
|
Harald Hoyer |
53bced |
+ done
|
|
Harald Hoyer |
53bced |
+ dracut ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS"/initrd "$KERNEL_VERSION"
|
|
Harald Hoyer |
53bced |
ret=$?
|
|
Harald Hoyer |
53bced |
;;
|
|
Harald Hoyer |
53bced |
remove)
|
|
Harald Hoyer |
53bced |
- rm -f -- "$3"/initrd
|
|
Harald Hoyer |
53bced |
+ rm -f -- "$BOOT_DIR_ABS"/initrd
|
|
Harald Hoyer |
53bced |
ret=$?
|
|
Harald Hoyer |
53bced |
;;
|
|
Harald Hoyer |
53bced |
esac
|