ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
Blob Blame History Raw
From 0fe97bc02e3108efdb844feb1b367a89ba995d83 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 14 Jan 2014 17:48:08 -0500
Subject: [PATCH] kernel-install: add fedora specific callouts to
 new-kernel-pkg

---
 src/kernel-install/kernel-install | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install
index 3ae1d77..3a2ac56 100644
--- a/src/kernel-install/kernel-install
+++ b/src/kernel-install/kernel-install
@@ -19,6 +19,27 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with systemd; If not, see <http://www.gnu.org/licenses/>.
 
+if [[ -x /sbin/new-kernel-pkg ]]; then
+    [[ "$2" == *\+* ]] && flavor=-"${2##*+}"
+    case "$1" in
+        add)
+            /sbin/new-kernel-pkg --package "kernel${flavor}" --install "$2" || exit $?
+            /sbin/new-kernel-pkg --package "kernel${flavor}" --mkinitrd --dracut --depmod --update "$2" || exit $?
+            /sbin/new-kernel-pkg --package "kernel${flavor}" --rpmposttrans "$2" || exit $?
+            ;;
+        remove)
+            /sbin/new-kernel-pkg --package "kernel${flavor+-$flavor}" --rminitrd --rmmoddep --remove "$2" || exit $?
+            ;;
+        *)
+            ;;
+    esac
+
+    # exit, if we can't find a boot loader spec conforming setup
+    if ! [[ -d /boot/loader/entries || -L /boot/loader/entries ]]; then
+        exit 0
+    fi
+fi
+
 usage()
 {
     echo "Usage:"