Compare commits
No commits in common. "master" and "f25" have entirely different histories.
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,6 +1,3 @@
|
||||
*.tar.bz2
|
||||
*.tar.gz
|
||||
grubby-*.tar.bz2
|
||||
clog
|
||||
*.rpm
|
||||
.build*log
|
||||
*/
|
||||
|
@ -0,0 +1,41 @@
|
||||
From 639b9ab2462d4dddd8b8cff04e8db352cb6dc5d5 Mon Sep 17 00:00:00 2001
|
||||
From: Yannick Brosseau <scientist@fb.com>
|
||||
Date: Thu, 3 Jul 2014 13:55:19 -0700
|
||||
Subject: [PATCH 01/10] Don't go past the last element of indexVars in
|
||||
findEntryByPath
|
||||
|
||||
We add a chance of creating an infinite loop, because we
|
||||
were reading memory past the last element of indexVars set to -1.
|
||||
|
||||
This issue was only apparent with -O2, probably because the way the
|
||||
memory was initialized.
|
||||
|
||||
Signed-off-by: Yannick Brosseau <scientist@fb.com>
|
||||
---
|
||||
grubby.c | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grubby.c b/grubby.c
|
||||
index 88a1f08..db91364 100644
|
||||
--- a/grubby.c
|
||||
+++ b/grubby.c
|
||||
@@ -1959,11 +1959,13 @@ struct singleEntry * findEntryByPath(struct grubConfig * config,
|
||||
}
|
||||
|
||||
indexVars[i + 1] = -1;
|
||||
-
|
||||
+
|
||||
i = 0;
|
||||
if (index) {
|
||||
- while (i < *index) i++;
|
||||
- if (indexVars[i] == -1) return NULL;
|
||||
+ while (i < *index) {
|
||||
+ i++;
|
||||
+ if (indexVars[i] == -1) return NULL;
|
||||
+ }
|
||||
}
|
||||
|
||||
entry = findEntryByIndex(config, indexVars[i]);
|
||||
--
|
||||
1.9.3
|
||||
|
@ -0,0 +1,39 @@
|
||||
From 15d36a8f27c5b14b290da99c4be8880bc35dc41b Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 27 Oct 2014 18:10:00 -0400
|
||||
Subject: [PATCH] Treat kernel and kernel-core as identical in terms of
|
||||
--make-default
|
||||
|
||||
Depending on which kernel version, we'll either get kernel or
|
||||
kernel-core as --package. Since we're unlikely to call something
|
||||
kernel-core-core, just treat them the same.
|
||||
|
||||
Resolves: rhbz#1141414
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
new-kernel-pkg | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/new-kernel-pkg b/new-kernel-pkg
|
||||
index 70f6118..9f3b192 100755
|
||||
--- a/new-kernel-pkg
|
||||
+++ b/new-kernel-pkg
|
||||
@@ -797,9 +797,11 @@ if [ -n "$dracut" -o -n "$adddracutargs" ]; then
|
||||
fi
|
||||
|
||||
# set this as the default if we have the package and it matches
|
||||
-if [ "$mode" == "--install" -a "$UPDATEDEFAULT" == "yes" -a -n "$package" -a -n "$DEFAULTKERNEL" -a "$package" == "$DEFAULTKERNEL" ]; then
|
||||
- makedefault="--make-default"
|
||||
- [ -n "$verbose" ] && echo "making it the default based on config"
|
||||
+if [ "$mode" == "--install" -a "$UPDATEDEFAULT" == "yes" -a -n "$package" -a -n "$DEFAULTKERNEL" ]; then
|
||||
+ if [ "$package" == "$DEFAULTKERNEL" -o "${package}-core" == "$DEFAULTKERNEL" ]; then
|
||||
+ makedefault="--make-default"
|
||||
+ [ -n "$verbose" ] && echo "making it the default based on config"
|
||||
+ fi
|
||||
fi
|
||||
|
||||
if [ "$moddep" == "make" ]; then
|
||||
--
|
||||
1.9.3
|
||||
|
@ -1,235 +0,0 @@
|
||||
From aa4472dbc10f3d669e24ac07293d7ac19e606866 Mon Sep 17 00:00:00 2001
|
||||
From: Dennis Gilmore <dennis@ausil.us>
|
||||
Date: Wed, 30 Aug 2017 14:03:45 -0500
|
||||
Subject: [PATCH 1/8] remove the old crufty u-boot support
|
||||
|
||||
Fedora has only supported extlinux.conf for a few releases now
|
||||
as a result it should be the only way we boot systems. Remove
|
||||
the no longer needed uboot file
|
||||
|
||||
Signed-off-by: Dennis Gilmore <dennis@ausil.us>
|
||||
---
|
||||
new-kernel-pkg | 116 -------------------------------------------------
|
||||
uboot | 43 ------------------
|
||||
2 files changed, 159 deletions(-)
|
||||
delete mode 100644 uboot
|
||||
|
||||
diff --git a/new-kernel-pkg b/new-kernel-pkg
|
||||
index b634388a83f..962008e3c9d 100755
|
||||
--- a/new-kernel-pkg
|
||||
+++ b/new-kernel-pkg
|
||||
@@ -37,7 +37,6 @@ else
|
||||
fi
|
||||
|
||||
[ -f /etc/sysconfig/kernel ] && . /etc/sysconfig/kernel
|
||||
-[ -f /etc/sysconfig/uboot ] && . /etc/sysconfig/uboot
|
||||
|
||||
cfgGrub2=""
|
||||
cfgGrub2Efi=""
|
||||
@@ -50,7 +49,6 @@ grubConfig=""
|
||||
grub2Config=""
|
||||
grub2EfiConfig=""
|
||||
extlinuxConfig=""
|
||||
-ubootScript="/boot/boot.scr"
|
||||
|
||||
ARCH=$(uname -m)
|
||||
|
||||
@@ -84,13 +82,6 @@ elif [[ ${ARCH} =~ armv[5|7].*l ]] ; then
|
||||
liloConfig=""
|
||||
bootPrefix=/boot
|
||||
extlinuxConfig=$(readlink -f /etc/extlinux.conf 2>/dev/null)
|
||||
- ubootDir=${UBOOT_DIR:-"/boot"}
|
||||
- ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"}
|
||||
- ubootKList=${UBOOT_KLIST:-"klist.txt"}
|
||||
- ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"}
|
||||
- ubootDefaultImage=${UBOOT_UIMAGE:-"uImage"}
|
||||
- ubootDefaultInitrd=${UBOOT_UINITRD:-"uInitrd"}
|
||||
- ubootAddress=${UBOOT_IMGADDR:-"0x00008000"}
|
||||
mounted=""
|
||||
liloFlag=""
|
||||
isx86=""
|
||||
@@ -382,53 +373,6 @@ remove() {
|
||||
[ -n "$verbose" ] && echo "$liloConfig does not exist, not running grubby"
|
||||
fi
|
||||
|
||||
- if [ -n "$cfguBoot" ]; then
|
||||
- [ -n "$verbose" ] && echo "removing $version from $ubootDir..."
|
||||
-
|
||||
- if [ -f $ubootDir/$ubootKList ]; then
|
||||
- tmpKList=`mktemp $ubootDir/$ubootKList.XXXX`
|
||||
- curversion=`tail -n1 $ubootDir/$ubootKList`
|
||||
- sed "/$version$/d" $ubootDir/$ubootKList > $tmpKList
|
||||
- newversion=`tail -n1 $tmpKList`
|
||||
- if [ -f $ubootDir/uImage-$newversion ] && [ -f $ubootDir/uInitrd-$newversion ]; then
|
||||
- if [ "$curversion" != "$newversion" ]; then
|
||||
- cp -fp $ubootDir/uImage-$newversion $ubootDir/${ubootDefaultImage}
|
||||
- if [ $? -ne 0 ]; then
|
||||
- [ -n "$verbose" ] && echo "copy uImage-$newversion error, default kernel not replaced!" && exit
|
||||
- fi
|
||||
- cp -fp $ubootDir/uInitrd-$newversion $ubootDir/${ubootDefaultInitrd}
|
||||
- if [ $? -ne 0 ]; then
|
||||
- [ -n "$verbose" ] && echo "copy uInitrd-$newversion error, default Initrd not replaced!" && exit
|
||||
- fi
|
||||
- fi
|
||||
-
|
||||
- [ -n "$verbose" ] && echo "removing uImage-$version"
|
||||
- if [ -f $ubootDir/uImage-$version ]; then
|
||||
- rm -f $ubootDir/uImage-$version
|
||||
- else
|
||||
- [ -n "$verbose" ] && echo "uImage-$version did not exist!"
|
||||
- fi
|
||||
-
|
||||
- [ -n "$verbose" ] && echo "removing uInitrd-$version"
|
||||
- if [ -f $ubootDir/uInitrd-$version ]; then
|
||||
- rm -f $ubootDir/uInitrd-$version
|
||||
- else
|
||||
- [ -n "$verbose" ] && echo "uInitrd-$version did not exist!"
|
||||
- fi
|
||||
-
|
||||
- mv $tmpKList $ubootDir/$ubootKList
|
||||
- [ -x /sbin/a-b-c ] && /sbin/a-b-c
|
||||
- else
|
||||
- [ -n "$verbose" ] && echo "uImage $newversion does not exist!"
|
||||
- [ -f $tmpKList ] && rm -f $tmpKList
|
||||
- fi
|
||||
- else
|
||||
- [ -n "$verbose" ] && echo "No previous kernel version. U-Boot images not removed!"
|
||||
- fi
|
||||
- else
|
||||
- [ -n "$verbose" ] && echo "$ubootScript does not exist, not modifying $ubootDir"
|
||||
- fi
|
||||
-
|
||||
if [ -n "$cfgExtlinux" ]; then
|
||||
[ -n "$verbose" ] && echo "removing $version from $extlinuxConfig"
|
||||
$grubby --extlinux -c $extlinuxConfig \
|
||||
@@ -530,36 +474,6 @@ update() {
|
||||
[ -n "$verbose" ] && echo "$liloConfig does not exist, not running grubby"
|
||||
fi
|
||||
|
||||
- if [ -n "$cfguBoot" ]; then
|
||||
- [ -n "$verbose" ] && echo "adding $version to $ubootDir..."
|
||||
-
|
||||
- [ -n "$verbose" ] && echo "creating uImage-$version"
|
||||
- mkimage -A arm -O linux -T kernel -C none -a $ubootAddress \
|
||||
- -e $ubootAddress -n $version \
|
||||
- -d $kernelImage $ubootDir/uImage-$version
|
||||
-
|
||||
- [ -n "$verbose" ] && echo "creating uInitrd-$version"
|
||||
- mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 \
|
||||
- -n initramfs -d $initrdfile $ubootDir/uInitrd-$version
|
||||
-
|
||||
- if [ -f $ubootDir/uImage-$version ] && [ -f $ubootDir/uInitrd-$version ]; then
|
||||
- cp -fp $ubootDir/uImage-$version $ubootDir/${ubootDefaultImage}
|
||||
- if [ $? -ne 0 ]; then
|
||||
- [ -n "$verbose" ] && echo "copy uImage-$version error, kernel not installed!" && exit
|
||||
- fi
|
||||
- cp -fp $ubootDir/uInitrd-$version $ubootDir/${ubootDefaultInitrd}
|
||||
- if [ $? -ne 0 ]; then
|
||||
- [ -n "$verbose" ] && echo "copy uInitrd-$version error, kernel not installed!" && exit
|
||||
- fi
|
||||
- echo $version >> $ubootDir/$ubootKList
|
||||
- [ -x /sbin/a-b-c ] && /sbin/a-b-c
|
||||
- else
|
||||
- [ -n "$verbose" ] && echo "cannot make $version the default"
|
||||
- fi
|
||||
- else
|
||||
- [ -n "$verbose" ] && echo "$ubootScript does not exist, not setting up $ubootDir"
|
||||
- fi
|
||||
-
|
||||
if [ -n "$cfgExtlinux" ]; then
|
||||
[ -n "$verbose" ] && echo "updating $version from $extlinuxConfig"
|
||||
ARGS="--extlinux -c $extlinuxConfig --update-kernel=$kernelImage \
|
||||
@@ -877,33 +791,6 @@ fi
|
||||
[ -n "$liloConfig" ] && [ -f "$liloConfig" ] && cfgLilo=1;
|
||||
[ -n "$extlinuxConfig" ] && [ -f "$extlinuxConfig" ] && cfgExtlinux=1;
|
||||
|
||||
-# if we have a U-Boot directory, but no boot script, check if the directory
|
||||
-# is mounted. If not, mount it, and then check if a boot script exists.
|
||||
-if [ -n "$ubootDir" ]; then
|
||||
- if [ -f "$ubootScript" ]; then
|
||||
- cfguBoot=1
|
||||
- else
|
||||
- mountEntry=`mount | grep $ubootDir`
|
||||
- if [ -z "$mountEntry" ]; then
|
||||
- mount $ubootDevice $ubootDir
|
||||
- mounted=1
|
||||
- fi
|
||||
- [ -f "$ubootScript" ] && cfguBoot=1;
|
||||
- fi
|
||||
-fi
|
||||
-
|
||||
-# if we're using U-Boot, check if the default load address should change
|
||||
-if [ -n "$cfguBoot" -a -z "$UBOOT_IMGADDR" ]; then
|
||||
- [[ $version =~ .([^.]*)$ ]]
|
||||
- platform=${BASH_REMATCH[1]}
|
||||
- # A few platforms use an alternate kernel load address
|
||||
- if [ "$platform" = "omap" ]; then
|
||||
- ubootAddress=0x80008000
|
||||
- elif [ "$platform" = "imx" ]; then
|
||||
- ubootAddress=0x90008000
|
||||
- fi
|
||||
-fi
|
||||
-
|
||||
# if we have a lilo config on an x86 box, see if the default boot loader
|
||||
# is lilo to determine if it should be run
|
||||
if [ -n "$cfgLilo" -a -n "$isx86" ]; then
|
||||
@@ -920,7 +807,4 @@ elif [ "$mode" == "--rpmposttrans" ]; then
|
||||
rpmposttrans
|
||||
fi
|
||||
|
||||
-# if we mounted the U-Boot directory, unmount it.
|
||||
-[ -n "$mounted" ] && umount $ubootDir
|
||||
-
|
||||
exit 0
|
||||
diff --git a/uboot b/uboot
|
||||
deleted file mode 100644
|
||||
index 07d8671822f..00000000000
|
||||
--- a/uboot
|
||||
+++ /dev/null
|
||||
@@ -1,43 +0,0 @@
|
||||
-# Settings for uBoot setup in /sbin/new-kernel-pkg
|
||||
-#
|
||||
-# Default values are provided below (as comments)
|
||||
-#
|
||||
-# WARNING: These values affect where grubby installs and removes
|
||||
-# uBoot kernel images. Changing these _after_ kernels have
|
||||
-# been installed may cause removing a kernel image to fail.
|
||||
-
|
||||
-# directory where uBoot images and scripts are found
|
||||
-#UBOOT_DIR=/boot
|
||||
-
|
||||
-# Override the load address when running mkimage on the kernel.
|
||||
-# OMAP such as Beagleboard and Pandaboard: Use 0x80008000
|
||||
-# Tegra such as Trimslice: Use 0x00008000
|
||||
-# IMX such as Efika mx51 smarttop: Use 0x90008000
|
||||
-# Kirkwood such as Dreamplug, Guruplug, Sheevaplug: Use 0x00008000
|
||||
-# If left undefined grubby will use defults for Tegra or OMAP depending
|
||||
-# upon the contents of /proc/cpuinfo.
|
||||
-#UBOOT_IMGADDR=0x0x00008000
|
||||
-
|
||||
-# name of the text file containing the list of installed kernel versions
|
||||
-# NOTE: The versions are in order of installation. The last entry should
|
||||
-# always be the default boot kernel version.
|
||||
-#UBOOT_KLIST=klist.txt
|
||||
-
|
||||
-# device partition where uBoot images reside; mounted on $UBOOT_DIR
|
||||
-#UBOOT_DEVICE=mmcblk0p1
|
||||
-
|
||||
-
|
||||
-# NOTE: Both of the following files are automatically overwritte
|
||||
-# when a kernel package is installed or removed.
|
||||
-
|
||||
-# default kernel uImage file name
|
||||
-#UBOOT_UIMAGE=uImage
|
||||
-
|
||||
-# default initrd uInitrd file name
|
||||
-#UBOOT_UINITRD=uInitrd
|
||||
-
|
||||
-# defualt for platform shipping an onboard dtb.
|
||||
-#SHIPSDTB=no
|
||||
-
|
||||
-# option to tell new-kernel-pkg a specific dtb file to load in extlinux.conf
|
||||
-#dtbfile=foo.dtb
|
||||
--
|
||||
2.17.1
|
||||
|
452
0002-Add-bls-test-harness-bits.patch
Normal file
452
0002-Add-bls-test-harness-bits.patch
Normal file
@ -0,0 +1,452 @@
|
||||
From 0e5c50b8dff5208b915391e3b592790bdf174cf4 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Tue, 8 Jul 2014 14:37:21 -0400
|
||||
Subject: [PATCH 02/10] Add bls test harness bits.
|
||||
|
||||
This expects that there are bls config files and that grubby knows how
|
||||
to deal with them, which isn't at all true, and so the test case
|
||||
currently fails because test/grub2.15 doesn't provide any kernel stanzas
|
||||
whatsoever.
|
||||
|
||||
Maybe I should add a dummy there, but... I'd rather leave this failing
|
||||
here.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
test.sh | 105 +++++++++++++++++++
|
||||
...724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf | 8 ++
|
||||
...724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf | 8 ++
|
||||
...981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf | 10 ++
|
||||
...981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf | 10 ++
|
||||
test/grub2.15 | 112 +++++++++++++++++++++
|
||||
test/results/grub2.15 | 112 +++++++++++++++++++++
|
||||
7 files changed, 365 insertions(+)
|
||||
create mode 100644 test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf
|
||||
create mode 100644 test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf
|
||||
create mode 100644 test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf
|
||||
create mode 100644 test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf
|
||||
create mode 100644 test/grub2.15
|
||||
create mode 100644 test/results/grub2.15
|
||||
|
||||
diff --git a/test.sh b/test.sh
|
||||
index 864a8ce..e7be15f 100755
|
||||
--- a/test.sh
|
||||
+++ b/test.sh
|
||||
@@ -163,6 +163,102 @@ for b in $(./grubby --help | \
|
||||
eval "${b}DisplayTest() { [[ \"$b\" == \$opt_bootloader ]] && oneDisplayTest --$b \"\$@\"; }"
|
||||
done
|
||||
|
||||
+grub2BlsTest() {
|
||||
+ declare blsdir=$(mktemp -d) cmpdir=$(mktemp -d)
|
||||
+
|
||||
+ declare blspairs=""
|
||||
+ while [ -n "$1" ]; do
|
||||
+ if [ "$1" == "--blspair" ]; then
|
||||
+ blsin=$(echo $2 | sed 's/\(.*\),.*/\1/')
|
||||
+ blsout=$(echo $2 | sed 's/[^,]*,\(.*\)/\1/')
|
||||
+ [ -n "$blsin" ] && cp "test/grub2-support_files/$blsin" ${blsdir}/
|
||||
+ [ -n "$blsout" ] && cp "test/grub2-support_files/$blsout" ${cmpdir}/
|
||||
+ blspairs="${blspairs} $2"
|
||||
+ shift 2
|
||||
+ else
|
||||
+ break
|
||||
+ fi
|
||||
+ done
|
||||
+
|
||||
+ typeset mode=$1 cfg=test/$2 correct=test/results/$3
|
||||
+ shift 3
|
||||
+
|
||||
+ local ENV_FILE=""
|
||||
+ if [ "$mode" == "--grub2" ]; then
|
||||
+ ENV_FILE="test/grub2-support_files/env_temp"
|
||||
+ if [ "$1" == "--env" ]; then
|
||||
+ cp "test/grub2-support_files/$2" "$ENV_FILE"
|
||||
+ shift 2
|
||||
+ else
|
||||
+ cp "test/grub2-support_files/grubenv.0" "$ENV_FILE"
|
||||
+ fi
|
||||
+ ENV_FILE="--env=$ENV_FILE"
|
||||
+ fi
|
||||
+
|
||||
+ declare outfile=$(mktemp)
|
||||
+ echo "$testing ... $mode bls $cfg $correct"
|
||||
+ runme=( ./grubby "$mode" --bad-image-okay $ENV_FILE -c "$cfg" -o - --blsdir="${blsdir}" "$@" )
|
||||
+ declare -i old_fail=$fail
|
||||
+ if "${runme[@]}" 2>&1 | cmp "$correct" > /dev/null; then
|
||||
+ (( pass++ ))
|
||||
+ if $opt_verbose; then
|
||||
+ echo -------------------------------------------------------------
|
||||
+ echo -n "PASS: "
|
||||
+ printf "%q " "${runme[@]}"; echo
|
||||
+ "${runme[@]}" 2>&1 | diff -U30 "$cfg" -
|
||||
+ echo
|
||||
+ fi
|
||||
+ else
|
||||
+ (( fail++ ))
|
||||
+ echo -------------------------------------------------------------
|
||||
+ echo -n "FAIL: "
|
||||
+ printf "%q " "${runme[@]}"; echo
|
||||
+ "${runme[@]}" 2>&1 | diff -U30 "$correct" -
|
||||
+ echo
|
||||
+ fi
|
||||
+
|
||||
+ for pair in ${blspairs} ; do
|
||||
+ blsin=$(echo $pair | sed 's/\(.*\),.*/\1/')
|
||||
+ blsout=$(echo $pair | sed 's/[^,]*,\(.*\)/\1/')
|
||||
+
|
||||
+ if [ -z "${blsout}" -a -f ${blsdir}/${blsin} ]; then
|
||||
+ (( fail++ ))
|
||||
+ echo -------------------------------------------------------------
|
||||
+ echo -n "FAIL: "
|
||||
+ printf "%q " "${runme[@]}"; echo
|
||||
+ diff -U30 /dev/null ${blsdir}/${blsin}
|
||||
+ elif [ -n "${blsout}" ] && ! cmp ${blsdir}/${blsout} ${cmpdir}/${blsout} >/dev/null ; then
|
||||
+ (( fail++ ))
|
||||
+ echo -------------------------------------------------------------
|
||||
+ echo -n "FAIL: "
|
||||
+ printf "%q " "${runme[@]}"; echo
|
||||
+ diff -U30 "${cmpdir}/${blsout}" "${blsdir}/${blsout}"
|
||||
+ else
|
||||
+ (( pass++ ))
|
||||
+ if $opt_verbose; then
|
||||
+ echo -------------------------------------------------------------
|
||||
+ echo -n "PASS: "
|
||||
+ printf "%q " "${runme[@]}"; echo
|
||||
+ diff -U30 "${cmpdir}/${blsout}" "${blsdir}/${blsout}"
|
||||
+ fi
|
||||
+ fi
|
||||
+ done
|
||||
+
|
||||
+ if [ $old_fail -eq $fail ]; then
|
||||
+ (( pass++ ))
|
||||
+ if $opt_verbose; then
|
||||
+ echo -------------------------------------------------------------
|
||||
+ echo -n "PASS: "
|
||||
+ printf "%q " "${runme[@]}"; echo
|
||||
+ "${runme[@]}" 2>&1 | diff -U30 "$cfg" -
|
||||
+ echo
|
||||
+ fi
|
||||
+ fi
|
||||
+
|
||||
+ rm -rvf ${blsdir}/ ${cmpdir}/
|
||||
+}
|
||||
+
|
||||
+
|
||||
#----------------------------------------------------------------------
|
||||
# Main
|
||||
#----------------------------------------------------------------------
|
||||
@@ -533,6 +629,15 @@ if [ "$testgrub2" == "y" ]; then
|
||||
grub2Test grub2.2 add/g2-1.4 --update-kernel=/boot/new-kernel.img \
|
||||
--initrd=/boot/new-initrd --boot-filesystem=/boot/
|
||||
|
||||
+ testing="GRUB2 add bls kernel+initrd"
|
||||
+ grub2BlsTest \
|
||||
+ --blspair 6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf,6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf \
|
||||
+ --blspair ,6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf \
|
||||
+ --grub2 grub2.15 grub2.15 \
|
||||
+ --add-kernel=/boot/new-kernel.img \
|
||||
+ --title=title --initrd=/boot/new-initrd --boot-filesystem=/boot/ \
|
||||
+ --copy-default
|
||||
+
|
||||
testing="GRUB2 display default index"
|
||||
grub2DisplayTest grub2.1 defaultindex/0 --default-index
|
||||
grub2DisplayTest grub2.2 defaultindex/0 --default-index
|
||||
diff --git a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf
|
||||
new file mode 100644
|
||||
index 0000000..84b2bdf
|
||||
--- /dev/null
|
||||
+++ b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf
|
||||
@@ -0,0 +1,8 @@
|
||||
+# /boot/org/freedesktop/bls/entries/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf
|
||||
+title Fedora 19 (Rawhide)
|
||||
+version 3.8.0-2.fc19.x86_64
|
||||
+machine-id 6a9857a393724b7a981ebb5b8495b9ea
|
||||
+filesystem 6d3376e4-fc93-4509-95ec-a21d68011da2
|
||||
+linux /boot/vmlinux-3.8.0-2.fc19.x86_64
|
||||
+options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2
|
||||
+initrd /boot/initrd-3.8.0-2.fc19.x86_64
|
||||
diff --git a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf
|
||||
new file mode 100644
|
||||
index 0000000..e1c61a8
|
||||
--- /dev/null
|
||||
+++ b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf
|
||||
@@ -0,0 +1,8 @@
|
||||
+# /boot/org/freedesktop/bls/entries/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf
|
||||
+title Fedora 19 (Rawhide)
|
||||
+version 3.8.1-2.fc19.x86_64
|
||||
+machine-id 6a9857a393724b7a981ebb5b8495b9ea
|
||||
+filesystem 6d3376e4-fc93-4509-95ec-a21d68011da2
|
||||
+linux /boot/vmlinux-3.8.1-2.fc19.x86_64
|
||||
+options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2
|
||||
+initrd /boot/initrd-3.8.1-2.fc19.x86_64
|
||||
diff --git a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf
|
||||
new file mode 100644
|
||||
index 0000000..4a60fbc
|
||||
--- /dev/null
|
||||
+++ b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf
|
||||
@@ -0,0 +1,10 @@
|
||||
+# /boot/org/freedesktop/bls/entries/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf
|
||||
+title Fedora 19 (tboot) (Rawhide)
|
||||
+version 3.8.0-2.fc19.x86_64
|
||||
+machine-id 6a9857a393724b7a981ebb5b8495b9ea
|
||||
+filesystem 6d3376e4-fc93-4509-95ec-a21d68011da2
|
||||
+multiboot /boot/tboot.gz
|
||||
+ options logging=serial,vga,memory
|
||||
+linux /boot/vmlinux-3.8.0-2.fc19.x86_64
|
||||
+options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2
|
||||
+initrd /boot/initrd-3.8.0-2.fc19.x86_64
|
||||
diff --git a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf
|
||||
new file mode 100644
|
||||
index 0000000..34c0e09
|
||||
--- /dev/null
|
||||
+++ b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf
|
||||
@@ -0,0 +1,10 @@
|
||||
+# /boot/org/freedesktop/bls/entries/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf
|
||||
+title Fedora 19 (tboot) (Rawhide)
|
||||
+version 3.8.1-2.fc19.x86_64
|
||||
+machine-id 6a9857a393724b7a981ebb5b8495b9ea
|
||||
+filesystem 6d3376e4-fc93-4509-95ec-a21d68011da2
|
||||
+multiboot /boot/tboot.gz
|
||||
+ options logging=serial,vga,memory
|
||||
+linux /boot/vmlinux-3.8.1-2.fc19.x86_64
|
||||
+options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2
|
||||
+initrd /boot/initrd-3.8.1-2.fc19.x86_64
|
||||
diff --git a/test/grub2.15 b/test/grub2.15
|
||||
new file mode 100644
|
||||
index 0000000..0be2d74
|
||||
--- /dev/null
|
||||
+++ b/test/grub2.15
|
||||
@@ -0,0 +1,112 @@
|
||||
+#
|
||||
+# DO NOT EDIT THIS FILE
|
||||
+#
|
||||
+# It is automatically generated by grub2-mkconfig using templates
|
||||
+# from /etc/grub.d and settings from /etc/default/grub
|
||||
+#
|
||||
+
|
||||
+### BEGIN /etc/grub.d/00_header ###
|
||||
+if [ -s $prefix/grubenv ]; then
|
||||
+ load_env
|
||||
+fi
|
||||
+if [ "${next_entry}" ] ; then
|
||||
+ set default="${next_entry}"
|
||||
+ set next_entry=
|
||||
+ save_env next_entry
|
||||
+ set boot_once=true
|
||||
+else
|
||||
+ set default="${saved_entry}"
|
||||
+fi
|
||||
+
|
||||
+if [ x"${feature_menuentry_id}" = xy ]; then
|
||||
+ menuentry_id_option="--id"
|
||||
+else
|
||||
+ menuentry_id_option=""
|
||||
+fi
|
||||
+
|
||||
+export menuentry_id_option
|
||||
+
|
||||
+if [ "${prev_saved_entry}" ]; then
|
||||
+ set saved_entry="${prev_saved_entry}"
|
||||
+ save_env saved_entry
|
||||
+ set prev_saved_entry=
|
||||
+ save_env prev_saved_entry
|
||||
+ set boot_once=true
|
||||
+fi
|
||||
+
|
||||
+function savedefault {
|
||||
+ if [ -z "${boot_once}" ]; then
|
||||
+ saved_entry="${chosen}"
|
||||
+ save_env saved_entry
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+function load_video {
|
||||
+ if [ x$feature_all_video_module = xy ]; then
|
||||
+ insmod all_video
|
||||
+ else
|
||||
+ insmod efi_gop
|
||||
+ insmod efi_uga
|
||||
+ insmod ieee1275_fb
|
||||
+ insmod vbe
|
||||
+ insmod vga
|
||||
+ insmod video_bochs
|
||||
+ insmod video_cirrus
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+if [ x$feature_default_font_path = xy ] ; then
|
||||
+ font=unicode
|
||||
+else
|
||||
+insmod part_gpt
|
||||
+insmod btrfs
|
||||
+set root='hd0,gpt4'
|
||||
+if [ x$feature_platform_search_hint = xy ]; then
|
||||
+ search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4 5a2ca487-30f7-4fa5-96bd-abe38b68ceb3
|
||||
+else
|
||||
+ search --no-floppy --fs-uuid --set=root 5a2ca487-30f7-4fa5-96bd-abe38b68ceb3
|
||||
+fi
|
||||
+ font="/root/usr/share/grub/unicode.pf2"
|
||||
+fi
|
||||
+
|
||||
+if loadfont $font ; then
|
||||
+ set gfxmode=auto
|
||||
+ load_video
|
||||
+ insmod gfxterm
|
||||
+ set locale_dir=$prefix/locale
|
||||
+ set lang=en_US
|
||||
+ insmod gettext
|
||||
+fi
|
||||
+terminal_output gfxterm
|
||||
+set timeout=5
|
||||
+### END /etc/grub.d/00_header ###
|
||||
+
|
||||
+### BEGIN /etc/grub.d/10_blscfg ###
|
||||
+
|
||||
+bls_import
|
||||
+
|
||||
+### END /etc/grub.d/10_blscfg ###
|
||||
+
|
||||
+### BEGIN /etc/grub.d/20_linux_xen ###
|
||||
+
|
||||
+### END /etc/grub.d/20_linux_xen ###
|
||||
+
|
||||
+### BEGIN /etc/grub.d/20_ppc_terminfo ###
|
||||
+### END /etc/grub.d/20_ppc_terminfo ###
|
||||
+
|
||||
+### BEGIN /etc/grub.d/30_os-prober ###
|
||||
+### END /etc/grub.d/30_os-prober ###
|
||||
+
|
||||
+### BEGIN /etc/grub.d/40_custom ###
|
||||
+# This file provides an easy way to add custom menu entries. Simply type the
|
||||
+# menu entries you want to add after this comment. Be careful not to change
|
||||
+# the 'exec tail' line above.
|
||||
+### END /etc/grub.d/40_custom ###
|
||||
+
|
||||
+### BEGIN /etc/grub.d/41_custom ###
|
||||
+if [ -f ${config_directory}/custom.cfg ]; then
|
||||
+ source ${config_directory}/custom.cfg
|
||||
+elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
|
||||
+ source $prefix/custom.cfg;
|
||||
+fi
|
||||
+### END /etc/grub.d/41_custom ###
|
||||
diff --git a/test/results/grub2.15 b/test/results/grub2.15
|
||||
new file mode 100644
|
||||
index 0000000..0be2d74
|
||||
--- /dev/null
|
||||
+++ b/test/results/grub2.15
|
||||
@@ -0,0 +1,112 @@
|
||||
+#
|
||||
+# DO NOT EDIT THIS FILE
|
||||
+#
|
||||
+# It is automatically generated by grub2-mkconfig using templates
|
||||
+# from /etc/grub.d and settings from /etc/default/grub
|
||||
+#
|
||||
+
|
||||
+### BEGIN /etc/grub.d/00_header ###
|
||||
+if [ -s $prefix/grubenv ]; then
|
||||
+ load_env
|
||||
+fi
|
||||
+if [ "${next_entry}" ] ; then
|
||||
+ set default="${next_entry}"
|
||||
+ set next_entry=
|
||||
+ save_env next_entry
|
||||
+ set boot_once=true
|
||||
+else
|
||||
+ set default="${saved_entry}"
|
||||
+fi
|
||||
+
|
||||
+if [ x"${feature_menuentry_id}" = xy ]; then
|
||||
+ menuentry_id_option="--id"
|
||||
+else
|
||||
+ menuentry_id_option=""
|
||||
+fi
|
||||
+
|
||||
+export menuentry_id_option
|
||||
+
|
||||
+if [ "${prev_saved_entry}" ]; then
|
||||
+ set saved_entry="${prev_saved_entry}"
|
||||
+ save_env saved_entry
|
||||
+ set prev_saved_entry=
|
||||
+ save_env prev_saved_entry
|
||||
+ set boot_once=true
|
||||
+fi
|
||||
+
|
||||
+function savedefault {
|
||||
+ if [ -z "${boot_once}" ]; then
|
||||
+ saved_entry="${chosen}"
|
||||
+ save_env saved_entry
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+function load_video {
|
||||
+ if [ x$feature_all_video_module = xy ]; then
|
||||
+ insmod all_video
|
||||
+ else
|
||||
+ insmod efi_gop
|
||||
+ insmod efi_uga
|
||||
+ insmod ieee1275_fb
|
||||
+ insmod vbe
|
||||
+ insmod vga
|
||||
+ insmod video_bochs
|
||||
+ insmod video_cirrus
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+if [ x$feature_default_font_path = xy ] ; then
|
||||
+ font=unicode
|
||||
+else
|
||||
+insmod part_gpt
|
||||
+insmod btrfs
|
||||
+set root='hd0,gpt4'
|
||||
+if [ x$feature_platform_search_hint = xy ]; then
|
||||
+ search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4 5a2ca487-30f7-4fa5-96bd-abe38b68ceb3
|
||||
+else
|
||||
+ search --no-floppy --fs-uuid --set=root 5a2ca487-30f7-4fa5-96bd-abe38b68ceb3
|
||||
+fi
|
||||
+ font="/root/usr/share/grub/unicode.pf2"
|
||||
+fi
|
||||
+
|
||||
+if loadfont $font ; then
|
||||
+ set gfxmode=auto
|
||||
+ load_video
|
||||
+ insmod gfxterm
|
||||
+ set locale_dir=$prefix/locale
|
||||
+ set lang=en_US
|
||||
+ insmod gettext
|
||||
+fi
|
||||
+terminal_output gfxterm
|
||||
+set timeout=5
|
||||
+### END /etc/grub.d/00_header ###
|
||||
+
|
||||
+### BEGIN /etc/grub.d/10_blscfg ###
|
||||
+
|
||||
+bls_import
|
||||
+
|
||||
+### END /etc/grub.d/10_blscfg ###
|
||||
+
|
||||
+### BEGIN /etc/grub.d/20_linux_xen ###
|
||||
+
|
||||
+### END /etc/grub.d/20_linux_xen ###
|
||||
+
|
||||
+### BEGIN /etc/grub.d/20_ppc_terminfo ###
|
||||
+### END /etc/grub.d/20_ppc_terminfo ###
|
||||
+
|
||||
+### BEGIN /etc/grub.d/30_os-prober ###
|
||||
+### END /etc/grub.d/30_os-prober ###
|
||||
+
|
||||
+### BEGIN /etc/grub.d/40_custom ###
|
||||
+# This file provides an easy way to add custom menu entries. Simply type the
|
||||
+# menu entries you want to add after this comment. Be careful not to change
|
||||
+# the 'exec tail' line above.
|
||||
+### END /etc/grub.d/40_custom ###
|
||||
+
|
||||
+### BEGIN /etc/grub.d/41_custom ###
|
||||
+if [ -f ${config_directory}/custom.cfg ]; then
|
||||
+ source ${config_directory}/custom.cfg
|
||||
+elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
|
||||
+ source $prefix/custom.cfg;
|
||||
+fi
|
||||
+### END /etc/grub.d/41_custom ###
|
||||
--
|
||||
1.9.3
|
||||
|
@ -1,143 +0,0 @@
|
||||
From 3afc4c0ed28d443bb71956b07fd45c8cfb07566f Mon Sep 17 00:00:00 2001
|
||||
From: Nathaniel McCallum <npmccallum@redhat.com>
|
||||
Date: Fri, 2 Mar 2018 14:59:32 -0500
|
||||
Subject: [PATCH 2/8] Change return type in getRootSpecifier()
|
||||
|
||||
Rather than returning a new allocation of the prefix, just return the
|
||||
length of the prefix. This change accomplishes a couple things. First,
|
||||
it reduces some memory leaks since the return value was often never
|
||||
freed. Second, it simplifies the caller who is usually only interested
|
||||
in the length of the prefix.
|
||||
---
|
||||
grubby.c | 54 +++++++++++++++++++++++++++---------------------------
|
||||
1 file changed, 27 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/grubby.c b/grubby.c
|
||||
index d4ebb86168d..a062ef8e567 100644
|
||||
--- a/grubby.c
|
||||
+++ b/grubby.c
|
||||
@@ -675,7 +675,7 @@ static int lineWrite(FILE * out, struct singleLine * line,
|
||||
struct configFileInfo * cfi);
|
||||
static int getNextLine(char ** bufPtr, struct singleLine * line,
|
||||
struct configFileInfo * cfi);
|
||||
-static char * getRootSpecifier(char * str);
|
||||
+static size_t getRootSpecifier(const char *str);
|
||||
static void requote(struct singleLine *line, struct configFileInfo * cfi);
|
||||
static void insertElement(struct singleLine * line,
|
||||
const char * item, int insertHere,
|
||||
@@ -1840,7 +1840,7 @@ int suitableImage(struct singleEntry * entry, const char * bootPrefix,
|
||||
char * fullName;
|
||||
int i;
|
||||
char * dev;
|
||||
- char * rootspec;
|
||||
+ size_t rs;
|
||||
char * rootdev;
|
||||
|
||||
if (skipRemoved && entry->skip) {
|
||||
@@ -1866,12 +1866,11 @@ int suitableImage(struct singleEntry * entry, const char * bootPrefix,
|
||||
|
||||
fullName = alloca(strlen(bootPrefix) +
|
||||
strlen(line->elements[1].item) + 1);
|
||||
- rootspec = getRootSpecifier(line->elements[1].item);
|
||||
- int rootspec_offset = rootspec ? strlen(rootspec) : 0;
|
||||
+ rs = getRootSpecifier(line->elements[1].item);
|
||||
int hasslash = endswith(bootPrefix, '/') ||
|
||||
- beginswith(line->elements[1].item + rootspec_offset, '/');
|
||||
+ beginswith(line->elements[1].item + rs, '/');
|
||||
sprintf(fullName, "%s%s%s", bootPrefix, hasslash ? "" : "/",
|
||||
- line->elements[1].item + rootspec_offset);
|
||||
+ line->elements[1].item + rs);
|
||||
if (access(fullName, R_OK)) {
|
||||
notSuitablePrintf(entry, 0, "access to %s failed\n", fullName);
|
||||
return 0;
|
||||
@@ -1952,7 +1951,6 @@ struct singleEntry * findEntryByPath(struct grubConfig * config,
|
||||
struct singleLine * line;
|
||||
int i;
|
||||
char * chptr;
|
||||
- char * rootspec = NULL;
|
||||
enum lineType_e checkType = LT_KERNEL;
|
||||
|
||||
if (isdigit(*kernel)) {
|
||||
@@ -2044,11 +2042,10 @@ struct singleEntry * findEntryByPath(struct grubConfig * config,
|
||||
|
||||
if (line && line->type != LT_MENUENTRY &&
|
||||
line->numElements >= 2) {
|
||||
- rootspec = getRootSpecifier(line->elements[1].item);
|
||||
- if (!strcmp(line->elements[1].item +
|
||||
- ((rootspec != NULL) ? strlen(rootspec) : 0),
|
||||
- kernel + strlen(prefix)))
|
||||
- break;
|
||||
+ if (!strcmp(line->elements[1].item +
|
||||
+ getRootSpecifier(line->elements[1].item),
|
||||
+ kernel + strlen(prefix)))
|
||||
+ break;
|
||||
}
|
||||
if(line->type == LT_MENUENTRY &&
|
||||
!strcmp(line->elements[1].item, kernel))
|
||||
@@ -2797,11 +2794,11 @@ struct singleLine * addLineTmpl(struct singleEntry * entry,
|
||||
|
||||
/* but try to keep the rootspec from the template... sigh */
|
||||
if (tmplLine->type & (LT_HYPER|LT_KERNEL|LT_MBMODULE|LT_INITRD|LT_KERNEL_EFI|LT_INITRD_EFI|LT_KERNEL_16|LT_INITRD_16)) {
|
||||
- char * rootspec = getRootSpecifier(tmplLine->elements[1].item);
|
||||
- if (rootspec != NULL) {
|
||||
- free(newLine->elements[1].item);
|
||||
- newLine->elements[1].item =
|
||||
- sdupprintf("%s%s", rootspec, val);
|
||||
+ size_t rs = getRootSpecifier(tmplLine->elements[1].item);
|
||||
+ if (rs > 0) {
|
||||
+ free(newLine->elements[1].item);
|
||||
+ newLine->elements[1].item = sdupprintf("%.*s%s", (int) rs,
|
||||
+ tmplLine->elements[1].item, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3729,15 +3726,19 @@ int checkForElilo(struct grubConfig * config) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
-static char * getRootSpecifier(char * str) {
|
||||
- char * idx, * rootspec = NULL;
|
||||
+static size_t getRootSpecifier(const char *str)
|
||||
+{
|
||||
+ size_t rs = 0;
|
||||
|
||||
if (*str == '(') {
|
||||
- idx = rootspec = strdup(str);
|
||||
- while(*idx && (*idx != ')') && (!isspace(*idx))) idx++;
|
||||
- *(++idx) = '\0';
|
||||
+ for (; str[rs] != ')' && !isspace(str[rs]); rs++) {
|
||||
+ if (!str[rs])
|
||||
+ return rs;
|
||||
+ }
|
||||
+ rs++;
|
||||
}
|
||||
- return rootspec;
|
||||
+
|
||||
+ return rs;
|
||||
}
|
||||
|
||||
static char * getInitrdVal(struct grubConfig * config,
|
||||
@@ -4616,7 +4617,7 @@ int main(int argc, const char ** argv) {
|
||||
if (displayDefault) {
|
||||
struct singleLine * line;
|
||||
struct singleEntry * entry;
|
||||
- char * rootspec;
|
||||
+ size_t rs;
|
||||
|
||||
if (config->defaultImage == -1) return 0;
|
||||
if (config->defaultImage == DEFAULT_SAVED_GRUB2 &&
|
||||
@@ -4629,9 +4630,8 @@ int main(int argc, const char ** argv) {
|
||||
line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines);
|
||||
if (!line) return 0;
|
||||
|
||||
- rootspec = getRootSpecifier(line->elements[1].item);
|
||||
- printf("%s%s\n", bootPrefix, line->elements[1].item +
|
||||
- ((rootspec != NULL) ? strlen(rootspec) : 0));
|
||||
+ rs = getRootSpecifier(line->elements[1].item);
|
||||
+ printf("%s%s\n", bootPrefix, line->elements[1].item + rs);
|
||||
|
||||
return 0;
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,209 +0,0 @@
|
||||
From 112b6e5fc690b2a73b6ad8c92dc4645db08503b6 Mon Sep 17 00:00:00 2001
|
||||
From: Nathaniel McCallum <npmccallum@redhat.com>
|
||||
Date: Fri, 2 Mar 2018 08:40:18 -0500
|
||||
Subject: [PATCH 3/8] Add btrfs subvolume support for grub2
|
||||
|
||||
In order to find the subvolume prefix from a given path, we parse
|
||||
/proc/mounts. In cases where /proc/mounts doesn't contain the
|
||||
filesystem, the caller can use the --mounts option to specify his own
|
||||
mounts file.
|
||||
|
||||
Btrfs subvolumes are already supported by grub2 and by grub2-mkconfig.
|
||||
|
||||
Fixes #22
|
||||
---
|
||||
grubby.c | 148 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 143 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/grubby.c b/grubby.c
|
||||
index a062ef8e567..96d252a0a83 100644
|
||||
--- a/grubby.c
|
||||
+++ b/grubby.c
|
||||
@@ -68,6 +68,8 @@ int isEfi = 0;
|
||||
|
||||
char *saved_command_line = NULL;
|
||||
|
||||
+const char *mounts = "/proc/mounts";
|
||||
+
|
||||
/* comments get lumped in with indention */
|
||||
struct lineElement {
|
||||
char * item;
|
||||
@@ -1834,6 +1836,129 @@ static int endswith(const char *s, char c)
|
||||
return s[slen] == c;
|
||||
}
|
||||
|
||||
+typedef struct {
|
||||
+ const char *start;
|
||||
+ size_t chars;
|
||||
+} field;
|
||||
+
|
||||
+static int iscomma(int c)
|
||||
+{
|
||||
+ return c == ',';
|
||||
+}
|
||||
+
|
||||
+static int isequal(int c)
|
||||
+{
|
||||
+ return c == '=';
|
||||
+}
|
||||
+
|
||||
+static field findField(const field *in, typeof(isspace) *isdelim, field *out)
|
||||
+{
|
||||
+ field nxt = {};
|
||||
+ size_t off = 0;
|
||||
+
|
||||
+ while (off < in->chars && isdelim(in->start[off]))
|
||||
+ off++;
|
||||
+
|
||||
+ if (off == in->chars)
|
||||
+ return nxt;
|
||||
+
|
||||
+ out->start = &in->start[off];
|
||||
+ out->chars = 0;
|
||||
+
|
||||
+ while (off + out->chars < in->chars && !isdelim(out->start[out->chars]))
|
||||
+ out->chars++;
|
||||
+
|
||||
+ nxt.start = out->start + out->chars;
|
||||
+ nxt.chars = in->chars - off - out->chars;
|
||||
+ return nxt;
|
||||
+}
|
||||
+
|
||||
+static int fieldEquals(const field *in, const char *str)
|
||||
+{
|
||||
+ return in->chars == strlen(str) &&
|
||||
+ strncmp(in->start, str, in->chars) == 0;
|
||||
+}
|
||||
+
|
||||
+/* Parse /proc/mounts to determine the subvolume prefix. */
|
||||
+static size_t subvolPrefix(const char *str)
|
||||
+{
|
||||
+ FILE *file = NULL;
|
||||
+ char *line = NULL;
|
||||
+ size_t prfx = 0;
|
||||
+ size_t size = 0;
|
||||
+
|
||||
+ file = fopen(mounts, "r");
|
||||
+ if (!file)
|
||||
+ return 0;
|
||||
+
|
||||
+ for (ssize_t s; (s = getline(&line, &size, file)) >= 0; ) {
|
||||
+ field nxt = { line, s };
|
||||
+ field dev = {};
|
||||
+ field path = {};
|
||||
+ field type = {};
|
||||
+ field opts = {};
|
||||
+ field opt = {};
|
||||
+
|
||||
+ nxt = findField(&nxt, isspace, &dev);
|
||||
+ if (!nxt.start)
|
||||
+ continue;
|
||||
+
|
||||
+ nxt = findField(&nxt, isspace, &path);
|
||||
+ if (!nxt.start)
|
||||
+ continue;
|
||||
+
|
||||
+ nxt = findField(&nxt, isspace, &type);
|
||||
+ if (!nxt.start)
|
||||
+ continue;
|
||||
+
|
||||
+ nxt = findField(&nxt, isspace, &opts);
|
||||
+ if (!nxt.start)
|
||||
+ continue;
|
||||
+
|
||||
+ if (!fieldEquals(&type, "btrfs"))
|
||||
+ continue;
|
||||
+
|
||||
+ /* We have found a btrfs mount point. */
|
||||
+
|
||||
+ nxt = opts;
|
||||
+ while ((nxt = findField(&nxt, iscomma, &opt)).start) {
|
||||
+ field key = {};
|
||||
+ field val = {};
|
||||
+
|
||||
+ opt = findField(&opt, isequal, &key);
|
||||
+ if (!opt.start)
|
||||
+ continue;
|
||||
+
|
||||
+ opt = findField(&opt, isequal, &val);
|
||||
+ if (!opt.start)
|
||||
+ continue;
|
||||
+
|
||||
+ if (!fieldEquals(&key, "subvol"))
|
||||
+ continue;
|
||||
+
|
||||
+ /* We have found a btrfs subvolume mount point. */
|
||||
+
|
||||
+ if (strncmp(val.start, str, val.chars))
|
||||
+ continue;
|
||||
+
|
||||
+ if (val.start[val.chars - 1] != '/' &&
|
||||
+ str[val.chars] != '/')
|
||||
+ continue;
|
||||
+
|
||||
+ /* The subvolume mount point matches our input. */
|
||||
+
|
||||
+ if (prfx < val.chars)
|
||||
+ prfx = val.chars;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ dbgPrintf("%s(): str: '%s', prfx: '%s'\n", __FUNCTION__, str, prfx);
|
||||
+
|
||||
+ fclose(file);
|
||||
+ free(line);
|
||||
+ return prfx;
|
||||
+}
|
||||
+
|
||||
int suitableImage(struct singleEntry * entry, const char * bootPrefix,
|
||||
int skipRemoved, int flags) {
|
||||
struct singleLine * line;
|
||||
@@ -2794,12 +2919,22 @@ struct singleLine * addLineTmpl(struct singleEntry * entry,
|
||||
|
||||
/* but try to keep the rootspec from the template... sigh */
|
||||
if (tmplLine->type & (LT_HYPER|LT_KERNEL|LT_MBMODULE|LT_INITRD|LT_KERNEL_EFI|LT_INITRD_EFI|LT_KERNEL_16|LT_INITRD_16)) {
|
||||
- size_t rs = getRootSpecifier(tmplLine->elements[1].item);
|
||||
+ const char *prfx = tmplLine->elements[1].item;
|
||||
+ size_t rs = getRootSpecifier(prfx);
|
||||
+ if (isinitrd(tmplLine->type)) {
|
||||
+ for (struct singleLine *l = entry->lines;
|
||||
+ rs == 0 && l; l = l->next) {
|
||||
+ if (iskernel(l->type)) {
|
||||
+ prfx = l->elements[1].item;
|
||||
+ rs = getRootSpecifier(prfx);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
if (rs > 0) {
|
||||
free(newLine->elements[1].item);
|
||||
- newLine->elements[1].item = sdupprintf("%.*s%s", (int) rs,
|
||||
- tmplLine->elements[1].item, val);
|
||||
- }
|
||||
+ newLine->elements[1].item = sdupprintf("%.*s%s",
|
||||
+ (int) rs, prfx, val);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3738,7 +3873,7 @@ static size_t getRootSpecifier(const char *str)
|
||||
rs++;
|
||||
}
|
||||
|
||||
- return rs;
|
||||
+ return rs + subvolPrefix(str + rs);
|
||||
}
|
||||
|
||||
static char * getInitrdVal(struct grubConfig * config,
|
||||
@@ -4253,6 +4388,9 @@ int main(int argc, const char ** argv) {
|
||||
{ "mbargs", 0, POPT_ARG_STRING, &newMBKernelArgs, 0,
|
||||
_("default arguments for the new multiboot kernel or "
|
||||
"new arguments for multiboot kernel being updated"), NULL },
|
||||
+ { "mounts", 0, POPT_ARG_STRING, &mounts, 0,
|
||||
+ _("path to fake /proc/mounts file (for testing only)"),
|
||||
+ _("mounts") },
|
||||
{ "bad-image-okay", 0, 0, &badImageOkay, 0,
|
||||
_("don't sanity check images in boot entries (for testing only)"),
|
||||
NULL },
|
||||
--
|
||||
2.17.1
|
||||
|
37
0003-grubby-fix-initrd-updating-when-multiboot-exist.patch
Normal file
37
0003-grubby-fix-initrd-updating-when-multiboot-exist.patch
Normal file
@ -0,0 +1,37 @@
|
||||
From e91855ce14df65d12f681c15dfba5b22a2b4a061 Mon Sep 17 00:00:00 2001
|
||||
From: Junxiao Bi <junxiao.bi@oracle.com>
|
||||
Date: Wed, 14 May 2014 16:44:21 +0800
|
||||
Subject: [PATCH 03/10] grubby: fix initrd updating when multiboot exist
|
||||
|
||||
When using the following command to add an initrd for the kernel.
|
||||
grubby --update-kernel=/boot/vmlinuz-2.6.32-431.17.1.el6.x86_64.debug
|
||||
--initrd /boot/initramfs-2.6.32-431.17.1.el6.x86_64.debug.img
|
||||
--add-multiboot=/boot/tboot.gz
|
||||
The multiboot image /boot/tboot.gz is used as the key to search the
|
||||
configure entry in grub.conf, this is wrong. There may be other kernels
|
||||
also configure multiboot with the same name tboot.gz, if there index are
|
||||
smaller than the target one, then that will make the initrd added to the
|
||||
wrong kernel. Fix it to use kernel name as the search key.
|
||||
|
||||
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
|
||||
Reviewed-by: John Haxby <john.haxby@oracle.com>
|
||||
---
|
||||
grubby.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grubby.c b/grubby.c
|
||||
index db91364..118cb84 100644
|
||||
--- a/grubby.c
|
||||
+++ b/grubby.c
|
||||
@@ -3311,7 +3311,7 @@ int addMBInitrd(struct grubConfig * cfg, const char *newMBKernel,
|
||||
|
||||
if (!image) return 0;
|
||||
|
||||
- for (; (entry = findEntryByPath(cfg, newMBKernel, prefix, &index)); index++) {
|
||||
+ for (; (entry = findEntryByPath(cfg, image, prefix, &index)); index++) {
|
||||
kernelLine = getLineByType(LT_MBMODULE, entry->lines);
|
||||
if (!kernelLine) continue;
|
||||
|
||||
--
|
||||
1.9.3
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,46 @@
|
||||
From dbd5b06ce590ca638e3c44746183f6f2379e820f Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Fri, 12 Sep 2014 15:50:05 -0400
|
||||
Subject: [PATCH 04/10] Tell a slightly better fib about default bootloader
|
||||
config paths.
|
||||
|
||||
It's not going to be right everywhere, but... whatever.
|
||||
|
||||
Resolves: rhbz#1001664
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grubby.8 | 14 ++++++++------
|
||||
1 file changed, 8 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/grubby.8 b/grubby.8
|
||||
index c2b0155..bd5ccb8 100644
|
||||
--- a/grubby.8
|
||||
+++ b/grubby.8
|
||||
@@ -19,16 +19,18 @@ grubby \- command line tool for configuring grub, lilo, elilo, yaboot and zipl
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBgrubby\fR is a command line tool for updating and displaying information
|
||||
-about the configuration files for the \fBgrub\fR, \fBlilo\fR, \fBelilo\fR
|
||||
+about the configuration files for the \fBgrub\fR, \fBlilo\fR, \fBelilo\fR
|
||||
(ia64), \fByaboot\fR (powerpc) and \fBzipl\fR (s390) boot loaders. It
|
||||
is primarily designed to be used from scripts which install new
|
||||
kernels and need to find information about the current boot environment.
|
||||
|
||||
-On Intel x86 platforms, \fBgrub\fR is the default bootloader and the
|
||||
-configuration file is in \fB/boot/grub/grub.conf\fR. On Intel ia64 platforms,
|
||||
-\fBelilo\fR mode is used and the default location for the configuration file
|
||||
-is \fB/boot/grub/grub.conf\fR. On PowerPC platforms, \fByaboot\fR parsing
|
||||
-is used and the configuration file should be in \fB/etc/yaboot.conf\fR.
|
||||
+On BIOS-based Intel x86 platforms, \fBgrub2\fR is the default bootloader and
|
||||
+the configuration file is in \fB/boot/grub2/grub.cfg\fR. On UEFI-based Intel
|
||||
+x86 platforms, \fBgrub2\fR is the default bootloader, and the configuration
|
||||
+file is in \fB/boot/efi/EFI/redhat/grub.cfg\fR. On Intel ia64 platforms,
|
||||
+\fBelilo\fR mode is used and the default location for the configuration file
|
||||
+is \fB/boot/efi/EFI/redhat/elilo.conf\fR. On PowerPC platforms, \fByaboot\fR
|
||||
+parsing is used and the configuration file should be in \fB/etc/yaboot.conf\fR.
|
||||
|
||||
There are a number of ways to specify the kernel used for \fB-\-info\fR,
|
||||
\fB-\-remove-kernel\fR, and \fB-\-update-kernel\fR. Specificying \fBDEFAULT\fR
|
||||
--
|
||||
1.9.3
|
||||
|
@ -0,0 +1,35 @@
|
||||
From 629922b6dc32e4209980d7198b7d2aabb722033a Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 15 Sep 2014 14:31:01 -0400
|
||||
Subject: [PATCH 05/10] Make findTemplate actually return the saved default.
|
||||
|
||||
Really not sure why this wasn't returning here before; going into the
|
||||
loop below is just going to clobber all that it's done.
|
||||
|
||||
Related: rhbz#957681
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grubby.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grubby.c b/grubby.c
|
||||
index 118cb84..baf646b 100644
|
||||
--- a/grubby.c
|
||||
+++ b/grubby.c
|
||||
@@ -2119,8 +2119,12 @@ struct singleEntry * findTemplate(struct grubConfig * cfg, const char * prefix,
|
||||
} else {
|
||||
entry = findEntryByTitle(cfg, defTitle, &index);
|
||||
}
|
||||
- if (entry)
|
||||
+ if (entry && suitableImage(entry, prefix, skipRemoved, flags)) {
|
||||
cfg->defaultImage = index;
|
||||
+ if (indexPtr)
|
||||
+ *indexPtr = index;
|
||||
+ return entry;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
} else if (cfg->defaultImage > -1) {
|
||||
--
|
||||
1.9.3
|
||||
|
@ -1,25 +0,0 @@
|
||||
From e08c858af4d2b09e62441560f3ccecc9e750c87a Mon Sep 17 00:00:00 2001
|
||||
From: Rafael dos Santos <rdossant@redhat.com>
|
||||
Date: Tue, 29 May 2018 15:15:24 +0200
|
||||
Subject: [PATCH 5/8] Use system LDFLAGS
|
||||
|
||||
---
|
||||
Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index ac144046133..f0d13720db5 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -25,7 +25,7 @@ OBJECTS = grubby.o log.o
|
||||
CC = gcc
|
||||
RPM_OPT_FLAGS ?= -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector
|
||||
CFLAGS += $(RPM_OPT_FLAGS) -std=gnu99 -Wall -Werror -Wno-error=unused-function -Wno-unused-function -ggdb
|
||||
-LDFLAGS :=
|
||||
+LDFLAGS := $(RPM_LD_FLAGS)
|
||||
|
||||
grubby_LIBS = -lblkid -lpopt
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,36 +0,0 @@
|
||||
From db200499551e386e7616c621fcbd69e350081664 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Wed, 18 Jul 2018 13:41:02 -0400
|
||||
Subject: [PATCH 6/8] Honor sbindir
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
Makefile | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index f0d13720db5..cfa8e0d60ab 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -42,14 +42,14 @@ test: all
|
||||
@./test.sh
|
||||
|
||||
install: all
|
||||
- mkdir -p $(DESTDIR)$(PREFIX)/sbin
|
||||
+ mkdir -p $(DESTDIR)$(PREFIX)$(sbindir)
|
||||
mkdir -p $(DESTDIR)/$(mandir)/man8
|
||||
- install -m 755 new-kernel-pkg $(DESTDIR)$(PREFIX)/sbin
|
||||
+ install -m 755 new-kernel-pkg $(DESTDIR)$(PREFIX)$(sbindir)
|
||||
install -m 644 new-kernel-pkg.8 $(DESTDIR)/$(mandir)/man8
|
||||
- install -m 755 installkernel $(DESTDIR)$(PREFIX)/sbin
|
||||
+ install -m 755 installkernel $(DESTDIR)$(PREFIX)$(sbindir)
|
||||
install -m 644 installkernel.8 $(DESTDIR)/$(mandir)/man8
|
||||
if [ -f grubby ]; then \
|
||||
- install -m 755 grubby $(DESTDIR)$(PREFIX)/sbin ; \
|
||||
+ install -m 755 grubby $(DESTDIR)$(PREFIX)$(sbindir) ; \
|
||||
install -m 644 grubby.8 $(DESTDIR)/$(mandir)/man8 ; \
|
||||
fi
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
446
0006-Revert-Add-bls-test-harness-bits.patch
Normal file
446
0006-Revert-Add-bls-test-harness-bits.patch
Normal file
@ -0,0 +1,446 @@
|
||||
From 0950d2e8693339a36f59c966dc8558263331665c Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 15 Sep 2014 16:49:26 -0400
|
||||
Subject: [PATCH 06/10] Revert "Add bls test harness bits."
|
||||
|
||||
This wasn't supposed to be pushed to master yet. woops.
|
||||
|
||||
This reverts commit 98cab84501f86bd98f12653c11f4ecc632139399.
|
||||
---
|
||||
test.sh | 105 -------------------
|
||||
...724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf | 8 --
|
||||
...724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf | 8 --
|
||||
...981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf | 10 --
|
||||
...981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf | 10 --
|
||||
test/grub2.15 | 112 ---------------------
|
||||
test/results/grub2.15 | 112 ---------------------
|
||||
7 files changed, 365 deletions(-)
|
||||
delete mode 100644 test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf
|
||||
delete mode 100644 test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf
|
||||
delete mode 100644 test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf
|
||||
delete mode 100644 test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf
|
||||
delete mode 100644 test/grub2.15
|
||||
delete mode 100644 test/results/grub2.15
|
||||
|
||||
diff --git a/test.sh b/test.sh
|
||||
index e7be15f..864a8ce 100755
|
||||
--- a/test.sh
|
||||
+++ b/test.sh
|
||||
@@ -163,102 +163,6 @@ for b in $(./grubby --help | \
|
||||
eval "${b}DisplayTest() { [[ \"$b\" == \$opt_bootloader ]] && oneDisplayTest --$b \"\$@\"; }"
|
||||
done
|
||||
|
||||
-grub2BlsTest() {
|
||||
- declare blsdir=$(mktemp -d) cmpdir=$(mktemp -d)
|
||||
-
|
||||
- declare blspairs=""
|
||||
- while [ -n "$1" ]; do
|
||||
- if [ "$1" == "--blspair" ]; then
|
||||
- blsin=$(echo $2 | sed 's/\(.*\),.*/\1/')
|
||||
- blsout=$(echo $2 | sed 's/[^,]*,\(.*\)/\1/')
|
||||
- [ -n "$blsin" ] && cp "test/grub2-support_files/$blsin" ${blsdir}/
|
||||
- [ -n "$blsout" ] && cp "test/grub2-support_files/$blsout" ${cmpdir}/
|
||||
- blspairs="${blspairs} $2"
|
||||
- shift 2
|
||||
- else
|
||||
- break
|
||||
- fi
|
||||
- done
|
||||
-
|
||||
- typeset mode=$1 cfg=test/$2 correct=test/results/$3
|
||||
- shift 3
|
||||
-
|
||||
- local ENV_FILE=""
|
||||
- if [ "$mode" == "--grub2" ]; then
|
||||
- ENV_FILE="test/grub2-support_files/env_temp"
|
||||
- if [ "$1" == "--env" ]; then
|
||||
- cp "test/grub2-support_files/$2" "$ENV_FILE"
|
||||
- shift 2
|
||||
- else
|
||||
- cp "test/grub2-support_files/grubenv.0" "$ENV_FILE"
|
||||
- fi
|
||||
- ENV_FILE="--env=$ENV_FILE"
|
||||
- fi
|
||||
-
|
||||
- declare outfile=$(mktemp)
|
||||
- echo "$testing ... $mode bls $cfg $correct"
|
||||
- runme=( ./grubby "$mode" --bad-image-okay $ENV_FILE -c "$cfg" -o - --blsdir="${blsdir}" "$@" )
|
||||
- declare -i old_fail=$fail
|
||||
- if "${runme[@]}" 2>&1 | cmp "$correct" > /dev/null; then
|
||||
- (( pass++ ))
|
||||
- if $opt_verbose; then
|
||||
- echo -------------------------------------------------------------
|
||||
- echo -n "PASS: "
|
||||
- printf "%q " "${runme[@]}"; echo
|
||||
- "${runme[@]}" 2>&1 | diff -U30 "$cfg" -
|
||||
- echo
|
||||
- fi
|
||||
- else
|
||||
- (( fail++ ))
|
||||
- echo -------------------------------------------------------------
|
||||
- echo -n "FAIL: "
|
||||
- printf "%q " "${runme[@]}"; echo
|
||||
- "${runme[@]}" 2>&1 | diff -U30 "$correct" -
|
||||
- echo
|
||||
- fi
|
||||
-
|
||||
- for pair in ${blspairs} ; do
|
||||
- blsin=$(echo $pair | sed 's/\(.*\),.*/\1/')
|
||||
- blsout=$(echo $pair | sed 's/[^,]*,\(.*\)/\1/')
|
||||
-
|
||||
- if [ -z "${blsout}" -a -f ${blsdir}/${blsin} ]; then
|
||||
- (( fail++ ))
|
||||
- echo -------------------------------------------------------------
|
||||
- echo -n "FAIL: "
|
||||
- printf "%q " "${runme[@]}"; echo
|
||||
- diff -U30 /dev/null ${blsdir}/${blsin}
|
||||
- elif [ -n "${blsout}" ] && ! cmp ${blsdir}/${blsout} ${cmpdir}/${blsout} >/dev/null ; then
|
||||
- (( fail++ ))
|
||||
- echo -------------------------------------------------------------
|
||||
- echo -n "FAIL: "
|
||||
- printf "%q " "${runme[@]}"; echo
|
||||
- diff -U30 "${cmpdir}/${blsout}" "${blsdir}/${blsout}"
|
||||
- else
|
||||
- (( pass++ ))
|
||||
- if $opt_verbose; then
|
||||
- echo -------------------------------------------------------------
|
||||
- echo -n "PASS: "
|
||||
- printf "%q " "${runme[@]}"; echo
|
||||
- diff -U30 "${cmpdir}/${blsout}" "${blsdir}/${blsout}"
|
||||
- fi
|
||||
- fi
|
||||
- done
|
||||
-
|
||||
- if [ $old_fail -eq $fail ]; then
|
||||
- (( pass++ ))
|
||||
- if $opt_verbose; then
|
||||
- echo -------------------------------------------------------------
|
||||
- echo -n "PASS: "
|
||||
- printf "%q " "${runme[@]}"; echo
|
||||
- "${runme[@]}" 2>&1 | diff -U30 "$cfg" -
|
||||
- echo
|
||||
- fi
|
||||
- fi
|
||||
-
|
||||
- rm -rvf ${blsdir}/ ${cmpdir}/
|
||||
-}
|
||||
-
|
||||
-
|
||||
#----------------------------------------------------------------------
|
||||
# Main
|
||||
#----------------------------------------------------------------------
|
||||
@@ -629,15 +533,6 @@ if [ "$testgrub2" == "y" ]; then
|
||||
grub2Test grub2.2 add/g2-1.4 --update-kernel=/boot/new-kernel.img \
|
||||
--initrd=/boot/new-initrd --boot-filesystem=/boot/
|
||||
|
||||
- testing="GRUB2 add bls kernel+initrd"
|
||||
- grub2BlsTest \
|
||||
- --blspair 6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf,6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf \
|
||||
- --blspair ,6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf \
|
||||
- --grub2 grub2.15 grub2.15 \
|
||||
- --add-kernel=/boot/new-kernel.img \
|
||||
- --title=title --initrd=/boot/new-initrd --boot-filesystem=/boot/ \
|
||||
- --copy-default
|
||||
-
|
||||
testing="GRUB2 display default index"
|
||||
grub2DisplayTest grub2.1 defaultindex/0 --default-index
|
||||
grub2DisplayTest grub2.2 defaultindex/0 --default-index
|
||||
diff --git a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf
|
||||
deleted file mode 100644
|
||||
index 84b2bdf..0000000
|
||||
--- a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf
|
||||
+++ /dev/null
|
||||
@@ -1,8 +0,0 @@
|
||||
-# /boot/org/freedesktop/bls/entries/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf
|
||||
-title Fedora 19 (Rawhide)
|
||||
-version 3.8.0-2.fc19.x86_64
|
||||
-machine-id 6a9857a393724b7a981ebb5b8495b9ea
|
||||
-filesystem 6d3376e4-fc93-4509-95ec-a21d68011da2
|
||||
-linux /boot/vmlinux-3.8.0-2.fc19.x86_64
|
||||
-options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2
|
||||
-initrd /boot/initrd-3.8.0-2.fc19.x86_64
|
||||
diff --git a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf
|
||||
deleted file mode 100644
|
||||
index e1c61a8..0000000
|
||||
--- a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf
|
||||
+++ /dev/null
|
||||
@@ -1,8 +0,0 @@
|
||||
-# /boot/org/freedesktop/bls/entries/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf
|
||||
-title Fedora 19 (Rawhide)
|
||||
-version 3.8.1-2.fc19.x86_64
|
||||
-machine-id 6a9857a393724b7a981ebb5b8495b9ea
|
||||
-filesystem 6d3376e4-fc93-4509-95ec-a21d68011da2
|
||||
-linux /boot/vmlinux-3.8.1-2.fc19.x86_64
|
||||
-options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2
|
||||
-initrd /boot/initrd-3.8.1-2.fc19.x86_64
|
||||
diff --git a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf
|
||||
deleted file mode 100644
|
||||
index 4a60fbc..0000000
|
||||
--- a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf
|
||||
+++ /dev/null
|
||||
@@ -1,10 +0,0 @@
|
||||
-# /boot/org/freedesktop/bls/entries/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf
|
||||
-title Fedora 19 (tboot) (Rawhide)
|
||||
-version 3.8.0-2.fc19.x86_64
|
||||
-machine-id 6a9857a393724b7a981ebb5b8495b9ea
|
||||
-filesystem 6d3376e4-fc93-4509-95ec-a21d68011da2
|
||||
-multiboot /boot/tboot.gz
|
||||
- options logging=serial,vga,memory
|
||||
-linux /boot/vmlinux-3.8.0-2.fc19.x86_64
|
||||
-options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2
|
||||
-initrd /boot/initrd-3.8.0-2.fc19.x86_64
|
||||
diff --git a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf
|
||||
deleted file mode 100644
|
||||
index 34c0e09..0000000
|
||||
--- a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf
|
||||
+++ /dev/null
|
||||
@@ -1,10 +0,0 @@
|
||||
-# /boot/org/freedesktop/bls/entries/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf
|
||||
-title Fedora 19 (tboot) (Rawhide)
|
||||
-version 3.8.1-2.fc19.x86_64
|
||||
-machine-id 6a9857a393724b7a981ebb5b8495b9ea
|
||||
-filesystem 6d3376e4-fc93-4509-95ec-a21d68011da2
|
||||
-multiboot /boot/tboot.gz
|
||||
- options logging=serial,vga,memory
|
||||
-linux /boot/vmlinux-3.8.1-2.fc19.x86_64
|
||||
-options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2
|
||||
-initrd /boot/initrd-3.8.1-2.fc19.x86_64
|
||||
diff --git a/test/grub2.15 b/test/grub2.15
|
||||
deleted file mode 100644
|
||||
index 0be2d74..0000000
|
||||
--- a/test/grub2.15
|
||||
+++ /dev/null
|
||||
@@ -1,112 +0,0 @@
|
||||
-#
|
||||
-# DO NOT EDIT THIS FILE
|
||||
-#
|
||||
-# It is automatically generated by grub2-mkconfig using templates
|
||||
-# from /etc/grub.d and settings from /etc/default/grub
|
||||
-#
|
||||
-
|
||||
-### BEGIN /etc/grub.d/00_header ###
|
||||
-if [ -s $prefix/grubenv ]; then
|
||||
- load_env
|
||||
-fi
|
||||
-if [ "${next_entry}" ] ; then
|
||||
- set default="${next_entry}"
|
||||
- set next_entry=
|
||||
- save_env next_entry
|
||||
- set boot_once=true
|
||||
-else
|
||||
- set default="${saved_entry}"
|
||||
-fi
|
||||
-
|
||||
-if [ x"${feature_menuentry_id}" = xy ]; then
|
||||
- menuentry_id_option="--id"
|
||||
-else
|
||||
- menuentry_id_option=""
|
||||
-fi
|
||||
-
|
||||
-export menuentry_id_option
|
||||
-
|
||||
-if [ "${prev_saved_entry}" ]; then
|
||||
- set saved_entry="${prev_saved_entry}"
|
||||
- save_env saved_entry
|
||||
- set prev_saved_entry=
|
||||
- save_env prev_saved_entry
|
||||
- set boot_once=true
|
||||
-fi
|
||||
-
|
||||
-function savedefault {
|
||||
- if [ -z "${boot_once}" ]; then
|
||||
- saved_entry="${chosen}"
|
||||
- save_env saved_entry
|
||||
- fi
|
||||
-}
|
||||
-
|
||||
-function load_video {
|
||||
- if [ x$feature_all_video_module = xy ]; then
|
||||
- insmod all_video
|
||||
- else
|
||||
- insmod efi_gop
|
||||
- insmod efi_uga
|
||||
- insmod ieee1275_fb
|
||||
- insmod vbe
|
||||
- insmod vga
|
||||
- insmod video_bochs
|
||||
- insmod video_cirrus
|
||||
- fi
|
||||
-}
|
||||
-
|
||||
-if [ x$feature_default_font_path = xy ] ; then
|
||||
- font=unicode
|
||||
-else
|
||||
-insmod part_gpt
|
||||
-insmod btrfs
|
||||
-set root='hd0,gpt4'
|
||||
-if [ x$feature_platform_search_hint = xy ]; then
|
||||
- search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4 5a2ca487-30f7-4fa5-96bd-abe38b68ceb3
|
||||
-else
|
||||
- search --no-floppy --fs-uuid --set=root 5a2ca487-30f7-4fa5-96bd-abe38b68ceb3
|
||||
-fi
|
||||
- font="/root/usr/share/grub/unicode.pf2"
|
||||
-fi
|
||||
-
|
||||
-if loadfont $font ; then
|
||||
- set gfxmode=auto
|
||||
- load_video
|
||||
- insmod gfxterm
|
||||
- set locale_dir=$prefix/locale
|
||||
- set lang=en_US
|
||||
- insmod gettext
|
||||
-fi
|
||||
-terminal_output gfxterm
|
||||
-set timeout=5
|
||||
-### END /etc/grub.d/00_header ###
|
||||
-
|
||||
-### BEGIN /etc/grub.d/10_blscfg ###
|
||||
-
|
||||
-bls_import
|
||||
-
|
||||
-### END /etc/grub.d/10_blscfg ###
|
||||
-
|
||||
-### BEGIN /etc/grub.d/20_linux_xen ###
|
||||
-
|
||||
-### END /etc/grub.d/20_linux_xen ###
|
||||
-
|
||||
-### BEGIN /etc/grub.d/20_ppc_terminfo ###
|
||||
-### END /etc/grub.d/20_ppc_terminfo ###
|
||||
-
|
||||
-### BEGIN /etc/grub.d/30_os-prober ###
|
||||
-### END /etc/grub.d/30_os-prober ###
|
||||
-
|
||||
-### BEGIN /etc/grub.d/40_custom ###
|
||||
-# This file provides an easy way to add custom menu entries. Simply type the
|
||||
-# menu entries you want to add after this comment. Be careful not to change
|
||||
-# the 'exec tail' line above.
|
||||
-### END /etc/grub.d/40_custom ###
|
||||
-
|
||||
-### BEGIN /etc/grub.d/41_custom ###
|
||||
-if [ -f ${config_directory}/custom.cfg ]; then
|
||||
- source ${config_directory}/custom.cfg
|
||||
-elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
|
||||
- source $prefix/custom.cfg;
|
||||
-fi
|
||||
-### END /etc/grub.d/41_custom ###
|
||||
diff --git a/test/results/grub2.15 b/test/results/grub2.15
|
||||
deleted file mode 100644
|
||||
index 0be2d74..0000000
|
||||
--- a/test/results/grub2.15
|
||||
+++ /dev/null
|
||||
@@ -1,112 +0,0 @@
|
||||
-#
|
||||
-# DO NOT EDIT THIS FILE
|
||||
-#
|
||||
-# It is automatically generated by grub2-mkconfig using templates
|
||||
-# from /etc/grub.d and settings from /etc/default/grub
|
||||
-#
|
||||
-
|
||||
-### BEGIN /etc/grub.d/00_header ###
|
||||
-if [ -s $prefix/grubenv ]; then
|
||||
- load_env
|
||||
-fi
|
||||
-if [ "${next_entry}" ] ; then
|
||||
- set default="${next_entry}"
|
||||
- set next_entry=
|
||||
- save_env next_entry
|
||||
- set boot_once=true
|
||||
-else
|
||||
- set default="${saved_entry}"
|
||||
-fi
|
||||
-
|
||||
-if [ x"${feature_menuentry_id}" = xy ]; then
|
||||
- menuentry_id_option="--id"
|
||||
-else
|
||||
- menuentry_id_option=""
|
||||
-fi
|
||||
-
|
||||
-export menuentry_id_option
|
||||
-
|
||||
-if [ "${prev_saved_entry}" ]; then
|
||||
- set saved_entry="${prev_saved_entry}"
|
||||
- save_env saved_entry
|
||||
- set prev_saved_entry=
|
||||
- save_env prev_saved_entry
|
||||
- set boot_once=true
|
||||
-fi
|
||||
-
|
||||
-function savedefault {
|
||||
- if [ -z "${boot_once}" ]; then
|
||||
- saved_entry="${chosen}"
|
||||
- save_env saved_entry
|
||||
- fi
|
||||
-}
|
||||
-
|
||||
-function load_video {
|
||||
- if [ x$feature_all_video_module = xy ]; then
|
||||
- insmod all_video
|
||||
- else
|
||||
- insmod efi_gop
|
||||
- insmod efi_uga
|
||||
- insmod ieee1275_fb
|
||||
- insmod vbe
|
||||
- insmod vga
|
||||
- insmod video_bochs
|
||||
- insmod video_cirrus
|
||||
- fi
|
||||
-}
|
||||
-
|
||||
-if [ x$feature_default_font_path = xy ] ; then
|
||||
- font=unicode
|
||||
-else
|
||||
-insmod part_gpt
|
||||
-insmod btrfs
|
||||
-set root='hd0,gpt4'
|
||||
-if [ x$feature_platform_search_hint = xy ]; then
|
||||
- search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4 5a2ca487-30f7-4fa5-96bd-abe38b68ceb3
|
||||
-else
|
||||
- search --no-floppy --fs-uuid --set=root 5a2ca487-30f7-4fa5-96bd-abe38b68ceb3
|
||||
-fi
|
||||
- font="/root/usr/share/grub/unicode.pf2"
|
||||
-fi
|
||||
-
|
||||
-if loadfont $font ; then
|
||||
- set gfxmode=auto
|
||||
- load_video
|
||||
- insmod gfxterm
|
||||
- set locale_dir=$prefix/locale
|
||||
- set lang=en_US
|
||||
- insmod gettext
|
||||
-fi
|
||||
-terminal_output gfxterm
|
||||
-set timeout=5
|
||||
-### END /etc/grub.d/00_header ###
|
||||
-
|
||||
-### BEGIN /etc/grub.d/10_blscfg ###
|
||||
-
|
||||
-bls_import
|
||||
-
|
||||
-### END /etc/grub.d/10_blscfg ###
|
||||
-
|
||||
-### BEGIN /etc/grub.d/20_linux_xen ###
|
||||
-
|
||||
-### END /etc/grub.d/20_linux_xen ###
|
||||
-
|
||||
-### BEGIN /etc/grub.d/20_ppc_terminfo ###
|
||||
-### END /etc/grub.d/20_ppc_terminfo ###
|
||||
-
|
||||
-### BEGIN /etc/grub.d/30_os-prober ###
|
||||
-### END /etc/grub.d/30_os-prober ###
|
||||
-
|
||||
-### BEGIN /etc/grub.d/40_custom ###
|
||||
-# This file provides an easy way to add custom menu entries. Simply type the
|
||||
-# menu entries you want to add after this comment. Be careful not to change
|
||||
-# the 'exec tail' line above.
|
||||
-### END /etc/grub.d/40_custom ###
|
||||
-
|
||||
-### BEGIN /etc/grub.d/41_custom ###
|
||||
-if [ -f ${config_directory}/custom.cfg ]; then
|
||||
- source ${config_directory}/custom.cfg
|
||||
-elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
|
||||
- source $prefix/custom.cfg;
|
||||
-fi
|
||||
-### END /etc/grub.d/41_custom ###
|
||||
--
|
||||
1.9.3
|
||||
|
32
0007-Always-error-check-getLineByType.patch
Normal file
32
0007-Always-error-check-getLineByType.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From e3a293332591f44a190775a3b4dceefe2e5118a1 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Thu, 25 Sep 2014 13:24:15 -0400
|
||||
Subject: [PATCH 07/10] Always error check getLineByType()
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grubby.c | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grubby.c b/grubby.c
|
||||
index baf646b..b202b6e 100644
|
||||
--- a/grubby.c
|
||||
+++ b/grubby.c
|
||||
@@ -2369,9 +2369,11 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) {
|
||||
} else {
|
||||
char * title;
|
||||
line = getLineByType(LT_MENUENTRY, entry->lines);
|
||||
- title = grub2ExtractTitle(line);
|
||||
- if (title)
|
||||
- printf("title=%s\n", title);
|
||||
+ if (line) {
|
||||
+ title = grub2ExtractTitle(line);
|
||||
+ if (title)
|
||||
+ printf("title=%s\n", title);
|
||||
+ }
|
||||
}
|
||||
|
||||
for (j = 0, line = entry->lines; line; line = line->next) {
|
||||
--
|
||||
1.9.3
|
||||
|
@ -1,48 +0,0 @@
|
||||
From fa1bf7b54cb71fa193da16ffc404f8535d7d16ac Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Tue, 31 Jul 2018 17:43:53 +0200
|
||||
Subject: [PATCH 7/8] Make installkernel to use kernel-install scripts on BLS
|
||||
configuration
|
||||
|
||||
The kernel make install target executes the arch/$ARCH/boot/install.sh
|
||||
that in turns executes the distro specific installkernel script. This
|
||||
script always uses new-kernel-pkg to install the kernel images.
|
||||
|
||||
But on a BootLoaderSpec setup, the kernel-install scripts must be used
|
||||
instead. Check if the system uses a BLS setup, and call kernel-install
|
||||
add in that case instead of new-kernel-pkg.
|
||||
|
||||
Reported-by: Hans de Goede <hdegoede@redhat.com>
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
installkernel | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/installkernel b/installkernel
|
||||
index b887929c179..68dcfac16d2 100755
|
||||
--- a/installkernel
|
||||
+++ b/installkernel
|
||||
@@ -20,6 +20,8 @@
|
||||
# Author(s): tyson@rwii.com
|
||||
#
|
||||
|
||||
+[[ -f /etc/default/grub ]] && . /etc/default/grub
|
||||
+
|
||||
usage() {
|
||||
echo "Usage: `basename $0` <kernel_version> <bootimage> <mapfile>" >&2
|
||||
exit 1
|
||||
@@ -77,6 +79,11 @@ cp $MAPFILE $INSTALL_PATH/System.map-$KERNEL_VERSION
|
||||
ln -fs ${RELATIVE_PATH}$INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION $LINK_PATH/$KERNEL_NAME
|
||||
ln -fs ${RELATIVE_PATH}$INSTALL_PATH/System.map-$KERNEL_VERSION $LINK_PATH/System.map
|
||||
|
||||
+if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ] || [ ! -f /sbin/new-kernel-pkg ]; then
|
||||
+ kernel-install add $KERNEL_VERSION $INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION
|
||||
+ exit $?
|
||||
+fi
|
||||
+
|
||||
if [ -n "$cfgLoader" ] && [ -x /sbin/new-kernel-pkg ]; then
|
||||
if [ -n "$(which dracut 2>/dev/null)" ]; then
|
||||
new-kernel-pkg --mkinitrd --dracut --host-only --depmod --install --kernel-name $KERNEL_NAME $KERNEL_VERSION
|
||||
--
|
||||
2.17.1
|
||||
|
155
0008-Add-devtree-support-to-extlinux-1088933.patch
Normal file
155
0008-Add-devtree-support-to-extlinux-1088933.patch
Normal file
@ -0,0 +1,155 @@
|
||||
From eb141563832f803abdfc1fde83fbfcc9031794b3 Mon Sep 17 00:00:00 2001
|
||||
From: Dennis Gilmore <dennis@ausil.us>
|
||||
Date: Fri, 10 Oct 2014 02:06:52 -0500
|
||||
Subject: [PATCH 08/10] Add --devtree support to extlinux (#1088933)
|
||||
|
||||
On 32 bit arm it needs the path to the dtb. This adds support for the
|
||||
fdt command to the extlinux handling. If --devtree /path/to/dtb/file.dtb
|
||||
is passed grubby will add or updated it.
|
||||
---
|
||||
grubby.c | 1 +
|
||||
new-kernel-pkg | 20 ++++++++++++++++++--
|
||||
test.sh | 5 +++++
|
||||
test/extlinux.5 | 21 +++++++++++++++++++++
|
||||
test/results/add/extlinux5.1 | 21 +++++++++++++++++++++
|
||||
5 files changed, 66 insertions(+), 2 deletions(-)
|
||||
create mode 100644 test/extlinux.5
|
||||
create mode 100644 test/results/add/extlinux5.1
|
||||
|
||||
diff --git a/grubby.c b/grubby.c
|
||||
index b202b6e..cbb1cca 100644
|
||||
--- a/grubby.c
|
||||
+++ b/grubby.c
|
||||
@@ -581,6 +581,7 @@ struct keywordTypes extlinuxKeywords[] = {
|
||||
{ "initrd", LT_INITRD, ' ', ',' },
|
||||
{ "append", LT_KERNELARGS, ' ' },
|
||||
{ "prompt", LT_UNKNOWN, ' ' },
|
||||
+ { "fdt", LT_DEVTREE, ' ' },
|
||||
{ NULL, 0, 0 },
|
||||
};
|
||||
int useextlinuxmenu;
|
||||
diff --git a/new-kernel-pkg b/new-kernel-pkg
|
||||
index d9a9b67..0f21e39 100755
|
||||
--- a/new-kernel-pkg
|
||||
+++ b/new-kernel-pkg
|
||||
@@ -265,7 +265,7 @@ install() {
|
||||
|
||||
$grubby --extlinux -c $extlinuxConfig \
|
||||
--add-kernel=$kernelImage \
|
||||
- $INITRD --copy-default $makedefault --title "$title" \
|
||||
+ $DEVTREE $INITRD --copy-default $makedefault --title "$title" \
|
||||
${mbkernel:+--add-multiboot="$mbkernel"} ${mbargs:+--mbargs="$mbargs"} \
|
||||
--args="root=$rootdevice $kernargs" --remove-kernel="TITLE=$title"
|
||||
else
|
||||
@@ -411,6 +411,12 @@ update() {
|
||||
fi
|
||||
fi
|
||||
|
||||
+ DEVTREE=""
|
||||
+ if [ "x$devtreefile" != "x" -a -f "$devtreefile" ]; then
|
||||
+ [ -n "$verbose" ] && echo "found $devtreefile and using it with grubby"
|
||||
+ DEVTREE="--devtree $devtreefile"
|
||||
+ fi
|
||||
+
|
||||
if [ -n "$cfgGrub" ]; then
|
||||
[ -n "$verbose" ] && echo "updating $version from $grubConfig"
|
||||
$grubby --grub -c $grubConfig \
|
||||
@@ -499,7 +505,7 @@ update() {
|
||||
[ -n "$verbose" ] && echo "updating $version from $extlinuxConfig"
|
||||
$grubby --extlinux -c $extlinuxConfig \
|
||||
--update-kernel=$kernelImage \
|
||||
- $INITRD \
|
||||
+ $DEVTREE $INITRD \
|
||||
${kernargs:+--args="$kernargs"} \
|
||||
${removeargs:+--remove-args="$removeargs"}
|
||||
else
|
||||
@@ -724,6 +730,16 @@ if [ -z "$initrdfile" ]; then
|
||||
fi
|
||||
[ -n "$verbose" ] && echo "initrdfile is $initrdfile"
|
||||
|
||||
+if [[ ${ARCH} =~ armv[5|7].*l ]]; then
|
||||
+ if [ -d "$bootPrefix/dtb-$version/" ]; then
|
||||
+ devtreedir="$bootPrefix/dtb-$version/"
|
||||
+ if [ -n "$dtbfile" -a -f "$devtreedir/$dtbfile" ]; then
|
||||
+ devtreefile="$devtreedir/$dtbfile"
|
||||
+ fi
|
||||
+ fi
|
||||
+fi
|
||||
+[ -n "$verbose" ] && echo "devtreedir is $devtreedir"
|
||||
+
|
||||
# add dracut i18n, keyboard and plymouth kernel args if requested
|
||||
if [ -n "$dracut" -o -n "$adddracutargs" ]; then
|
||||
if [ -r /etc/vconsole.conf ]; then
|
||||
diff --git a/test.sh b/test.sh
|
||||
index 864a8ce..67b932d 100755
|
||||
--- a/test.sh
|
||||
+++ b/test.sh
|
||||
@@ -647,6 +647,11 @@ extlinuxTest extlinux.2 add/extlinux2.1 --add-kernel=/boot/vmlinuz-3.12.0-2.fc21
|
||||
--initrd=/boot/initrd-3.12.0-2.fc21.i686-new.img --boot-filesystem=/boot --copy-default \
|
||||
--title="Fedora (3.12.0-2.fc21.i686) 20 (Heisenbug)" \
|
||||
--remove-kernel="TITLE=Fedora (3.12.0-2.fc21.i686) 20 (Heisenbug)"
|
||||
+extlinuxTest extlinux.5 add/extlinux5.1 --add-kernel=/boot/vmlinuz-3.15.0-0.rc1.git4.1.fc21.armv7hl \
|
||||
+ --devtree='/boot/dtb-3.15.0-0.rc1.git4.1.fc21.armv7hl/imx6q-cubox-i.dtb' \
|
||||
+ --initrd=/boot/initramfs-3.15.0-0.rc1.git4.1.fc21.armv7hl.img --boot-filesystem=/boot --copy-default \
|
||||
+ --title="Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide)" \
|
||||
+ --remove-kernel="TITLE=Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide)"
|
||||
|
||||
testing="LILO long titles"
|
||||
liloTest lilo.1 longtitle/l1.1 --add-kernel=/boot/new-kernel.img \
|
||||
diff --git a/test/extlinux.5 b/test/extlinux.5
|
||||
new file mode 100644
|
||||
index 0000000..30e7572
|
||||
--- /dev/null
|
||||
+++ b/test/extlinux.5
|
||||
@@ -0,0 +1,21 @@
|
||||
+ui menu.c32
|
||||
+
|
||||
+menu hidden
|
||||
+timeout 50
|
||||
+totaltimeout 9000
|
||||
+
|
||||
+prompt 10
|
||||
+default Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide)
|
||||
+
|
||||
+label Fedora (3.15.0-0.rc1.git0.1.fc21.armv7hl) 21 (Rawhide)
|
||||
+kernel /vmlinuz-3.15.0-0.rc1.git0.1.fc21.armv7hl
|
||||
+fdt /dtb-3.15.0-0.rc1.git0.1.fc21.armv7hl/imx6q-cubox-i.dtb
|
||||
+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8
|
||||
+initrd /initramfs-3.15.0-0.rc1.git0.1.fc21.armv7hl.img
|
||||
+
|
||||
+label Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide)
|
||||
+kernel /vmlinuz-3.12.0-0.fc21.armv7hl
|
||||
+fdt /dtb-3.12.0-0.fc21.armv7hl/imx6q-cubox-i.dtb
|
||||
+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8
|
||||
+initrd /initramfs-3.12.0-0.fc21.armv7hl.img
|
||||
+
|
||||
diff --git a/test/results/add/extlinux5.1 b/test/results/add/extlinux5.1
|
||||
new file mode 100644
|
||||
index 0000000..5e97883
|
||||
--- /dev/null
|
||||
+++ b/test/results/add/extlinux5.1
|
||||
@@ -0,0 +1,21 @@
|
||||
+ui menu.c32
|
||||
+
|
||||
+menu hidden
|
||||
+timeout 50
|
||||
+totaltimeout 9000
|
||||
+
|
||||
+prompt 10
|
||||
+default Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide)
|
||||
+
|
||||
+label Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide)
|
||||
+kernel /vmlinuz-3.15.0-0.rc1.git4.1.fc21.armv7hl
|
||||
+fdt /dtb-3.15.0-0.rc1.git4.1.fc21.armv7hl/imx6q-cubox-i.dtb
|
||||
+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8
|
||||
+initrd /initramfs-3.15.0-0.rc1.git4.1.fc21.armv7hl.img
|
||||
+
|
||||
+label Fedora (3.15.0-0.rc1.git0.1.fc21.armv7hl) 21 (Rawhide)
|
||||
+kernel /vmlinuz-3.15.0-0.rc1.git0.1.fc21.armv7hl
|
||||
+fdt /dtb-3.15.0-0.rc1.git0.1.fc21.armv7hl/imx6q-cubox-i.dtb
|
||||
+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8
|
||||
+initrd /initramfs-3.15.0-0.rc1.git0.1.fc21.armv7hl.img
|
||||
+
|
||||
--
|
||||
1.9.3
|
||||
|
@ -1,418 +0,0 @@
|
||||
From b8a581014170c6a9bb8ffb799090401a57a4bbe6 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Fri, 12 Oct 2018 16:39:37 -0400
|
||||
Subject: [PATCH 8/8] Add /usr/libexec/rpm-sort
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
rpm-sort.c | 355 +++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
Makefile | 9 +-
|
||||
.gitignore | 1 +
|
||||
3 files changed, 363 insertions(+), 2 deletions(-)
|
||||
create mode 100644 rpm-sort.c
|
||||
|
||||
diff --git a/rpm-sort.c b/rpm-sort.c
|
||||
new file mode 100644
|
||||
index 00000000000..f19635645ba
|
||||
--- /dev/null
|
||||
+++ b/rpm-sort.c
|
||||
@@ -0,0 +1,355 @@
|
||||
+#define _GNU_SOURCE
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
+#include <errno.h>
|
||||
+#include <assert.h>
|
||||
+#include <argp.h>
|
||||
+#include <rpm/rpmlib.h>
|
||||
+#include <err.h>
|
||||
+
|
||||
+typedef enum {
|
||||
+ RPMNVRCMP,
|
||||
+ VERSNVRCMP,
|
||||
+ RPMVERCMP,
|
||||
+ STRVERSCMP,
|
||||
+} comparitors;
|
||||
+
|
||||
+static comparitors comparitor = RPMNVRCMP;
|
||||
+
|
||||
+static inline void *xmalloc(size_t sz)
|
||||
+{
|
||||
+ void *ret = malloc(sz);
|
||||
+
|
||||
+ assert(sz == 0 || ret != NULL);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static inline void *xrealloc(void *p, size_t sz)
|
||||
+{
|
||||
+ void *ret = realloc(p, sz);
|
||||
+
|
||||
+ assert(sz == 0 || ret != NULL);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static inline char *xstrdup(const char * const s)
|
||||
+{
|
||||
+ void *ret = strdup(s);
|
||||
+
|
||||
+ assert(s == NULL || ret != NULL);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static size_t
|
||||
+read_file (const char *input, char **ret)
|
||||
+{
|
||||
+ FILE *in;
|
||||
+ size_t s;
|
||||
+ size_t sz = 2048;
|
||||
+ size_t offset = 0;
|
||||
+ char *text;
|
||||
+
|
||||
+ if (!strcmp(input, "-"))
|
||||
+ in = stdin;
|
||||
+ else
|
||||
+ in = fopen(input, "r");
|
||||
+
|
||||
+ text = xmalloc (sz);
|
||||
+
|
||||
+ if (!in)
|
||||
+ err(1, "cannot open `%s'", input);
|
||||
+
|
||||
+ while ((s = fread (text + offset, 1, sz - offset, in)) != 0)
|
||||
+ {
|
||||
+ offset += s;
|
||||
+ if (sz - offset == 0)
|
||||
+ {
|
||||
+ sz += 2048;
|
||||
+ text = xrealloc (text, sz);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ text[offset] = '\0';
|
||||
+ *ret = text;
|
||||
+
|
||||
+ if (in != stdin)
|
||||
+ fclose(in);
|
||||
+
|
||||
+ return offset + 1;
|
||||
+}
|
||||
+
|
||||
+/* returns name/version/release */
|
||||
+/* NULL string pointer returned if nothing found */
|
||||
+static void
|
||||
+split_package_string (char *package_string, char **name,
|
||||
+ char **version, char **release)
|
||||
+{
|
||||
+ char *package_version, *package_release;
|
||||
+
|
||||
+ /* Release */
|
||||
+ package_release = strrchr (package_string, '-');
|
||||
+
|
||||
+ if (package_release != NULL)
|
||||
+ *package_release++ = '\0';
|
||||
+
|
||||
+ *release = package_release;
|
||||
+
|
||||
+ /* Version */
|
||||
+ package_version = strrchr(package_string, '-');
|
||||
+
|
||||
+ if (package_version != NULL)
|
||||
+ *package_version++ = '\0';
|
||||
+
|
||||
+ *version = package_version;
|
||||
+ /* Name */
|
||||
+ *name = package_string;
|
||||
+
|
||||
+ /* Bubble up non-null values from release to name */
|
||||
+ if (*name == NULL)
|
||||
+ {
|
||||
+ *name = (*version == NULL ? *release : *version);
|
||||
+ *version = *release;
|
||||
+ *release = NULL;
|
||||
+ }
|
||||
+ if (*version == NULL)
|
||||
+ {
|
||||
+ *version = *release;
|
||||
+ *release = NULL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+cmprpmversp(const void *p1, const void *p2)
|
||||
+{
|
||||
+ return rpmvercmp(*(char * const *)p1, *(char * const *)p2);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+cmpstrversp(const void *p1, const void *p2)
|
||||
+{
|
||||
+ return strverscmp(*(char * const *)p1, *(char * const *)p2);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * package name-version-release comparator for qsort
|
||||
+ * expects p, q which are pointers to character strings (char *)
|
||||
+ * which will not be altered in this function
|
||||
+ */
|
||||
+static int
|
||||
+package_version_compare (const void *p, const void *q)
|
||||
+{
|
||||
+ char *local_p, *local_q;
|
||||
+ char *lhs_name, *lhs_version, *lhs_release;
|
||||
+ char *rhs_name, *rhs_version, *rhs_release;
|
||||
+ int vercmpflag = 0;
|
||||
+ int (*cmp)(const char *s1, const char *s2);
|
||||
+
|
||||
+ switch(comparitor)
|
||||
+ {
|
||||
+ default: /* just to shut up -Werror=maybe-uninitialized */
|
||||
+ case RPMNVRCMP:
|
||||
+ cmp = rpmvercmp;
|
||||
+ break;
|
||||
+ case VERSNVRCMP:
|
||||
+ cmp = strverscmp;
|
||||
+ break;
|
||||
+ case RPMVERCMP:
|
||||
+ return cmprpmversp(p, q);
|
||||
+ break;
|
||||
+ case STRVERSCMP:
|
||||
+ return cmpstrversp(p, q);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ local_p = alloca (strlen (*(char * const *)p) + 1);
|
||||
+ local_q = alloca (strlen (*(char * const *)q) + 1);
|
||||
+
|
||||
+ /* make sure these allocated */
|
||||
+ assert (local_p);
|
||||
+ assert (local_q);
|
||||
+
|
||||
+ strcpy (local_p, *(char * const *)p);
|
||||
+ strcpy (local_q, *(char * const *)q);
|
||||
+
|
||||
+ split_package_string (local_p, &lhs_name, &lhs_version, &lhs_release);
|
||||
+ split_package_string (local_q, &rhs_name, &rhs_version, &rhs_release);
|
||||
+
|
||||
+ /* Check Name and return if unequal */
|
||||
+ vercmpflag = cmp ((lhs_name == NULL ? "" : lhs_name),
|
||||
+ (rhs_name == NULL ? "" : rhs_name));
|
||||
+ if (vercmpflag != 0)
|
||||
+ return vercmpflag;
|
||||
+
|
||||
+ /* Check version and return if unequal */
|
||||
+ vercmpflag = cmp ((lhs_version == NULL ? "" : lhs_version),
|
||||
+ (rhs_version == NULL ? "" : rhs_version));
|
||||
+ if (vercmpflag != 0)
|
||||
+ return vercmpflag;
|
||||
+
|
||||
+ /* Check release and return the version compare value */
|
||||
+ vercmpflag = cmp ((lhs_release == NULL ? "" : lhs_release),
|
||||
+ (rhs_release == NULL ? "" : rhs_release));
|
||||
+
|
||||
+ return vercmpflag;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+add_input (const char *filename, char ***package_names, size_t *n_package_names)
|
||||
+{
|
||||
+ char *orig_input_buffer = NULL;
|
||||
+ char *input_buffer;
|
||||
+ char *position_of_newline;
|
||||
+ char **names = *package_names;
|
||||
+ char **new_names = NULL;
|
||||
+ size_t n_names = *n_package_names;
|
||||
+
|
||||
+ if (!*package_names)
|
||||
+ new_names = names = xmalloc (sizeof (char *) * 2);
|
||||
+
|
||||
+ if (read_file (filename, &orig_input_buffer) < 2)
|
||||
+ {
|
||||
+ if (new_names)
|
||||
+ free (new_names);
|
||||
+ if (orig_input_buffer)
|
||||
+ free (orig_input_buffer);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ input_buffer = orig_input_buffer;
|
||||
+ while (input_buffer && *input_buffer &&
|
||||
+ (position_of_newline = strchrnul (input_buffer, '\n')))
|
||||
+ {
|
||||
+ size_t sz = position_of_newline - input_buffer;
|
||||
+ char *new;
|
||||
+
|
||||
+ if (sz == 0)
|
||||
+ {
|
||||
+ input_buffer = position_of_newline + 1;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ new = xmalloc (sz+1);
|
||||
+ strncpy (new, input_buffer, sz);
|
||||
+ new[sz] = '\0';
|
||||
+
|
||||
+ names = xrealloc (names, sizeof (char *) * (n_names + 1));
|
||||
+ names[n_names] = new;
|
||||
+ n_names++;
|
||||
+
|
||||
+ /* move buffer ahead to next line */
|
||||
+ input_buffer = position_of_newline + 1;
|
||||
+ if (*position_of_newline == '\0')
|
||||
+ input_buffer = NULL;
|
||||
+ }
|
||||
+
|
||||
+ free (orig_input_buffer);
|
||||
+
|
||||
+ *package_names = names;
|
||||
+ *n_package_names = n_names;
|
||||
+}
|
||||
+
|
||||
+static char *
|
||||
+help_filter (int key, const char *text, void *input __attribute__ ((unused)))
|
||||
+{
|
||||
+ return (char *)text;
|
||||
+}
|
||||
+
|
||||
+static struct argp_option options[] = {
|
||||
+ { "comparitor", 'c', "COMPARITOR", 0, "[rpm-nvr-cmp|vers-nvr-cmp|rpmvercmp|strverscmp]", 0},
|
||||
+ { 0, }
|
||||
+};
|
||||
+
|
||||
+struct arguments
|
||||
+{
|
||||
+ size_t ninputs;
|
||||
+ size_t input_max;
|
||||
+ char **inputs;
|
||||
+};
|
||||
+
|
||||
+static error_t
|
||||
+argp_parser (int key, char *arg, struct argp_state *state)
|
||||
+{
|
||||
+ struct arguments *arguments = state->input;
|
||||
+ switch (key)
|
||||
+ {
|
||||
+ case 'c':
|
||||
+ if (!strcmp(arg, "rpm-nvr-cmp") || !strcmp(arg, "rpmnvrcmp"))
|
||||
+ comparitor = RPMNVRCMP;
|
||||
+ else if (!strcmp(arg, "vers-nvr-cmp") || !strcmp(arg, "versnvrcmp"))
|
||||
+ comparitor = VERSNVRCMP;
|
||||
+ else if (!strcmp(arg, "rpmvercmp"))
|
||||
+ comparitor = RPMVERCMP;
|
||||
+ else if (!strcmp(arg, "strverscmp"))
|
||||
+ comparitor = STRVERSCMP;
|
||||
+ else
|
||||
+ err(1, "Invalid comparitor \"%s\"", arg);
|
||||
+ break;
|
||||
+ case ARGP_KEY_ARG:
|
||||
+ assert (arguments->ninputs < arguments->input_max);
|
||||
+ arguments->inputs[arguments->ninputs++] = xstrdup (arg);
|
||||
+ break;
|
||||
+ default:
|
||||
+ return ARGP_ERR_UNKNOWN;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct argp argp = {
|
||||
+ options, argp_parser, "[INPUT_FILES]",
|
||||
+ "Sort a list of strings in RPM version sort order.",
|
||||
+ NULL, help_filter, NULL
|
||||
+};
|
||||
+
|
||||
+int
|
||||
+main (int argc, char *argv[])
|
||||
+{
|
||||
+ struct arguments arguments;
|
||||
+ char **package_names = NULL;
|
||||
+ size_t n_package_names = 0;
|
||||
+ int i;
|
||||
+
|
||||
+ memset (&arguments, 0, sizeof (struct arguments));
|
||||
+ arguments.input_max = argc+1;
|
||||
+ arguments.inputs = xmalloc ((arguments.input_max + 1)
|
||||
+ * sizeof (arguments.inputs[0]));
|
||||
+ memset (arguments.inputs, 0, (arguments.input_max + 1)
|
||||
+ * sizeof (arguments.inputs[0]));
|
||||
+
|
||||
+ /* Parse our arguments */
|
||||
+ if (argp_parse (&argp, argc, argv, 0, 0, &arguments) != 0)
|
||||
+ errx(1, "%s", "Error in parsing command line arguments\n");
|
||||
+
|
||||
+ /* If there's no inputs in argv, add one for stdin */
|
||||
+ if (!arguments.ninputs)
|
||||
+ {
|
||||
+ arguments.ninputs = 1;
|
||||
+ arguments.inputs[0] = xmalloc (2);
|
||||
+ strcpy(arguments.inputs[0], "-");
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < arguments.ninputs; i++)
|
||||
+ add_input(arguments.inputs[i], &package_names, &n_package_names);
|
||||
+
|
||||
+ if (package_names == NULL || n_package_names < 1)
|
||||
+ errx(1, "Invalid input");
|
||||
+
|
||||
+ qsort (package_names, n_package_names, sizeof (char *),
|
||||
+ package_version_compare);
|
||||
+
|
||||
+ /* send sorted list to stdout */
|
||||
+ for (i = 0; i < n_package_names; i++)
|
||||
+ {
|
||||
+ fprintf (stdout, "%s\n", package_names[i]);
|
||||
+ free (package_names[i]);
|
||||
+ }
|
||||
+
|
||||
+ free (package_names);
|
||||
+ for (i = 0; i < arguments.ninputs; i++)
|
||||
+ free (arguments.inputs[i]);
|
||||
+
|
||||
+ free (arguments.inputs);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/Makefile b/Makefile
|
||||
index cfa8e0d60ab..1ab58aeb039 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -29,7 +29,7 @@ LDFLAGS := $(RPM_LD_FLAGS)
|
||||
|
||||
grubby_LIBS = -lblkid -lpopt
|
||||
|
||||
-all: grubby
|
||||
+all: grubby rpm-sort
|
||||
|
||||
debug : clean
|
||||
$(MAKE) CFLAGS="${CFLAGS} -DDEBUG=1" all
|
||||
@@ -52,12 +52,17 @@ install: all
|
||||
install -m 755 grubby $(DESTDIR)$(PREFIX)$(sbindir) ; \
|
||||
install -m 644 grubby.8 $(DESTDIR)/$(mandir)/man8 ; \
|
||||
fi
|
||||
+ install -m 755 -d $(DESTDIR)$(PREFIX)$(libexecdir)/grubby/
|
||||
+ install -m 755 rpm-sort $(DESTDIR)$(PREFIX)$(libexecdir)/grubby/rpm-sort
|
||||
|
||||
grubby:: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(grubby_LIBS)
|
||||
|
||||
+rpm-sort::rpm-sort.o
|
||||
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ -lrpm
|
||||
+
|
||||
clean:
|
||||
- rm -f *.o grubby *~
|
||||
+ rm -f *.o grubby rpm-sort *~
|
||||
|
||||
GITTAG = $(VERSION)-1
|
||||
|
||||
diff --git a/.gitignore b/.gitignore
|
||||
index e64d3bc0986..1a5a546eee3 100644
|
||||
--- a/.gitignore
|
||||
+++ b/.gitignore
|
||||
@@ -1,3 +1,4 @@
|
||||
grubby
|
||||
+rpm-sort
|
||||
version.h
|
||||
*.o
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,30 +0,0 @@
|
||||
From 64f91f29b03639b0726f0c46f004a20f11379e22 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Stodola <jstodola@redhat.com>
|
||||
Date: Sat, 1 Dec 2018 02:33:23 +0100
|
||||
Subject: [PATCH] Improve man page for --info option
|
||||
|
||||
1) commit 941d4a0b removed description of --info DEFAULT
|
||||
2) Add description of --info ALL
|
||||
---
|
||||
grubby.8 | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grubby.8 b/grubby.8
|
||||
index 355b6eb6908..9ffef895b0f 100644
|
||||
--- a/grubby.8
|
||||
+++ b/grubby.8
|
||||
@@ -132,7 +132,10 @@ is the default on ia32 platforms.
|
||||
|
||||
.TP
|
||||
\fB-\-info\fR=\fIkernel-path\fR
|
||||
-Display information on all boot entries which match \fIkernel-path\fR. I
|
||||
+Display information on all boot entries which match \fIkernel-path\fR. If
|
||||
+\fIkernel-path\fR is \fBDEFAULT\fR, then information on the default kernel
|
||||
+is displayed. If \fIkernel-path\fR is \fBALL\fR, then information on all boot
|
||||
+entries are displayed.
|
||||
|
||||
.TP
|
||||
\fB-\-initrd\fR=\fIinitrd-path\fR
|
||||
--
|
||||
2.19.1
|
||||
|
194
0009-add-support-for-devicetree-directories-for-use-on-ar.patch
Normal file
194
0009-add-support-for-devicetree-directories-for-use-on-ar.patch
Normal file
@ -0,0 +1,194 @@
|
||||
From 69dbfdc99ce993d541984f7305bb1206858f4bcf Mon Sep 17 00:00:00 2001
|
||||
From: Dennis Gilmore <dennis@ausil.us>
|
||||
Date: Fri, 10 Oct 2014 01:38:27 -0500
|
||||
Subject: [PATCH 09/10] add support for devicetree directories for use on arm
|
||||
|
||||
---
|
||||
grubby.c | 3 +++
|
||||
new-kernel-pkg | 31 ++++++++++++++++++++++++++-----
|
||||
test.sh | 5 +++++
|
||||
test/extlinux.6 | 21 +++++++++++++++++++++
|
||||
test/results/add/extlinux6.1 | 21 +++++++++++++++++++++
|
||||
5 files changed, 76 insertions(+), 5 deletions(-)
|
||||
create mode 100644 test/extlinux.6
|
||||
create mode 100644 test/results/add/extlinux6.1
|
||||
|
||||
diff --git a/grubby.c b/grubby.c
|
||||
index cbb1cca..a4a9811 100644
|
||||
--- a/grubby.c
|
||||
+++ b/grubby.c
|
||||
@@ -582,6 +582,7 @@ struct keywordTypes extlinuxKeywords[] = {
|
||||
{ "append", LT_KERNELARGS, ' ' },
|
||||
{ "prompt", LT_UNKNOWN, ' ' },
|
||||
{ "fdt", LT_DEVTREE, ' ' },
|
||||
+ { "fdtdir", LT_DEVTREE, ' ' },
|
||||
{ NULL, 0, 0 },
|
||||
};
|
||||
int useextlinuxmenu;
|
||||
@@ -4232,6 +4233,8 @@ int main(int argc, const char ** argv) {
|
||||
_("display the title of the default kernel") },
|
||||
{ "devtree", 0, POPT_ARG_STRING, &newDevTreePath, 0,
|
||||
_("device tree file for new stanza"), _("dtb-path") },
|
||||
+ { "devtreedir", 0, POPT_ARG_STRING, &newDevTreePath, 0,
|
||||
+ _("device tree directory for new stanza"), _("dtb-path") },
|
||||
{ "elilo", 0, POPT_ARG_NONE, &configureELilo, 0,
|
||||
_("configure elilo bootloader") },
|
||||
{ "efi", 0, POPT_ARG_NONE, &isEfi, 0,
|
||||
diff --git a/new-kernel-pkg b/new-kernel-pkg
|
||||
index 0f21e39..31976a7 100755
|
||||
--- a/new-kernel-pkg
|
||||
+++ b/new-kernel-pkg
|
||||
@@ -128,7 +128,7 @@ usage() {
|
||||
echo " [--banner=<banner>] [--multiboot=multiboot]" >&2
|
||||
echo " [--mbargs=mbargs] [--make-default] [--add-dracut-args]" >&2
|
||||
echo " [--add-plymouth-initrd]" >&2
|
||||
- echo " [--host-only] [--devtree=<devicetree.dtb>]" >&2
|
||||
+ echo " [--host-only] [--devtree=<devicetree.dtb>] [--devtreedir=</devicetree/path/>]" >&2
|
||||
echo " <--install | --remove | --update | --rpmposttrans> <kernel-version>" >&2
|
||||
echo " (ex: `basename $0` --mkinitrd --depmod --install 2.4.7-2)" >&2
|
||||
exit 1
|
||||
@@ -153,11 +153,17 @@ install() {
|
||||
fi
|
||||
|
||||
DEVTREE=""
|
||||
- if [ "x$devtreefile" != "x" -a -f "$devtreefile" ]; then
|
||||
+ if [ -n "$devtreefile" -a -f "$devtreefile" ]; then
|
||||
[ -n "$verbose" ] && echo "found $devtreefile and using it with grubby"
|
||||
DEVTREE="--devtree $devtreefile"
|
||||
fi
|
||||
|
||||
+ DEVTREEDIR=""
|
||||
+ if [ -n "$devtreedir" -a -d "$devtreedir" ]; then
|
||||
+ [ -n "$verbose" ] && echo "found $devtreedir and using it with grubby"
|
||||
+ DEVTREEDIR="--devtreedir $devtreedir"
|
||||
+ fi
|
||||
+
|
||||
# FIXME: is this a good heuristic to find out if we're on iSeries?
|
||||
if [ -d /proc/iSeries ]; then
|
||||
[ -n "$verbose" ] && echo "On an iSeries, just making img file"
|
||||
@@ -264,7 +270,7 @@ install() {
|
||||
[ -n "$verbose" ] && echo "adding $version to $extlinuxConfig"
|
||||
|
||||
$grubby --extlinux -c $extlinuxConfig \
|
||||
- --add-kernel=$kernelImage \
|
||||
+ --add-kernel=$kernelImage $DEVTREEDIR \
|
||||
$DEVTREE $INITRD --copy-default $makedefault --title "$title" \
|
||||
${mbkernel:+--add-multiboot="$mbkernel"} ${mbargs:+--mbargs="$mbargs"} \
|
||||
--args="root=$rootdevice $kernargs" --remove-kernel="TITLE=$title"
|
||||
@@ -412,11 +418,17 @@ update() {
|
||||
fi
|
||||
|
||||
DEVTREE=""
|
||||
- if [ "x$devtreefile" != "x" -a -f "$devtreefile" ]; then
|
||||
+ if [ -n "$devtreefile" -a -f "$devtreefile" ]; then
|
||||
[ -n "$verbose" ] && echo "found $devtreefile and using it with grubby"
|
||||
DEVTREE="--devtree $devtreefile"
|
||||
fi
|
||||
|
||||
+ DEVTREEDIR=""
|
||||
+ if [ -n "$devtreedir" -a -d "$devtreedir" ]; then
|
||||
+ [ -n "$verbose" ] && echo "found $devtreedir and using it with grubby"
|
||||
+ DEVTREEDIR="--devtreedir $devtreedir"
|
||||
+ fi
|
||||
+
|
||||
if [ -n "$cfgGrub" ]; then
|
||||
[ -n "$verbose" ] && echo "updating $version from $grubConfig"
|
||||
$grubby --grub -c $grubConfig \
|
||||
@@ -505,7 +517,7 @@ update() {
|
||||
[ -n "$verbose" ] && echo "updating $version from $extlinuxConfig"
|
||||
$grubby --extlinux -c $extlinuxConfig \
|
||||
--update-kernel=$kernelImage \
|
||||
- $DEVTREE $INITRD \
|
||||
+ $DEVTREE $DEVTREEDIR $INITRD \
|
||||
${kernargs:+--args="$kernargs"} \
|
||||
${removeargs:+--remove-args="$removeargs"}
|
||||
else
|
||||
@@ -566,6 +578,15 @@ while [ $# -gt 0 ]; do
|
||||
fi
|
||||
;;
|
||||
|
||||
+ --devtreedir*)
|
||||
+ if [[ $1 == --devtreedir\=* ]]; then
|
||||
+ devtreedir=${1#--devtreedir=}
|
||||
+ else
|
||||
+ devtreedir=$2
|
||||
+ shift
|
||||
+ fi
|
||||
+ ;;
|
||||
+
|
||||
--dracut)
|
||||
dracut=--dracut
|
||||
;;
|
||||
diff --git a/test.sh b/test.sh
|
||||
index 67b932d..fe574c3 100755
|
||||
--- a/test.sh
|
||||
+++ b/test.sh
|
||||
@@ -652,6 +652,11 @@ extlinuxTest extlinux.5 add/extlinux5.1 --add-kernel=/boot/vmlinuz-3.15.0-0.rc1.
|
||||
--initrd=/boot/initramfs-3.15.0-0.rc1.git4.1.fc21.armv7hl.img --boot-filesystem=/boot --copy-default \
|
||||
--title="Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide)" \
|
||||
--remove-kernel="TITLE=Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide)"
|
||||
+extlinuxTest extlinux.6 add/extlinux6.1 --add-kernel=/boot/vmlinuz-3.15.0-0.rc1.git4.1.fc21.armv7hl \
|
||||
+ --devtreedir='/boot/dtb-3.15.0-0.rc1.git4.1.fc21.armv7hl/' \
|
||||
+ --initrd=/boot/initramfs-3.15.0-0.rc1.git4.1.fc21.armv7hl.img --boot-filesystem=/boot --copy-default \
|
||||
+ --title="Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide)" \
|
||||
+ --remove-kernel="TITLE=Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide)"
|
||||
|
||||
testing="LILO long titles"
|
||||
liloTest lilo.1 longtitle/l1.1 --add-kernel=/boot/new-kernel.img \
|
||||
diff --git a/test/extlinux.6 b/test/extlinux.6
|
||||
new file mode 100644
|
||||
index 0000000..c28a4a8
|
||||
--- /dev/null
|
||||
+++ b/test/extlinux.6
|
||||
@@ -0,0 +1,21 @@
|
||||
+ui menu.c32
|
||||
+
|
||||
+menu hidden
|
||||
+timeout 50
|
||||
+totaltimeout 9000
|
||||
+
|
||||
+prompt 10
|
||||
+default Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide)
|
||||
+
|
||||
+label Fedora (3.15.0-0.rc1.git0.1.fc21.armv7hl) 21 (Rawhide)
|
||||
+kernel /vmlinuz-3.15.0-0.rc1.git0.1.fc21.armv7hl
|
||||
+fdtdir /dtb-3.15.0-0.rc1.git0.1.fc21.armv7hl/
|
||||
+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8
|
||||
+initrd /initramfs-3.15.0-0.rc1.git0.1.fc21.armv7hl.img
|
||||
+
|
||||
+label Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide)
|
||||
+kernel /vmlinuz-3.12.0-0.fc21.armv7hl
|
||||
+fdtdir /dtb-3.12.0-0.fc21.armv7hl/
|
||||
+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8
|
||||
+initrd /initramfs-3.12.0-0.fc21.armv7hl.img
|
||||
+
|
||||
diff --git a/test/results/add/extlinux6.1 b/test/results/add/extlinux6.1
|
||||
new file mode 100644
|
||||
index 0000000..ec2a2ea
|
||||
--- /dev/null
|
||||
+++ b/test/results/add/extlinux6.1
|
||||
@@ -0,0 +1,21 @@
|
||||
+ui menu.c32
|
||||
+
|
||||
+menu hidden
|
||||
+timeout 50
|
||||
+totaltimeout 9000
|
||||
+
|
||||
+prompt 10
|
||||
+default Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide)
|
||||
+
|
||||
+label Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide)
|
||||
+kernel /vmlinuz-3.15.0-0.rc1.git4.1.fc21.armv7hl
|
||||
+fdtdir /dtb-3.15.0-0.rc1.git4.1.fc21.armv7hl/
|
||||
+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8
|
||||
+initrd /initramfs-3.15.0-0.rc1.git4.1.fc21.armv7hl.img
|
||||
+
|
||||
+label Fedora (3.15.0-0.rc1.git0.1.fc21.armv7hl) 21 (Rawhide)
|
||||
+kernel /vmlinuz-3.15.0-0.rc1.git0.1.fc21.armv7hl
|
||||
+fdtdir /dtb-3.15.0-0.rc1.git0.1.fc21.armv7hl/
|
||||
+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8
|
||||
+initrd /initramfs-3.15.0-0.rc1.git0.1.fc21.armv7hl.img
|
||||
+
|
||||
--
|
||||
1.9.3
|
||||
|
@ -1,104 +0,0 @@
|
||||
From 00241c65a5c0b4bb32a847a6abb5a86d0c704a8f Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Tue, 5 Feb 2019 20:08:43 +0100
|
||||
Subject: [PATCH] Fix GCC warnings about possible string truncations and buffer
|
||||
overflows
|
||||
|
||||
Building with -Werror=stringop-truncation and -Werror=stringop-overflow
|
||||
leads to GCC complaining about possible string truncation and overflows.
|
||||
|
||||
Fix this by using memcpy(), explicitly calculating the buffers lenghts
|
||||
and set a NUL byte terminator after copying the buffers.
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
grubby.c | 35 +++++++++++++++++++++++++++--------
|
||||
1 file changed, 27 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/grubby.c b/grubby.c
|
||||
index 96d252a0a83..5ca689539cf 100644
|
||||
--- a/grubby.c
|
||||
+++ b/grubby.c
|
||||
@@ -459,20 +459,26 @@ char *grub2ExtractTitle(struct singleLine * line) {
|
||||
snprintf(result, resultMaxSize, "%s", ++current);
|
||||
|
||||
i++;
|
||||
+ int result_len = 0;
|
||||
for (; i < line->numElements; ++i) {
|
||||
current = line->elements[i].item;
|
||||
current_len = strlen(current);
|
||||
current_indent = line->elements[i].indent;
|
||||
current_indent_len = strlen(current_indent);
|
||||
|
||||
- strncat(result, current_indent, current_indent_len);
|
||||
+ memcpy(result + result_len, current_indent, current_indent_len);
|
||||
+ result_len += current_indent_len;
|
||||
+
|
||||
if (!isquote(current[current_len-1])) {
|
||||
- strncat(result, current, current_len);
|
||||
+ memcpy(result + result_len, current_indent, current_indent_len);
|
||||
+ result_len += current_len;
|
||||
} else {
|
||||
- strncat(result, current, current_len - 1);
|
||||
+ memcpy(result + result_len, current_indent, current_indent_len);
|
||||
+ result_len += (current_len - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
+ result[result_len] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1281,6 +1287,7 @@ static struct grubConfig * readConfig(const char * inName,
|
||||
extras = malloc(len + 1);
|
||||
*extras = '\0';
|
||||
|
||||
+ int buf_len = 0;
|
||||
/* get title. */
|
||||
for (int i = 0; i < line->numElements; i++) {
|
||||
if (!strcmp(line->elements[i].item, "menuentry"))
|
||||
@@ -1292,13 +1299,18 @@ static struct grubConfig * readConfig(const char * inName,
|
||||
|
||||
len = strlen(title);
|
||||
if (isquote(title[len-1])) {
|
||||
- strncat(buf, title,len-1);
|
||||
+ memcpy(buf + buf_len, title, len - 1);
|
||||
+ buf_len += (len - 1);
|
||||
break;
|
||||
} else {
|
||||
- strcat(buf, title);
|
||||
- strcat(buf, line->elements[i].indent);
|
||||
+ memcpy(buf + buf_len, title, len);
|
||||
+ buf_len += len;
|
||||
+ len = strlen(line->elements[i].indent);
|
||||
+ memcpy(buf + buf_len, line->elements[i].indent, len);
|
||||
+ buf_len += len;
|
||||
}
|
||||
}
|
||||
+ buf[buf_len] = '\0';
|
||||
|
||||
/* get extras */
|
||||
int count = 0;
|
||||
@@ -4494,10 +4506,17 @@ int main(int argc, const char ** argv) {
|
||||
exit(1);
|
||||
}
|
||||
saved_command_line[0] = '\0';
|
||||
+ int cmdline_len = 0, arg_len;
|
||||
for (int j = 1; j < argc; j++) {
|
||||
- strcat(saved_command_line, argv[j]);
|
||||
- strncat(saved_command_line, j == argc -1 ? "" : " ", 1);
|
||||
+ arg_len = strlen(argv[j]);
|
||||
+ memcpy(saved_command_line + cmdline_len, argv[j], arg_len);
|
||||
+ cmdline_len += arg_len;
|
||||
+ if (j != argc - 1) {
|
||||
+ memcpy(saved_command_line + cmdline_len, " ", 1);
|
||||
+ cmdline_len++;
|
||||
+ }
|
||||
}
|
||||
+ saved_command_line[cmdline_len] = '\0';
|
||||
|
||||
optCon = poptGetContext("grubby", argc, argv, options, 0);
|
||||
poptReadDefaultConfig(optCon, 1);
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,56 @@
|
||||
From 354c873f633db124d214da8a1258e32fe210c7cb Mon Sep 17 00:00:00 2001
|
||||
From: Dennis Gilmore <dennis@ausil.us>
|
||||
Date: Thu, 9 Oct 2014 01:42:03 -0500
|
||||
Subject: [PATCH 10/10] cleanup dtb handling to work in the supported usecases
|
||||
|
||||
add SHIPSDTB variable in the uboot defaults file that needs to be set to yes for
|
||||
platforms like the calxeda highbank that ship a dtb in u-boot that we want to use.
|
||||
if the user defines a dtbfile in /etc/sysconfig/uboot update the extlinux.conf
|
||||
with an fdt entry otherwise update a fdtdir entry unless SHIPSDTB is set to yes.
|
||||
---
|
||||
new-kernel-pkg | 12 +++++++-----
|
||||
uboot | 5 +++++
|
||||
2 files changed, 12 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/new-kernel-pkg b/new-kernel-pkg
|
||||
index 31976a7..311deda 100755
|
||||
--- a/new-kernel-pkg
|
||||
+++ b/new-kernel-pkg
|
||||
@@ -752,14 +752,16 @@ fi
|
||||
[ -n "$verbose" ] && echo "initrdfile is $initrdfile"
|
||||
|
||||
if [[ ${ARCH} =~ armv[5|7].*l ]]; then
|
||||
- if [ -d "$bootPrefix/dtb-$version/" ]; then
|
||||
- devtreedir="$bootPrefix/dtb-$version/"
|
||||
- if [ -n "$dtbfile" -a -f "$devtreedir/$dtbfile" ]; then
|
||||
- devtreefile="$devtreedir/$dtbfile"
|
||||
+ if [ -z "$SHIPSDTB" -o "$SHIPSDTB" != "yes" ]; then
|
||||
+ if [ -n "$dtbfile" -a -f "$bootPrefix/dtb-$version/$dtbfile" ]; then
|
||||
+ devtreefile="$bootPrefix/dtb-$version/$dtbfile"
|
||||
+ [ -n "$verbose" ] && echo "devtreefile is $devtreefile"
|
||||
+ elif [ -d "$bootPrefix/dtb-$version/" ]; then
|
||||
+ devtreedir="$bootPrefix/dtb-$version/"
|
||||
+ [ -n "$verbose" ] && echo "devtreedir is $devtreedir"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
-[ -n "$verbose" ] && echo "devtreedir is $devtreedir"
|
||||
|
||||
# add dracut i18n, keyboard and plymouth kernel args if requested
|
||||
if [ -n "$dracut" -o -n "$adddracutargs" ]; then
|
||||
diff --git a/uboot b/uboot
|
||||
index aa663ad..07d8671 100644
|
||||
--- a/uboot
|
||||
+++ b/uboot
|
||||
@@ -36,3 +36,8 @@
|
||||
# default initrd uInitrd file name
|
||||
#UBOOT_UINITRD=uInitrd
|
||||
|
||||
+# defualt for platform shipping an onboard dtb.
|
||||
+#SHIPSDTB=no
|
||||
+
|
||||
+# option to tell new-kernel-pkg a specific dtb file to load in extlinux.conf
|
||||
+#dtbfile=foo.dtb
|
||||
--
|
||||
1.9.3
|
||||
|
@ -1,72 +0,0 @@
|
||||
From ed5e255c023c9b78120d9ff2246d6516f652d4b7 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Mon, 10 Feb 2020 19:32:39 +0100
|
||||
Subject: [PATCH] Fix stringop-overflow warning
|
||||
|
||||
GCC gives the following compile warning:
|
||||
|
||||
grubby.c: In function 'main':
|
||||
grubby.c:4508:27: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
|
||||
4508 | saved_command_line[0] = '\0';
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
|
||||
grubby.c:4503:26: note: at offset 0 to an object with size 0 allocated by 'malloc' here
|
||||
4503 | saved_command_line = malloc(i);
|
||||
| ^~~~~~~~~
|
||||
cc1: all warnings being treated as errors
|
||||
make: *** [Makefile:38: grubby.o] Error 1
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
grubby.c | 35 +++++++++++++++++++----------------
|
||||
1 file changed, 19 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/grubby.c b/grubby.c
|
||||
index 5ca689539cf..0c0f67a0ae5 100644
|
||||
--- a/grubby.c
|
||||
+++ b/grubby.c
|
||||
@@ -4500,23 +4500,26 @@ int main(int argc, const char ** argv) {
|
||||
int i = 0;
|
||||
for (int j = 1; j < argc; j++)
|
||||
i += strlen(argv[j]) + 1;
|
||||
- saved_command_line = malloc(i);
|
||||
- if (!saved_command_line) {
|
||||
- fprintf(stderr, "grubby: %m\n");
|
||||
- exit(1);
|
||||
- }
|
||||
- saved_command_line[0] = '\0';
|
||||
- int cmdline_len = 0, arg_len;
|
||||
- for (int j = 1; j < argc; j++) {
|
||||
- arg_len = strlen(argv[j]);
|
||||
- memcpy(saved_command_line + cmdline_len, argv[j], arg_len);
|
||||
- cmdline_len += arg_len;
|
||||
- if (j != argc - 1) {
|
||||
- memcpy(saved_command_line + cmdline_len, " ", 1);
|
||||
- cmdline_len++;
|
||||
- }
|
||||
+
|
||||
+ if (i > 0) {
|
||||
+ saved_command_line = malloc(i);
|
||||
+ if (!saved_command_line) {
|
||||
+ fprintf(stderr, "grubby: %m\n");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ saved_command_line[0] = '\0';
|
||||
+ int cmdline_len = 0, arg_len;
|
||||
+ for (int j = 1; j < argc; j++) {
|
||||
+ arg_len = strlen(argv[j]);
|
||||
+ memcpy(saved_command_line + cmdline_len, argv[j], arg_len);
|
||||
+ cmdline_len += arg_len;
|
||||
+ if (j != argc - 1) {
|
||||
+ memcpy(saved_command_line + cmdline_len, " ", 1);
|
||||
+ cmdline_len++;
|
||||
+ }
|
||||
+ }
|
||||
+ saved_command_line[cmdline_len] = '\0';
|
||||
}
|
||||
- saved_command_line[cmdline_len] = '\0';
|
||||
|
||||
optCon = poptGetContext("grubby", argc, argv, options, 0);
|
||||
poptReadDefaultConfig(optCon, 1);
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,35 +0,0 @@
|
||||
From ee9f80190d4c458a09309fbd9a88d2756dc2d3fa Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Mon, 10 Feb 2020 20:13:13 +0100
|
||||
Subject: [PATCH] Fix maybe-uninitialized warning
|
||||
|
||||
GCC gives the following compile warning:
|
||||
|
||||
grubby.c: In function 'suseGrubConfGetBoot':
|
||||
grubby.c:2770:5: error: 'grubDevice' may be used uninitialized in this function [-Werror=maybe-uninitialized]
|
||||
2770 | free(grubDevice);
|
||||
| ^~~~~~~~~~~~~~~~
|
||||
cc1: all warnings being treated as errors
|
||||
make: *** [Makefile:38: grubby.o] Error 1
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
grubby.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grubby.c b/grubby.c
|
||||
index 0c0f67a0ae5..779c25a2bf9 100644
|
||||
--- a/grubby.c
|
||||
+++ b/grubby.c
|
||||
@@ -2755,7 +2755,7 @@ int grubGetBootFromDeviceMap(const char * device,
|
||||
}
|
||||
|
||||
int suseGrubConfGetBoot(const char * path, char ** bootPtr) {
|
||||
- char * grubDevice;
|
||||
+ char * grubDevice = NULL;
|
||||
|
||||
if (suseGrubConfGetInstallDevice(path, &grubDevice))
|
||||
dbgPrintf("error looking for grub installation device\n");
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,33 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
COMMAND="$1"
|
||||
KERNEL_VERSION="$2"
|
||||
BOOT_DIR_ABS="$3"
|
||||
|
||||
# If $BOOT_DIR_ABS exists, some other boot loader is active.
|
||||
[[ -d "$BOOT_DIR_ABS" ]] && exit 0
|
||||
|
||||
run_hooks()
|
||||
{
|
||||
local f
|
||||
local files="$1"
|
||||
for f in $files ; do
|
||||
[ -x "$f" ] || continue
|
||||
"$f" "$KERNEL_VERSION" "/boot/vmlinuz-$KERNEL_VERSION"
|
||||
done
|
||||
}
|
||||
|
||||
case "$COMMAND" in
|
||||
add)
|
||||
run_hooks "/etc/kernel/postinst.d/*[^~] /etc/kernel/postinst.d/$KERNEL_VERSION/*[^~]"
|
||||
;;
|
||||
remove)
|
||||
run_hooks "/etc/kernel/prerm.d/*[^~] /etc/kernel/prerm.d/$KERNEL_VERSION/*[^~]"
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
esac
|
816
grubby-bls
816
grubby-bls
@ -1,816 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# grubby wrapper to manage BootLoaderSpec files
|
||||
#
|
||||
#
|
||||
# Copyright 2018 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
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
readonly SCRIPTNAME="${0##*/}"
|
||||
|
||||
CMDLINE_LINUX_DEBUG=" systemd.log_level=debug systemd.log_target=kmsg"
|
||||
LINUX_DEBUG_VERSION_POSTFIX="_with_debugging"
|
||||
LINUX_DEBUG_TITLE_POSTFIX=" with debugging"
|
||||
|
||||
declare -a bls_file
|
||||
declare -a bls_title
|
||||
declare -a bls_version
|
||||
declare -a bls_linux
|
||||
declare -a bls_initrd
|
||||
declare -a bls_options
|
||||
declare -a bls_id
|
||||
|
||||
[[ -f /etc/sysconfig/kernel ]] && . /etc/sysconfig/kernel
|
||||
[[ -f /etc/os-release ]] && . /etc/os-release
|
||||
read MACHINE_ID < /etc/machine-id
|
||||
arch=$(uname -m)
|
||||
|
||||
if [[ $arch = 's390' || $arch = 's390x' ]]; then
|
||||
bootloader="zipl"
|
||||
else
|
||||
bootloader="grub2"
|
||||
fi
|
||||
|
||||
print_error() {
|
||||
echo "$1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
print_info() {
|
||||
echo "$1" >&2
|
||||
}
|
||||
|
||||
if [[ ${#} = 0 ]]; then
|
||||
print_error "no action specified"
|
||||
fi
|
||||
|
||||
get_bls_value() {
|
||||
local bls="$1" && shift
|
||||
local key="$1" && shift
|
||||
|
||||
echo "$(grep "^${key}[ \t]" "${bls}" | sed -e "s!^${key}[ \t]*!!")"
|
||||
}
|
||||
|
||||
set_bls_value() {
|
||||
local bls="$1" && shift
|
||||
local key="$1" && shift
|
||||
local value="$1" && shift
|
||||
|
||||
value=$(echo $value | sed -e 's/\//\\\//g')
|
||||
sed -i -e "s/^${key}.*/${key} ${value}/" "${bls}"
|
||||
}
|
||||
|
||||
append_bls_value() {
|
||||
local bls="$1" && shift
|
||||
local key="$1" && shift
|
||||
local value="$1" && shift
|
||||
|
||||
old_value="$(get_bls_value "${bls}" ${key})"
|
||||
set_bls_value "${bls}" "${key}" "${old_value}${value}"
|
||||
}
|
||||
|
||||
get_bls_values() {
|
||||
count=0
|
||||
local -a files
|
||||
local IFS=$'\n'
|
||||
files=($(for bls in ${blsdir}/*.conf ; do
|
||||
if ! [[ -e "${bls}" ]] ; then
|
||||
continue
|
||||
fi
|
||||
bls="${bls%.conf}"
|
||||
bls="${bls##*/}"
|
||||
echo "${bls}"
|
||||
done | /usr/libexec/grubby/rpm-sort -c rpmnvrcmp 2>/dev/null | tac)) || :
|
||||
|
||||
for bls in "${files[@]}" ; do
|
||||
blspath="${blsdir}/${bls}.conf"
|
||||
bls_file[$count]="${blspath}"
|
||||
bls_title[$count]="$(get_bls_value ${blspath} title)"
|
||||
bls_version[$count]="$(get_bls_value ${blspath} version)"
|
||||
bls_linux[$count]="$(get_bls_value ${blspath} linux)"
|
||||
bls_initrd[$count]="$(get_bls_value ${blspath} initrd)"
|
||||
bls_options[$count]="$(get_bls_value ${blspath} options)"
|
||||
bls_id[$count]="${bls}"
|
||||
|
||||
count=$((count+1))
|
||||
done
|
||||
}
|
||||
|
||||
get_default_index() {
|
||||
local default=""
|
||||
local index="-1"
|
||||
local title=""
|
||||
local version=""
|
||||
if [[ $bootloader = "grub2" ]]; then
|
||||
default="$(grep '^saved_entry=' ${env} | sed -e 's/^saved_entry=//')"
|
||||
else
|
||||
default="$(grep '^default=' ${zipl_config} | sed -e 's/^default=//')"
|
||||
fi
|
||||
|
||||
if [[ -z $default ]]; then
|
||||
index=0
|
||||
elif [[ $default =~ ^[0-9]+$ ]]; then
|
||||
index="$default"
|
||||
fi
|
||||
|
||||
for i in ${!bls_file[@]}; do
|
||||
if [[ $i -eq $index ]]; then
|
||||
echo $i
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ $default = ${bls_id[$i]} || $default = ${bls_title[$i]} ]]; then
|
||||
echo $i
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
display_default_value() {
|
||||
local prefix=$(get_prefix)
|
||||
|
||||
case "$display_default" in
|
||||
kernel)
|
||||
echo "${prefix}${bls_linux[$default_index]}"
|
||||
exit 0
|
||||
;;
|
||||
index)
|
||||
echo "$default_index"
|
||||
exit 0
|
||||
;;
|
||||
title)
|
||||
echo "${bls_title[$default_index]}"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
param_to_indexes() {
|
||||
local param="$1"
|
||||
local indexes=""
|
||||
|
||||
if [[ $param = "ALL" ]]; then
|
||||
for i in ${!bls_file[@]}; do
|
||||
indexes="$indexes $i"
|
||||
done
|
||||
echo -n $indexes
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ $param = "DEFAULT" ]]; then
|
||||
echo -n $default_index
|
||||
return
|
||||
fi
|
||||
|
||||
for i in ${!bls_file[@]}; do
|
||||
if [[ $param = "${bls_linux[$i]}" || "/${param##*/}" = "${bls_linux[$i]}" ]]; then
|
||||
indexes="$indexes $i"
|
||||
fi
|
||||
|
||||
if [[ $param = "TITLE=${bls_title[$i]}" ]]; then
|
||||
indexes="$indexes $i"
|
||||
fi
|
||||
|
||||
if [[ $param = $i ]]; then
|
||||
indexes="$indexes $i"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -n $indexes ]]; then
|
||||
echo -n $indexes
|
||||
return
|
||||
fi
|
||||
|
||||
echo -n "-1"
|
||||
}
|
||||
|
||||
get_prefix() {
|
||||
if [[ $bootloader = grub2 ]] && mountpoint -q /boot; then
|
||||
echo "/boot"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
expand_var() {
|
||||
local var=$1
|
||||
|
||||
if [[ $bootloader == "grub2" ]]; then
|
||||
local value="$(grub2-editenv "${env}" list | grep ${var##$} | sed -e "s/${var##$}=//")"
|
||||
value="$(echo ${value} | sed -e 's/\//\\\//g')"
|
||||
if [[ -n $value ]]; then
|
||||
var="$value"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo $var
|
||||
}
|
||||
|
||||
has_kernelopts()
|
||||
{
|
||||
local args=${bls_options[$1]}
|
||||
local opts=(${args})
|
||||
|
||||
for opt in ${opts[*]}; do
|
||||
[[ $opt = "\$kernelopts" ]] && echo "true"
|
||||
done
|
||||
|
||||
echo "false"
|
||||
}
|
||||
|
||||
get_bls_args() {
|
||||
local args=${bls_options[$1]}
|
||||
local opts=(${args})
|
||||
|
||||
for opt in ${opts[*]}; do
|
||||
if [[ $opt =~ ^\$ ]]; then
|
||||
value="$(expand_var $opt)"
|
||||
args="$(echo ${args} | sed -e "s/${opt}/${value}/")"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ${args}
|
||||
}
|
||||
|
||||
display_info_values() {
|
||||
local indexes=($(param_to_indexes "$1"))
|
||||
local prefix=$(get_prefix)
|
||||
|
||||
if [[ $indexes = "-1" ]]; then
|
||||
print_error "The param $1 is incorrect"
|
||||
fi
|
||||
|
||||
for i in ${indexes[*]}; do
|
||||
local root=""
|
||||
local value=""
|
||||
local args="$(get_bls_args "$i")"
|
||||
|
||||
local opts=(${args})
|
||||
|
||||
for opt in ${opts[*]}; do
|
||||
if echo $opt | grep -q "^root="; then
|
||||
root="$(echo $opt | sed -e 's/root=//')"
|
||||
value="$(echo ${opt} | sed -e 's/\//\\\//g')"
|
||||
args="$(echo ${args} | sed -e "s/${value}[ \t]*//")"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo "index=$i"
|
||||
echo "kernel=\"${prefix}${bls_linux[$i]}\""
|
||||
echo "args=\"${args}\""
|
||||
|
||||
if [[ -n $root ]]; then
|
||||
echo "root=\"${root}\""
|
||||
fi
|
||||
|
||||
echo "initrd=\"${prefix}${bls_initrd[$i]}\""
|
||||
echo "title=\"${bls_title[$i]}\""
|
||||
echo "id=\"${bls_id[$i]}\""
|
||||
done
|
||||
exit 0
|
||||
}
|
||||
|
||||
mkbls() {
|
||||
local kernel=$1 && shift
|
||||
local kernelver=$1 && shift
|
||||
local datetime=$1 && shift
|
||||
|
||||
local debugname=""
|
||||
local flavor=""
|
||||
local prefix=""
|
||||
|
||||
if [[ $(get_prefix) = "" ]]; then
|
||||
prefix="/boot"
|
||||
fi
|
||||
|
||||
if [[ $kernelver == *\+* ]] ; then
|
||||
local flavor=-"${kernelver##*+}"
|
||||
if [[ $flavor == "-debug" ]]; then
|
||||
local debugname="with debugging"
|
||||
local debugid="-debug"
|
||||
fi
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
title ${NAME} (${kernelver}) ${VERSION}${debugname}
|
||||
version ${kernelver}${debugid}
|
||||
linux ${kernel}
|
||||
initrd ${prefix}/initramfs-${kernelver}.img
|
||||
options \$kernelopts
|
||||
id ${ID}-${datetime}-${kernelver}${debugid}
|
||||
grub_users \$grub_users
|
||||
grub_arg --unrestricted
|
||||
grub_class kernel${flavor}
|
||||
EOF
|
||||
}
|
||||
|
||||
unset_default_bls()
|
||||
{
|
||||
if [[ $bootloader = grub2 ]]; then
|
||||
grub2-editenv "${env}" unset saved_entry
|
||||
else
|
||||
sed -i -e "/^default=.*/d" "${zipl_config}"
|
||||
fi
|
||||
}
|
||||
|
||||
remove_bls_fragment() {
|
||||
local indexes=($(param_to_indexes "$1"))
|
||||
|
||||
if [[ $indexes = "-1" ]]; then
|
||||
print_error "The param $(get_prefix)$1 is incorrect"
|
||||
fi
|
||||
|
||||
for i in "${indexes[@]}"; do
|
||||
if [[ $default_index = $i ]]; then
|
||||
unset_default_bls
|
||||
fi
|
||||
rm -f "${bls_file[$i]}"
|
||||
done
|
||||
|
||||
get_bls_values
|
||||
|
||||
update_grubcfg
|
||||
}
|
||||
|
||||
get_custom_bls_filename() {
|
||||
local kernelver=$1
|
||||
local bls_target="${blsdir}/${MACHINE_ID}-${kernelver}.conf"
|
||||
count=0
|
||||
local -a files
|
||||
local IFS=$'\n'
|
||||
|
||||
prefix="${bls_target%%.conf}"
|
||||
prefix="${bls_target%%${arch}}"
|
||||
prefix="${prefix%.*}"
|
||||
|
||||
last=($(for bls in ${prefix}.*~custom*.conf ; do
|
||||
if ! [[ -e "${bls}" ]] ; then
|
||||
continue
|
||||
fi
|
||||
bls="${bls##${prefix}.}"
|
||||
bls="${bls%%~custom*}"
|
||||
echo "${bls}"
|
||||
done | tail -n1)) || :
|
||||
|
||||
if [[ -z $last ]]; then
|
||||
last="0"
|
||||
else
|
||||
last=$((last+1))
|
||||
fi
|
||||
|
||||
echo "${bls_target}" | sed -e "s!${prefix}!${prefix}.${last}~custom!"
|
||||
}
|
||||
|
||||
add_bls_fragment() {
|
||||
local kernel="$1" && shift
|
||||
local title="$1" && shift
|
||||
local options="$1" && shift
|
||||
local initrd="$1" && shift
|
||||
local extra_initrd="$1" && shift
|
||||
|
||||
if [[ $kernel = *"vmlinuz-"* ]]; then
|
||||
kernelver="${kernel##*/vmlinuz-}"
|
||||
prefix="vmlinuz-"
|
||||
else
|
||||
kernelver="${kernel##*/}"
|
||||
fi
|
||||
|
||||
if [[ ! -f "/boot/${prefix}${kernelver}" ]] &&
|
||||
[[ $bad_image != "true" ]]; then
|
||||
print_error "The ${kernelver} kernel isn't installed in the machine"
|
||||
fi
|
||||
|
||||
if [[ -z $title ]]; then
|
||||
print_error "The kernel title must be specified"
|
||||
fi
|
||||
|
||||
if [[ ! -d $blsdir ]]; then
|
||||
install -m 700 -d "${blsdir}"
|
||||
fi
|
||||
|
||||
bls_target="${blsdir}/${MACHINE_ID}-${kernelver}.conf"
|
||||
|
||||
if [[ -e ${bls_target} ]]; then
|
||||
bls_target="$(get_custom_bls_filename "${kernelver}")"
|
||||
print_info "An entry for kernel ${kernelver} already exists, adding ${bls_target}"
|
||||
fi
|
||||
|
||||
kernel_dir="/lib/modules/${kernelver}"
|
||||
if [[ -d $kernel_dir ]]; then
|
||||
datetime="$(date -u +%Y%m%d%H%M%S -d "$(stat -c '%y' "${kernel_dir}")")"
|
||||
else
|
||||
datetime=0
|
||||
fi
|
||||
mkbls "${kernel}" "${kernelver}" "${datetime}" > "${bls_target}"
|
||||
|
||||
if [[ -n $title ]]; then
|
||||
set_bls_value "${bls_target}" "title" "${title}"
|
||||
fi
|
||||
|
||||
if [[ -n $options ]]; then
|
||||
set_bls_value "${bls_target}" "options" "${options}"
|
||||
fi
|
||||
|
||||
if [[ -n $initrd ]]; then
|
||||
set_bls_value "${bls_target}" "initrd" "${initrd}"
|
||||
fi
|
||||
|
||||
if [[ -n $extra_initrd ]]; then
|
||||
append_bls_value "${bls_target}" "initrd" "${extra_initrd}"
|
||||
fi
|
||||
|
||||
if [[ $MAKEDEBUG = "yes" ]]; then
|
||||
bls_debug="$(echo ${bls_target} | sed -e "s/${kernelver}/${kernelver}~debug/")"
|
||||
cp -aT "${bls_target}" "${bls_debug}"
|
||||
append_bls_value "${bls_debug}" "title" "${LINUX_DEBUG_TITLE_POSTFIX}"
|
||||
append_bls_value "${bls_debug}" "version" "${LINUX_DEBUG_VERSION_POSTFIX}"
|
||||
append_bls_value "${bls_debug}" "options" "${CMDLINE_LINUX_DEBUG}"
|
||||
blsid="$(get_bls_value ${bls_debug} "id" | sed -e "s/${kernelver}/${kernelver}~debug/")"
|
||||
set_bls_value "${bls_debug}" "id" "${blsid}"
|
||||
fi
|
||||
|
||||
get_bls_values
|
||||
|
||||
if [[ $make_default = "true" ]]; then
|
||||
set_default_bls "TITLE=${title}"
|
||||
fi
|
||||
|
||||
update_grubcfg
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
update_args() {
|
||||
local args=$1 && shift
|
||||
local remove_args=($1) && shift
|
||||
local add_args=($1) && shift
|
||||
|
||||
for arg in ${remove_args[*]}; do
|
||||
arg="$(echo $arg | sed -e 's/\//\\\//g')"
|
||||
if [[ $arg = *"="* ]]; then
|
||||
args="$(echo $args | sed -E "s/(^|[[:space:]])$arg([[:space:]]|$)/ /")"
|
||||
else
|
||||
args="$(echo $args | sed -E "s/(^|[[:space:]])$arg(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g")"
|
||||
fi
|
||||
done
|
||||
|
||||
for arg in ${add_args[*]}; do
|
||||
arg="${arg%%=*}"
|
||||
arg="$(echo $arg | sed -e 's/\//\\\//g')"
|
||||
args="$(echo $args | sed -E "s/(^|[[:space:]])$arg(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g")"
|
||||
done
|
||||
|
||||
for arg in ${add_args[*]}; do
|
||||
args="$args $arg"
|
||||
done
|
||||
|
||||
echo ${args}
|
||||
}
|
||||
|
||||
update_bls_fragment() {
|
||||
local param="$1"
|
||||
local indexes=($(param_to_indexes "$1")) && shift
|
||||
local remove_args=$1 && shift
|
||||
local add_args=$1 && shift
|
||||
local initrd=$1 && shift
|
||||
local opts
|
||||
|
||||
if [[ $indexes = "-1" ]]; then
|
||||
print_error "The param $(get_prefix)${param} is incorrect"
|
||||
fi
|
||||
|
||||
if [[ $param = "ALL" && $bootloader = grub2 ]] && [[ -n $remove_args || -n $add_args ]]; then
|
||||
local old_args=""
|
||||
|
||||
if [[ -z $no_etc_update ]] && [[ -e ${grub_etc_default} ]]; then
|
||||
old_args="$(source ${grub_etc_default}; echo ${GRUB_CMDLINE_LINUX})"
|
||||
if [[ -n $old_args ]]; then
|
||||
opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")"
|
||||
opts="$(echo "$opts" | sed -e 's/\//\\\//g')"
|
||||
sed -i -e "s/^GRUB_CMDLINE_LINUX.*/GRUB_CMDLINE_LINUX=\\\"${opts}\\\"/" "${grub_etc_default}"
|
||||
fi
|
||||
fi
|
||||
|
||||
old_args="$(grub2-editenv "${env}" list | grep kernelopts | sed -e "s/kernelopts=//")"
|
||||
if [[ -n $old_args ]]; then
|
||||
opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")"
|
||||
grub2-editenv "${env}" set kernelopts="${opts}"
|
||||
fi
|
||||
elif [[ $bootloader = grub2 ]]; then
|
||||
opts="$(grub2-editenv "${env}" list | grep kernelopts | sed -e "s/kernelopts=//")"
|
||||
fi
|
||||
|
||||
for i in ${indexes[*]}; do
|
||||
if [[ -n $remove_args || -n $add_args ]]; then
|
||||
local old_args="$(get_bls_args "$i")"
|
||||
local new_args="$(update_args "${old_args}" "${remove_args}" "${add_args}")"
|
||||
|
||||
if [[ $param != "ALL" || "$(has_kernelopts "$i")" = "false" ]]; then
|
||||
set_bls_value "${bls_file[$i]}" "options" "${new_args}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n $initrd ]]; then
|
||||
set_bls_value "${bls_file[$i]}" "initrd" "${initrd}"
|
||||
fi
|
||||
done
|
||||
|
||||
update_grubcfg
|
||||
}
|
||||
|
||||
set_default_bls() {
|
||||
local index=($(param_to_indexes "$1"))
|
||||
|
||||
if [[ $index = "-1" ]]; then
|
||||
print_error "The param $1 is incorrect"
|
||||
fi
|
||||
|
||||
if [[ $bootloader = grub2 ]]; then
|
||||
grub2-editenv "${env}" set saved_entry="${bls_id[$index]}"
|
||||
else
|
||||
local default="${bls_title[$index]}"
|
||||
local current="$(grep '^default=' ${zipl_config} | sed -e 's/^default=//')"
|
||||
if [[ -n $current ]]; then
|
||||
sed -i -e "s,^default=.*,default=${default}," "${zipl_config}"
|
||||
else
|
||||
echo "default=${default}" >> "${zipl_config}"
|
||||
fi
|
||||
fi
|
||||
|
||||
print_info "The default is ${bls_file[$index]} with index $index and kernel $(get_prefix)${bls_linux[$index]}"
|
||||
}
|
||||
|
||||
remove_var_prefix() {
|
||||
local prefix="$1"
|
||||
|
||||
[ -z "${prefix}" ] && return
|
||||
|
||||
if [[ -n $remove_kernel && $remove_kernel =~ ^/ ]]; then
|
||||
remove_kernel="/${remove_kernel##${prefix}/}"
|
||||
fi
|
||||
|
||||
if [[ -n $initrd ]]; then
|
||||
initrd="/${initrd##${prefix}/}"
|
||||
fi
|
||||
|
||||
if [[ -n $extra_initrd ]]; then
|
||||
extra_initrd=" /${extra_initrd##${prefix}/}"
|
||||
fi
|
||||
|
||||
if [[ -n $kernel ]]; then
|
||||
kernel="/${kernel##${prefix}/}"
|
||||
fi
|
||||
|
||||
if [[ -n $update_kernel && $update_kernel =~ ^/ ]]; then
|
||||
update_kernel="/${update_kernel##${prefix}/}"
|
||||
fi
|
||||
}
|
||||
|
||||
update_grubcfg()
|
||||
{
|
||||
if [[ $arch = 'ppc64' || $arch = 'ppc64le' ]]; then
|
||||
grub2-mkconfig --no-grubenv-update -o "${grub_config}" >& /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
print_usage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: grubby [OPTION...]
|
||||
--add-kernel=kernel-path add an entry for the specified kernel
|
||||
--args=args default arguments for the new kernel or new arguments for kernel being updated)
|
||||
--bad-image-okay don't sanity check images in boot entries (for testing only)
|
||||
-c, --config-file=path path to grub config file to update ("-" for stdin)
|
||||
--copy-default use the default boot entry as a template for the new entry being added; if the default is not a linux image, or if the kernel referenced by the default image does not exist, the
|
||||
first linux entry whose kernel does exist is used as the template
|
||||
--default-kernel display the path of the default kernel
|
||||
--default-index display the index of the default kernel
|
||||
--default-title display the title of the default kernel
|
||||
--env=path path for environment data
|
||||
--grub2 configure grub2 bootloader
|
||||
--info=kernel-path display boot information for specified kernel
|
||||
--initrd=initrd-path initrd image for the new kernel
|
||||
-i, --extra-initrd=initrd-path auxiliary initrd image for things other than the new kernel
|
||||
--make-default make the newly added entry the default boot entry
|
||||
--remove-args=STRING remove kernel arguments
|
||||
--remove-kernel=kernel-path remove all entries for the specified kernel
|
||||
--set-default=kernel-path make the first entry referencing the specified kernel the default
|
||||
--set-default-index=entry-index make the given entry index the default entry
|
||||
--title=entry-title title to use for the new kernel entry
|
||||
--update-kernel=kernel-path updated information for the specified kernel
|
||||
--zipl configure zipl bootloader
|
||||
-b, --bls-directory path to directory containing the BootLoaderSpec fragment files
|
||||
--no-etc-grub-update don't update the GRUB_CMDLINE_LINUX variable in /etc/default/grub
|
||||
|
||||
Help options:
|
||||
-?, --help Show this help message
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
OPTS="$(getopt -o c:i:b:? --long help,add-kernel:,args:,bad-image-okay,\
|
||||
config-file:,copy-default,default-kernel,default-index,default-title,env:,\
|
||||
grub2,info:,initrd:,extra-initrd:,make-default,remove-args:,\
|
||||
remove-kernel:,set-default:,set-default-index:,title:,update-kernel:,zipl,\
|
||||
bls-directory:,no-etc-grub-update,add-multiboot:,mbargs:,mounts:,boot-filesystem:,\
|
||||
bootloader-probe,debug,devtree,devtreedir:,elilo,efi,extlinux,grub,lilo,\
|
||||
output-file:,remove-mbargs:,remove-multiboot:,silo,yaboot -n ${SCRIPTNAME} -- "$@")"
|
||||
|
||||
[[ $? = 0 ]] || exit 1
|
||||
|
||||
eval set -- "$OPTS"
|
||||
|
||||
while [ ${#} -gt 0 ]; do
|
||||
case "$1" in
|
||||
--help|-h)
|
||||
print_usage
|
||||
exit 0
|
||||
;;
|
||||
--add-kernel)
|
||||
kernel="${2}"
|
||||
shift
|
||||
;;
|
||||
--args)
|
||||
args="${2}"
|
||||
shift
|
||||
;;
|
||||
--bad-image-okay)
|
||||
bad_image=true
|
||||
;;
|
||||
--config-file|-c)
|
||||
grub_config="${2}"
|
||||
zipl_config="${2}"
|
||||
shift
|
||||
;;
|
||||
--copy-default)
|
||||
copy_default=true
|
||||
;;
|
||||
--default-kernel)
|
||||
display_default="kernel"
|
||||
;;
|
||||
--default-index)
|
||||
display_default="index"
|
||||
;;
|
||||
--default-title)
|
||||
display_default="title"
|
||||
;;
|
||||
--env)
|
||||
env="${2}"
|
||||
shift
|
||||
;;
|
||||
--grub2)
|
||||
bootloader="grub2"
|
||||
;;
|
||||
--info)
|
||||
display_info="${2}"
|
||||
shift
|
||||
;;
|
||||
--initrd)
|
||||
initrd="${2}"
|
||||
shift
|
||||
;;
|
||||
--extra-initrd|-i)
|
||||
extra_initrd=" /${2}"
|
||||
shift
|
||||
;;
|
||||
--make-default)
|
||||
make_default=true
|
||||
;;
|
||||
--remove-args)
|
||||
remove_args="${2}"
|
||||
shift
|
||||
;;
|
||||
--remove-kernel)
|
||||
remove_kernel="${2}"
|
||||
shift
|
||||
;;
|
||||
--set-default)
|
||||
set_default="${2}"
|
||||
shift
|
||||
;;
|
||||
--set-default-index)
|
||||
set_default="${2}"
|
||||
shift
|
||||
;;
|
||||
--title)
|
||||
title="${2}"
|
||||
shift
|
||||
;;
|
||||
--update-kernel)
|
||||
update_kernel="${2}"
|
||||
shift
|
||||
;;
|
||||
--zipl)
|
||||
bootloader="zipl"
|
||||
;;
|
||||
--bls-directory|-b)
|
||||
blsdir="${2}"
|
||||
shift
|
||||
;;
|
||||
--no-etc-grub-update)
|
||||
no_etc_update=true
|
||||
shift
|
||||
;;
|
||||
--add-multiboot|--mbargs|--mounts|--boot-filesystem|\
|
||||
--bootloader-probe|--debug|--devtree|--devtreedir|--elilo|--efi|\
|
||||
--extlinux|--grub|--lilo|--output-file|--remove-mbargs|--silo|\
|
||||
--remove-multiboot|--slilo|--yaboot)
|
||||
echo
|
||||
echo "${SCRIPTNAME}: the option \"${1}\" was deprecated" >&2
|
||||
echo "Try '${SCRIPTNAME} --help' to list supported options" >&2
|
||||
echo
|
||||
exit 1
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo
|
||||
echo "${SCRIPTNAME}: invalid option \"${1}\"" >&2
|
||||
echo "Try '${SCRIPTNAME} --help' for more information" >&2
|
||||
echo
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [[ -z $update_kernel && -z $kernel ]] && [[ -n $args || -n $remove_args ]]; then
|
||||
print_error "no action specified"
|
||||
fi
|
||||
|
||||
if [[ -z $blsdir ]]; then
|
||||
blsdir="/boot/loader/entries"
|
||||
fi
|
||||
|
||||
if [[ -z $env ]]; then
|
||||
env="/boot/grub2/grubenv"
|
||||
fi
|
||||
|
||||
if [[ -z $zipl_config ]]; then
|
||||
zipl_config="/etc/zipl.conf"
|
||||
fi
|
||||
|
||||
if [[ -z $grub_config ]]; then
|
||||
grub_config="/boot/grub2/grub.cfg"
|
||||
fi
|
||||
|
||||
if [[ -z $grub_etc_default ]]; then
|
||||
grub_etc_default="/etc/default/grub"
|
||||
fi
|
||||
|
||||
get_bls_values
|
||||
|
||||
default_index="$(get_default_index)"
|
||||
|
||||
if [[ -n $display_default ]]; then
|
||||
display_default_value
|
||||
fi
|
||||
|
||||
if [[ -n $display_info ]]; then
|
||||
display_info_values "${display_info}"
|
||||
fi
|
||||
|
||||
remove_var_prefix "$(get_prefix)"
|
||||
|
||||
if [[ -n $kernel ]]; then
|
||||
if [[ $copy_default = "true" ]]; then
|
||||
opts="${bls_options[$default_index]}"
|
||||
if [[ -n $args ]]; then
|
||||
opts="${opts} ${args}"
|
||||
fi
|
||||
else
|
||||
opts="${args}"
|
||||
fi
|
||||
|
||||
add_bls_fragment "${kernel}" "${title}" "${opts}" "${initrd}" \
|
||||
"${extra_initrd}"
|
||||
fi
|
||||
|
||||
if [[ -n $remove_kernel ]]; then
|
||||
remove_bls_fragment "${remove_kernel}"
|
||||
fi
|
||||
|
||||
if [[ -n $update_kernel ]]; then
|
||||
update_bls_fragment "${update_kernel}" "${remove_args}" "${args}" "${initrd}"
|
||||
fi
|
||||
|
||||
if [[ -n $set_default ]]; then
|
||||
set_default_bls "${set_default}"
|
||||
fi
|
||||
|
||||
exit 0
|
179
grubby.8
179
grubby.8
@ -1,179 +0,0 @@
|
||||
.TH GRUBBY 8 "Wed Apr 29 2020"
|
||||
.SH NAME
|
||||
grubby \- command line tool for configuring grub and zipl
|
||||
|
||||
.SH SYNOPSIS
|
||||
\fBgrubby\fR [--add-kernel=\fIkernel-path\fR] [--args=\fIargs\fR]
|
||||
[--bad-image-okay] [--config-file=\fIpath\fR] [--copy-default]
|
||||
[--default-kernel] [--default-index] [--default-title]
|
||||
[--env=\fIpath\fR] [--grub2] [--info=\fIkernel-path\fR]
|
||||
[--initrd=\fIinitrd-path\fR] [--extra-initrd=\fIinitrd-path\fR]
|
||||
[--make-default] [--remove-args=\fIargs\fR]
|
||||
[--remove-kernel=\fIkernel-path\fR] [--set-default=\fIkernel-path\fR]
|
||||
[--set-default-index=\fientry-index\fR] [--title=\fentry-title\fR]
|
||||
[--update-kernel=\fIkernel-path\fR] [--zipl] [--bls-directory=\fIpath\fR]
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBgrubby\fR is a command line tool for updating and displaying information
|
||||
about the configuration files for the \fBgrub2\fR and \fBzipl\fR boot loaders.
|
||||
It is primarily designed to be used from scripts which install new kernels and
|
||||
need to find information about the current boot environment.
|
||||
|
||||
On BIOS-based Intel x86 platforms, \fBgrub2\fR is the default bootloader and
|
||||
the configuration file is in \fB/boot/grub2/grub.cfg\fR. On UEFI-based Intel
|
||||
x86 platforms, \fBgrub2\fR is the default bootloader, and the configuration
|
||||
file is in \fB/boot/efi/EFI/redhat/grub.cfg\fR. On PowerPC platforms, systems
|
||||
based on Power8 and Power9 support \fBgrub2\fR as a bootloader and use a
|
||||
configuration stored in \fB/boot/grub2/grub.cfg\fR. On s390x platforms the
|
||||
\fBzipl\fR bootloader use a default configuration in \fB/etc/zipl.conf\fR.
|
||||
|
||||
All bootloaders define the boot entries as individual configuration fragments
|
||||
that are stored by default in \fB/boot/loader/entries\fR. The format for the
|
||||
config files is specified at \fBhttps://systemd.io/BOOT_LOADER_SPECIFICATION\fR.
|
||||
The \fBgrubby\fR tool is used to update and display the configuration defined
|
||||
in the BootLoaderSpec fragment files.
|
||||
|
||||
There are a number of ways to specify the kernel used for \fB-\-info\fR,
|
||||
\fB-\-remove-kernel\fR, and \fB-\-update-kernel\fR. Specificying \fBDEFAULT\fR
|
||||
or \fBALL\fR selects the default entry and all of the entries, respectively.
|
||||
Also, the title of a boot entry may be specified by using \fBTITLE=\fItitle\fR
|
||||
as the argument; all entries with that title are used.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB-\-add-kernel\fR=\fIkernel-path\fR
|
||||
Add a new boot entry for the kernel located at \fIkernel-path\fR.
|
||||
|
||||
.TP
|
||||
\fB-\-args\fR=\fIkernel-args\fR
|
||||
When a new kernel is added, this specifies the command line arguments
|
||||
which should be passed to the kernel by default (note they are merged
|
||||
with the arguments of the default entry if \fB-\-copy-default\fR is used).
|
||||
When \fB-\-update-kernel\fR is used, this specifies new arguments to add
|
||||
to the argument list. Multiple, space separated arguments may be used. If
|
||||
an argument already exists the new value replaces the old values. The
|
||||
\fBroot=\fR kernel argument gets special handling if the configuration
|
||||
file has special handling for specifying the root filesystem.
|
||||
|
||||
.TP
|
||||
\fB-\-bad-image-okay\fR
|
||||
When \fBgrubby\fR is looking for an entry to use for something (such
|
||||
as a default boot entry) it uses sanity checks, such as ensuring that
|
||||
the kernel exists in the filesystem, to make sure entries that obviously
|
||||
won't work aren't selected. This option overrides that behavior, and is
|
||||
designed primarily for testing.
|
||||
|
||||
.TP
|
||||
\fB-\-config-file\fR=\fIpath\fR
|
||||
Use \fIpath\fR as the configuration file rather then the default.
|
||||
|
||||
.TP
|
||||
\fB-\-copy-default\fR
|
||||
\fBgrubby\fR will copy as much information (such as kernel arguments and
|
||||
root device) as possible from the current default kernel. The kernel path
|
||||
and initrd path will never be copied.
|
||||
|
||||
.TP
|
||||
\fB-\-default-kernel\fR
|
||||
Display the full path to the current default kernel and exit.
|
||||
|
||||
.TP
|
||||
\fB-\-default-index\fR
|
||||
Display the numeric index of the current default boot entry and exit.
|
||||
|
||||
.TP
|
||||
\fB-\-default-title\fR
|
||||
Display the title of the current default boot entry and exit.
|
||||
|
||||
.TP
|
||||
\fB-\-env\fR=\fIpath\fR
|
||||
Use \fIpath\fR as the grub2 environment block file rather then the default path.
|
||||
|
||||
.TP
|
||||
\fB-\-grub2\fR
|
||||
Configure \fBgrub2\fR bootloader.
|
||||
|
||||
.TP
|
||||
\fB-\-info\fR=\fIkernel-path\fR
|
||||
Display information on all boot entries which match \fIkernel-path\fR. If
|
||||
\fIkernel-path\fR is \fBDEFAULT\fR, then information on the default kernel
|
||||
is displayed. If \fIkernel-path\fR is \fBALL\fR, then information on all boot
|
||||
entries are displayed.
|
||||
|
||||
.TP
|
||||
\fB-\-initrd\fR=\fIinitrd-path\fR
|
||||
Use \fIinitrd-path\fR as the path to an initial ram disk for a new kernel
|
||||
being added.
|
||||
|
||||
.TP
|
||||
\fB-\-extrainitrd\fR=\fIinitrd-path\fR
|
||||
Use \fIinitrd-path\fR as the path to an auxiliary init ram disk image to be
|
||||
added to the boot entry.
|
||||
|
||||
.TP
|
||||
\fB-\-make-default\fR
|
||||
Make the new kernel entry being added the default entry.
|
||||
|
||||
.TP
|
||||
\fB-\-remove-args\fR=\fIkernel-args\fR
|
||||
The arguments specified by \fIkernel-args\fR are removed from the kernels
|
||||
specified by \fB-\-update-kernel\fR. The \fBroot\fR argument gets special
|
||||
handling for configuration files that support separate root filesystem
|
||||
configuration.
|
||||
|
||||
.TP
|
||||
\fB-\-remove-kernel\fR=\fIkernel-path\fR
|
||||
Removes all boot entries which match \fIkernel-path\fR. This may be used
|
||||
along with -\-add-kernel, in which case the new kernel being added will
|
||||
never be removed.
|
||||
|
||||
.TP
|
||||
\fB-\-set-default\fR=\fIkernel-path\fR
|
||||
The first entry which boots the specified kernel is made the default
|
||||
boot entry.
|
||||
|
||||
.TP
|
||||
\fB-\-set-default-index\fR=\fIentry-index\fR
|
||||
Makes the given entry number the default boot entry.
|
||||
|
||||
.TP
|
||||
\fB-\-title\fR=\fIentry-title\fR
|
||||
When a new kernel entry is added \fIentry-title\fR is used as the title
|
||||
for the entry.
|
||||
|
||||
.TP
|
||||
\fB-\-update-kernel\fR=\fIkernel-path\fR
|
||||
The entries for kernels matching \fRkernel-path\fR are updated. Currently
|
||||
the only items that can be updated is the kernel argument list, which is
|
||||
modified via the \fB-\-args\fR and \fB-\-remove-args\fR options. If the
|
||||
\fBALL\fR argument is used the variable \fB GRUB_CMDLINE_LINUX\fR in
|
||||
\fB/etc/default/grub\fR is updated with the latest kernel argument list,
|
||||
unless the \fB-\-no-etc-grub-update\fR option is used.
|
||||
|
||||
.TP
|
||||
\fB-\-zipl\fR
|
||||
Configure \fBzipl\fR bootloader.
|
||||
|
||||
.TP
|
||||
\fB-\-bls-directory\fR=\fIpath\fR
|
||||
Use \fIpath\fR as the directory for the BootLoaderSpec config files rather
|
||||
than the default \fB/boot/loader/entries\fR.
|
||||
|
||||
.TP
|
||||
\fB-\-no-etc-grub-update\fR
|
||||
Makes grubby to not update the \fBGRUB_CMDLINE_LINUX\fR variable in
|
||||
\fB/etc/default/grub\fR when the \fB-\-update-kernel\fR option is
|
||||
used with the \fBALL\fR argument.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR zipl (8),
|
||||
.BR mkinitrd (8),
|
||||
.BR kernel-install (8)
|
||||
|
||||
.SH AUTHORS
|
||||
.nf
|
||||
Erik Troan
|
||||
Jeremy Katz
|
||||
Peter Jones
|
||||
Javier Martinez
|
||||
.fi
|
@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
if [[ -x @@LIBEXECDIR@@/grubby ]] ; then
|
||||
exec @@LIBEXECDIR@@/grubby "${@}"
|
||||
elif [[ -x @@LIBEXECDIR@@/grubby-bls ]] ; then
|
||||
exec @@LIBEXECDIR@@/grubby-bls "${@}"
|
||||
fi
|
||||
echo "Grubby is not installed correctly." >>/dev/stderr
|
||||
exit 1
|
343
grubby.spec
343
grubby.spec
@ -1,59 +1,39 @@
|
||||
Name: grubby
|
||||
Version: 8.40
|
||||
Release: 45%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Summary: Command line tool for updating bootloader configs
|
||||
Group: System Environment/Base
|
||||
License: GPLv2+
|
||||
URL: https://github.com/rhinstaller/grubby
|
||||
URL: http://git.fedorahosted.org/git/grubby.git
|
||||
# we only pull git snaps at the moment
|
||||
# git clone git@github.com:rhinstaller/grubby.git
|
||||
# git archive --format=tar --prefix=grubby-%%{version}/ HEAD |bzip2 > grubby-%%{version}.tar.bz2
|
||||
# Source0: %%{name}-%%{version}.tar.bz2
|
||||
Source0: https://github.com/rhboot/grubby/archive/%{version}-1.tar.gz
|
||||
Source1: grubby-bls
|
||||
Source2: grubby.in
|
||||
Source3: installkernel.in
|
||||
Source4: installkernel-bls
|
||||
Source5: 95-kernel-hooks.install
|
||||
Source6: grubby.8
|
||||
Patch0001: 0001-remove-the-old-crufty-u-boot-support.patch
|
||||
Patch0002: 0002-Change-return-type-in-getRootSpecifier.patch
|
||||
Patch0003: 0003-Add-btrfs-subvolume-support-for-grub2.patch
|
||||
Patch0004: 0004-Add-tests-for-btrfs-support.patch
|
||||
Patch0005: 0005-Use-system-LDFLAGS.patch
|
||||
Patch0006: 0006-Honor-sbindir.patch
|
||||
Patch0007: 0007-Make-installkernel-to-use-kernel-install-scripts-on-.patch
|
||||
Patch0008: 0008-Add-usr-libexec-rpm-sort.patch
|
||||
Patch0009: 0009-Improve-man-page-for-info-option.patch
|
||||
Patch0010: 0010-Fix-GCC-warnings-about-possible-string-truncations-a.patch
|
||||
Patch0011: 0011-Fix-stringop-overflow-warning.patch
|
||||
Patch0012: 0012-Fix-maybe-uninitialized-warning.patch
|
||||
# git clone git://git.fedorahosted.org/git/grubby.git
|
||||
# git archive --format=tar --prefix=grubby-%{version}/ HEAD |bzip2 > grubby-%{version}.tar.bz2
|
||||
Source0: %{name}-%{version}.tar.bz2
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: pkgconfig glib2-devel popt-devel
|
||||
BuildRequires: libblkid-devel git-core sed make
|
||||
BuildRequires: libblkid-devel git
|
||||
# for make test / getopt:
|
||||
BuildRequires: util-linux-ng
|
||||
BuildRequires: rpm-devel
|
||||
%ifarch aarch64 i686 x86_64 %{power64}
|
||||
BuildRequires: grub2-tools-minimal
|
||||
Requires: grub2-tools-minimal
|
||||
Requires: grub2-tools
|
||||
%ifarch aarch64 i686 x86_64 ppc ppc64
|
||||
BuildRequires: /usr/bin/grub2-editenv
|
||||
%endif
|
||||
%ifarch s390 s390x
|
||||
Requires: s390utils-base
|
||||
%endif
|
||||
Requires: findutils
|
||||
Requires: util-linux
|
||||
|
||||
Obsoletes: %{name}-bls < %{version}-%{release}
|
||||
%ifarch %{arm}
|
||||
Requires: uboot-tools
|
||||
%endif
|
||||
|
||||
%description
|
||||
This package provides a grubby compatibility script that manages
|
||||
BootLoaderSpec files and is meant to only be used for legacy compatibility
|
||||
users with existing grubby users.
|
||||
grubby is a command line tool for updating and displaying information about
|
||||
the configuration files for the grub, lilo, elilo (ia64), yaboot (powerpc)
|
||||
and zipl (s390) boot loaders. It is primarily designed to be used from scripts
|
||||
which install new kernels and need to find information about the current boot
|
||||
environment.
|
||||
|
||||
%prep
|
||||
%setup -q -n grubby-%{version}-1
|
||||
%setup -q
|
||||
|
||||
git init
|
||||
git config user.email "noone@example.com"
|
||||
@ -65,8 +45,7 @@ git config --unset user.email
|
||||
git config --unset user.name
|
||||
|
||||
%build
|
||||
%set_build_flags
|
||||
make %{?_smp_mflags} LDFLAGS="${LDFLAGS}"
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%ifnarch aarch64 %{arm}
|
||||
%check
|
||||
@ -74,274 +53,32 @@ make test
|
||||
%endif
|
||||
|
||||
%install
|
||||
make install DESTDIR=$RPM_BUILD_ROOT mandir=%{_mandir} sbindir=%{_sbindir} libexecdir=%{_libexecdir}
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make install DESTDIR=$RPM_BUILD_ROOT mandir=%{_mandir}
|
||||
%ifarch %{arm}
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/
|
||||
install -p uboot $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/uboot
|
||||
mkdir -p $RPM_BUILD_ROOT/boot
|
||||
echo " " >> $RPM_BUILD_ROOT/boot/boot.scr
|
||||
%endif
|
||||
|
||||
mkdir -p %{buildroot}%{_libexecdir}/{grubby,installkernel}/ %{buildroot}%{_sbindir}/
|
||||
mv -v %{buildroot}%{_sbindir}/grubby %{buildroot}%{_libexecdir}/grubby/grubby
|
||||
mv -v %{buildroot}%{_sbindir}/installkernel %{buildroot}%{_libexecdir}/installkernel/installkernel
|
||||
install -m 0755 %{SOURCE1} %{buildroot}%{_libexecdir}/grubby/
|
||||
install -m 0755 %{SOURCE4} %{buildroot}%{_libexecdir}/installkernel/
|
||||
sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/grubby,g" %{SOURCE2} \
|
||||
> %{buildroot}%{_sbindir}/grubby
|
||||
sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/installkernel,g" %{SOURCE3} \
|
||||
> %{buildroot}%{_sbindir}/installkernel
|
||||
install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE5}
|
||||
rm %{buildroot}%{_mandir}/man8/grubby.8*
|
||||
install -m 0644 %{SOURCE6} %{buildroot}%{_mandir}/man8/
|
||||
|
||||
%post
|
||||
if [ "$1" = 2 ]; then
|
||||
arch=$(uname -m)
|
||||
[[ $arch == "s390x" ]] && \
|
||||
zipl-switch-to-blscfg --backup-suffix=.rpmsave &>/dev/null || :
|
||||
fi
|
||||
|
||||
%package deprecated
|
||||
Summary: Legacy command line tool for updating bootloader configs
|
||||
Conflicts: %{name} <= 8.40-18
|
||||
|
||||
%description deprecated
|
||||
This package provides deprecated, legacy grubby. This is for temporary
|
||||
compatibility only.
|
||||
|
||||
grubby is a command line tool for updating and displaying information about
|
||||
the configuration files for the grub, lilo, elilo (ia64), yaboot (powerpc)
|
||||
and zipl (s390) boot loaders. It is primarily designed to be used from
|
||||
scripts which install new kernels and need to find information about the
|
||||
current boot environment.
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%license COPYING
|
||||
%dir %{_libexecdir}/grubby
|
||||
%dir %{_libexecdir}/installkernel
|
||||
%attr(0755,root,root) %{_libexecdir}/grubby/grubby-bls
|
||||
%attr(0755,root,root) %{_libexecdir}/grubby/rpm-sort
|
||||
%attr(0755,root,root) %{_sbindir}/grubby
|
||||
%attr(0755,root,root) %{_libexecdir}/installkernel/installkernel-bls
|
||||
%attr(0755,root,root) %{_sbindir}/installkernel
|
||||
%attr(0755,root,root) %{_prefix}/lib/kernel/install.d/95-kernel-hooks.install
|
||||
%{_mandir}/man8/[gi]*.8*
|
||||
|
||||
%files deprecated
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%license COPYING
|
||||
%dir %{_libexecdir}/grubby
|
||||
%dir %{_libexecdir}/installkernel
|
||||
%attr(0755,root,root) %{_libexecdir}/grubby/grubby
|
||||
%attr(0755,root,root) %{_libexecdir}/installkernel/installkernel
|
||||
%attr(0755,root,root) %{_sbindir}/grubby
|
||||
%attr(0755,root,root) %{_sbindir}/installkernel
|
||||
%attr(0755,root,root) %{_sbindir}/new-kernel-pkg
|
||||
%{_mandir}/man8/*.8*
|
||||
/sbin/installkernel
|
||||
/sbin/new-kernel-pkg
|
||||
/sbin/grubby
|
||||
%{_mandir}/man8/*.8*
|
||||
%ifarch %{arm}
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/uboot
|
||||
%config(noreplace) /boot/boot.scr
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed May 13 2020 Javier Martinez Canillas <javierm@redhat.com> - 8.40-45
|
||||
- grubby-bls: don't replace options with kernelopts if values are the same
|
||||
|
||||
* Wed May 06 2020 Javier Martinez Canillas <javierm@redhat.com> - 8.40-44
|
||||
- Fix installed man page file mode bits
|
||||
|
||||
* Tue May 05 2020 Javier Martinez Canillas <javierm@redhat.com> - 8.40-43
|
||||
- grubby-bls: always escape the delimiter character used in sed commands
|
||||
- grubby-bls: add a --no-etc-grub-update option
|
||||
|
||||
* Wed Apr 29 2020 Javier Martinez Canillas <javierm@redhat.com> - 8.40-42
|
||||
- grubby-bls: fix corner case when a kernel param value contains a '='
|
||||
- grubby-bls: update man page to match options in current wrapper script
|
||||
|
||||
* Mon Mar 30 2020 Javier Martinez Canillas <javierm@redhat.com> - 8.40-41
|
||||
- Make grubby to also update GRUB_CMDLINE_LINUX in /etc/default/grub
|
||||
Related: rhbz#1287854
|
||||
|
||||
* Mon Feb 10 2020 Javier Martinez Canillas <javierm@redhat.com> - 8.40-40
|
||||
- Fix FTBFS
|
||||
Resolves: rhbz#1799496
|
||||
- Fix wrong S-o-B tag in patch
|
||||
- Fix warning about using unversioned Obsoletes
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-39
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Fri Nov 29 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-38
|
||||
- grubby-bls: don't update grubenv when generating grub.cfg for ppc64le
|
||||
Related: rhbz#1726514
|
||||
|
||||
* Thu Nov 28 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-37
|
||||
- grubby-bls: don't print rpm-sort error messages
|
||||
Resolves: rhbz#1731924
|
||||
- grubby-bls: remove -o option and support -c for ppc64le grub config
|
||||
Resolves: rhbz#1758598
|
||||
- grubby-bls: fix logic to check if the kernelopts var is defined in a BLS
|
||||
Resolves: rhbz#1726514
|
||||
|
||||
* Tue Aug 06 2019 Yuval Turgeman <yturgema@redhat.com> - 8.40-36
|
||||
- grubby-bls: strip only /boot from paths
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-35
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Mon Jun 17 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-34
|
||||
- Add a kernel-install plugin to execute hook scripts in /etc/kernel/
|
||||
Resolves: rhbz#1696202
|
||||
|
||||
* Mon Jun 10 22:13:19 CET 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 8.40-33
|
||||
- Rebuild for RPM 4.15
|
||||
|
||||
* Mon Jun 10 15:42:02 CET 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 8.40-32
|
||||
- Rebuild for RPM 4.15
|
||||
|
||||
* Fri May 03 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-31
|
||||
- Use mountpoint command to check whether /boot is a mount point
|
||||
Resolves: rhbz#1706091
|
||||
|
||||
* Thu Mar 21 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-30
|
||||
- grubby-bls: fix --add-kernel not working when using the --args option
|
||||
Resolves: rhbz#1691004
|
||||
|
||||
* Mon Mar 11 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-29
|
||||
- Only switch to BLS config for s390x / zipl
|
||||
Related: rhbz#1652806
|
||||
|
||||
* Fri Mar 01 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-28
|
||||
- grubby-bls: make --update-kernel ALL to update kernelopts var in grubenv
|
||||
|
||||
* Thu Feb 14 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-27
|
||||
- grubby-bls: error if args or remove-args is used without update-kernel
|
||||
|
||||
* Tue Feb 05 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-26
|
||||
- Fix GCC warnings about possible string truncations and buffer overflows
|
||||
- grubby-bls: unset default entry if is the one being removed
|
||||
- grubby-bls: show absolute path when printing error about incorrect param
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-25
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Mon Jan 14 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-24
|
||||
- Correctly set LDFLAGS to include hardened flags (pjones)
|
||||
Related: rhbz#1654936
|
||||
- grubby-bls: expand all variables in options field when updating it
|
||||
Resolves: rhbz#1660700
|
||||
|
||||
* Tue Dec 11 2018 Javier Martinez Canillas <javierm@redhat.com> - 8.40-23
|
||||
- grubby-bls: lookup default entry by either id or title on grub2
|
||||
Related: rhbz#1654936
|
||||
|
||||
* Fri Nov 30 2018 Javier Martinez Canillas <javierm@redhat.com> - 8.40-22
|
||||
- grubby-bls: also print the absolute path in the --default-kernel option
|
||||
Resolves: rhbz#1649778
|
||||
- grubby-bls: allow to specify the same kernel param multiple times
|
||||
Resolves: rhbz#1652486
|
||||
- grubby-bls: expand kernel options if these are environment variables
|
||||
Resolves: rhbz#1649785
|
||||
- grubby-bls: always generate the BLS snippets when adding new entries
|
||||
Resolves: rhbz#1653365
|
||||
- Improve man page for --info option (jstodola)
|
||||
Resolves: rhbz#1651672
|
||||
- Make the old grubby take precedence over grubby-bls if is installed
|
||||
Related: rhbz#165484
|
||||
|
||||
* Wed Nov 21 2018 Javier Martinez Canillas <javierm@redhat.com> - 8.40-21
|
||||
- installkernel-bls: remove unnecessary check for GRUB_ENABLE_BLSCFG=true
|
||||
Resolves: rhbz#1647721
|
||||
- grubby-bls: use title field instead of version for zipl default entry
|
||||
Related: rhbz#1645200
|
||||
- grubby-bls: print the absolute kernel and initramfs images paths
|
||||
Resolves: rhbz#1649778
|
||||
- grubby-bls: make info print the root parameter if is present in cmdline
|
||||
Resolves: rhbz#1649791
|
||||
|
||||
* Tue Nov 13 2018 Javier Martinez Canillas <javierm@redhat.com> - 8.40-20
|
||||
- Switch to a BLS configuration on %%post
|
||||
|
||||
* Tue Nov 06 2018 Javier Martinez Canillas <javierm@redhat.com> - 8.40-19
|
||||
- Make the temporary config wrapper be what "grubby" contains, and put
|
||||
traditional grubby in grubby-deprecated (pjones)
|
||||
- Re-enable debuginfo generation (pjones)
|
||||
Related: rhbz#1619344
|
||||
- Install installkernel-bls here as well, not just in the grub2 package,
|
||||
since s390x doesn't have grubby packages (pjones)
|
||||
Related: rhbz#1619344
|
||||
- Make grubby-bls execute grub2-mkconfig on ppc64
|
||||
Resolves: rhbz#1636039
|
||||
- grubby-bls should only check if kernel exists and not if was installed
|
||||
Resolves: rhbz#1634740
|
||||
- Use ! instead of , as sed delimiter in grubby-bls script
|
||||
Resolves: rhbz#1634744
|
||||
- Print information about the entry set as default
|
||||
Resolves: rhbz#1636180
|
||||
- grubby-bls: make "id" be the filename, and include it in --info=ALL (pjones)
|
||||
Related: rhbz#1638103
|
||||
- grubby-bls: Make grubby-bls sort everything the same way grub2 does (pjones)
|
||||
Resolves: rhbz#1638103
|
||||
- grubby-bls: Consistently use the filename as the bls id
|
||||
Related: rhbz#1638103
|
||||
- grubby-bls: check if entry exists before attempting to print its info
|
||||
Resolves: rhbz#1634712
|
||||
- grubby-bls: make a copy of the cmdline if is modified for an entry
|
||||
Resolves: rhbz#1629054
|
||||
- grubby-bls: escape delimiter character before replacing the options field
|
||||
Resolves: rhbz#1640017
|
||||
- grubby-bls: grubby-bls: use id instead of title to get the default entry
|
||||
Resolves: rhbz#1638103
|
||||
- grubby-bls: use ~debug instead of -debug as suffix to sort correctly
|
||||
Related: rhbz#1638103
|
||||
- grubby-bls: allow to add many BLS entries for the same kernel image
|
||||
Resolves: rhbz#1634752
|
||||
- grubby-bls: fix --default-* options for s390x
|
||||
Resolves: rhbz#1644608
|
||||
- grubby-bls: only compare using relative paths if /boot is a mount point
|
||||
Resolves: rhbz#1642078
|
||||
|
||||
* Fri Aug 10 2018 Javier Martinez Canillas <javierm@redhat.com> - 8.40-18
|
||||
- Make installkernel to use kernel-install scripts on BLS configuration
|
||||
|
||||
* Tue Jul 24 2018 Javier Martinez Canillas <javierm@redhat.com> - 8.40-17
|
||||
- Fix grubby wrapper paths
|
||||
Resolves: rhbz#1607981
|
||||
|
||||
* Tue Jul 24 2018 Peter Jones <pjones@redhat.com> - 8.40-16
|
||||
- Fix permissions on /usr/sbin/grubby
|
||||
|
||||
* Fri Jul 13 2018 Javier Martinez Canillas <javierm@redhat.com> - 8.40-15
|
||||
- Add a grubby-bls package that conflicts with grubby
|
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-14
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Thu Jun 14 2018 Peter Jones <pjones@redhat.com> - 8.40-13
|
||||
- Use standard Fedora linker flags (rhbz#1543502) (rdossant)
|
||||
- Switch zipl config to BLS configuration on %%postun for s390x (javierm)
|
||||
|
||||
* Tue Apr 10 2018 Javier Martinez Canillas <javierm@redhat.com> - 8.40-12
|
||||
- Use .rpmsave as backup suffix when switching to BLS configuration
|
||||
|
||||
* Fri Apr 06 2018 Javier Martinez Canillas <javierm@redhat.com> - 8.40-11
|
||||
- Switch grub2 config to BLS configuration on %%postun
|
||||
|
||||
* Sat Mar 03 2018 Nathaniel McCallum <npmccallum@redhat.com> - 8.40-10
|
||||
- Add support for /boot on btrfs subvolumes
|
||||
|
||||
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-9
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
* Wed Jan 24 2018 Peter Robinson <pbrobinson@fedoraproject.org> 8.40-8
|
||||
- Drop u-boot uImage generation on ARMv7
|
||||
- Minor cleanups
|
||||
|
||||
* Tue Sep 12 2017 Peter Jones <pjones@redhat.com> - 8.40-7
|
||||
- Explicitly require grub2-tools on platforms that need grub2-editenv
|
||||
- Minor packaging cleanups
|
||||
|
||||
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||
|
||||
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
|
||||
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
||||
|
||||
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||
|
||||
@ -665,7 +402,7 @@ current boot environment.
|
||||
Resolves: rhbz#520515
|
||||
|
||||
* Wed Sep 09 2009 Hans de Goede <hdegoede@redhat.com> - 7.0.4-1
|
||||
- Add --dracut cmdline argument for %%post generation of dracut initrd
|
||||
- Add --dracut cmdline argument for %post generation of dracut initrd
|
||||
|
||||
* Wed Aug 26 2009 Hans de Goede <hdegoede@redhat.com> - 7.0.3-1
|
||||
- Silence error when no /etc/sysconfig/keyboard (#517187)
|
||||
|
@ -1,83 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# /sbin/installkernel
|
||||
#
|
||||
# Copyright 2007-2008 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
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author(s): tyson@rwii.com
|
||||
#
|
||||
|
||||
usage() {
|
||||
echo "Usage: `basename $0` <kernel_version> <bootimage> <mapfile>" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
cfgLoader=
|
||||
|
||||
if [ -z "$INSTALL_PATH" -o "$INSTALL_PATH" == "/boot" ]; then
|
||||
INSTALL_PATH=/boot
|
||||
cfgLoader=1
|
||||
fi
|
||||
|
||||
LINK_PATH=/boot
|
||||
RELATIVE_PATH=`echo "$INSTALL_PATH/" | sed "s|^$LINK_PATH/||"`
|
||||
KERNEL_VERSION=$1
|
||||
BOOTIMAGE=$2
|
||||
MAPFILE=$3
|
||||
ARCH=$(uname -m)
|
||||
if [ $ARCH = 'ppc64' -o $ARCH = 'ppc' ]; then
|
||||
KERNEL_NAME=vmlinux
|
||||
else
|
||||
KERNEL_NAME=vmlinuz
|
||||
fi
|
||||
|
||||
if [ -z "$KERNEL_VERSION" -o -z "$BOOTIMAGE" -o -z "$MAPFILE" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ -f $INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION ]; then
|
||||
mv $INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION \
|
||||
$INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION.old;
|
||||
fi
|
||||
|
||||
if [ ! -L $INSTALL_PATH/$KERNEL_NAME ]; then
|
||||
if [ -e $INSTALLPATH/$KERNEL_NAME ]; then
|
||||
mv $INSTALL_PATH/$KERNEL_NAME $INSTALL_PATH/$KERNEL_NAME.old
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f $INSTALL_PATH/System.map-$KERNEL_VERSION ]; then
|
||||
mv $INSTALL_PATH/System.map-$KERNEL_VERSION \
|
||||
$INSTALL_PATH/System.map-$KERNEL_VERSION.old;
|
||||
fi
|
||||
|
||||
if [ ! -L $INSTALL_PATH/System.map ]; then
|
||||
if [ -e $INSTALLPATH/System.map ]; then
|
||||
mv $INSTALL_PATH/System.map $INSTALL_PATH/System.map.old
|
||||
fi
|
||||
fi
|
||||
ln -sf ${RELATIVE_PATH}$INSTALL_PATH/System.map-$KERNEL_VERSION $LINK_PATH/System.map
|
||||
|
||||
cat $BOOTIMAGE > $INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION
|
||||
cp $MAPFILE $INSTALL_PATH/System.map-$KERNEL_VERSION
|
||||
|
||||
ln -fs ${RELATIVE_PATH}$INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION $LINK_PATH/$KERNEL_NAME
|
||||
ln -fs ${RELATIVE_PATH}$INSTALL_PATH/System.map-$KERNEL_VERSION $LINK_PATH/System.map
|
||||
|
||||
if [ -n "$cfgLoader" ]; then
|
||||
kernel-install add $KERNEL_VERSION $INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION
|
||||
exit $?
|
||||
fi
|
@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
if [[ -x @@LIBEXECDIR@@/installkernel ]] ; then
|
||||
exec @@LIBEXECDIR@@/installkernel "${@}"
|
||||
elif [[ -x @@LIBEXECDIR@@/installkernel-bls ]] ; then
|
||||
exec @@LIBEXECDIR@@/installkernel-bls "${@}"
|
||||
fi
|
||||
echo "installkernel is not installed correctly." >>/dev/stderr
|
||||
exit 1
|
Loading…
Reference in New Issue
Block a user