[rhel7-branch 1/1] Update upd-kernel so that it actually works (#1166535)

bcl installerbot-noreply at redhat.com
Fri Jun 12 21:19:30 UTC 2015


From: "Brian C. Lane" <bcl at redhat.com>

Thanks to Masahiro Matsuya for the patch.

Resolves: rhbz#1166535
---
 scripts/upd-kernel | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/scripts/upd-kernel b/scripts/upd-kernel
index 3087113..a4ce25c 100755
--- a/scripts/upd-kernel
+++ b/scripts/upd-kernel
@@ -4,7 +4,7 @@
 # with a new kernel + initrd
 # Usage: ./upd-kernel <olddir> <newdir> <newkernelrpm>
 #
-# Copyright (C) 2007  Red Hat, Inc.  All rights reserved.
+# Copyright (C) 2007-2015  Red Hat, Inc.  All rights reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -56,20 +56,28 @@ popd > /dev/null
 # explode the initrd
 mkdir initrd
 pushd initrd > /dev/null
-zcat $OLDDIR/initrd.img | cpio -id --quiet
+xzcat $OLDDIR/initrd.img | cpio -id --quiet
 
-for mod in $(find modules/ -type f -name '*.ko.gz' -exec basename {} \; | sort | uniq) ; do
-    for path in $(find $WORKDIR/rpm/lib/modules/$NEWVER/ -name ${mod%.gz}); do
-        dest=${path##$WORKDIR/rpm/lib/}
+# delete the old module dir
+for oldmoddir in $(find lib/modules/ -type f -name 'modules.dep' -exec dirname {} \; ) ; do
+    rm -rf $oldmoddir
+done
+
+for mod in $(find lib/modules/ -type f -name '*.ko' -exec basename {} \; | sort | uniq) ; do
+    for path in $(find $WORKDIR/rpm/lib/modules/$NEWVER/ -name ${mod}); do
+        dest=${path##$WORKDIR/rpm/}
         mkdir -p $(dirname $dest)
-        gzip < $path > $dest.gz
+        cp -p $path $dest
     done
 done
 
+cp -p $WORKDIR/rpm/lib/modules/$NEWVER/modules.order lib/modules/$NEWVER
+cp -p $WORKDIR/rpm/lib/modules/$NEWVER/modules.builtin lib/modules/$NEWVER
+
 /sbin/depmod -a -b . $NEWVER
-rm -f modules/$NEWVER/modules.*map
+rm -f lib/modules/$NEWVER/modules.*map
 
-find . | cpio --quiet -c -o | gzip -9 > $NEWDIR/initrd.img
+find . | cpio --quiet -c -o | xz --format=lzma -9 > $NEWDIR/initrd.img
 popd > /dev/null
 
 cp $WORKDIR/rpm/boot/vmlinuz-* $NEWDIR/vmlinuz


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/6e19035d87515d29a1da0ff6d144b5422ef5fbed


More information about the anaconda-patches mailing list