114 lines
3.8 KiB
Diff
114 lines
3.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Peter Jones <pjones@redhat.com>
|
|
Date: Fri, 22 Jun 2018 14:01:06 -0400
|
|
Subject: [PATCH] grub-switch-to-blscfg.in: get rid of a bunch of bashisms
|
|
|
|
Since this says /bin/sh at the top, it should work with dash.
|
|
|
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
---
|
|
util/grub-switch-to-blscfg.in | 30 +++++++++++++++---------------
|
|
1 file changed, 15 insertions(+), 15 deletions(-)
|
|
|
|
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
|
|
index 2482483a437..dac41e73836 100644
|
|
--- a/util/grub-switch-to-blscfg.in
|
|
+++ b/util/grub-switch-to-blscfg.in
|
|
@@ -151,18 +151,18 @@ done
|
|
|
|
find_grub_cfg() {
|
|
local candidate=""
|
|
- while [[ -e "${candidate}" || $# -gt 0 ]]
|
|
+ while [ -e "${candidate}" -o $# -gt 0 ]
|
|
do
|
|
- if [[ ! -e "${candidate}" ]] ; then
|
|
+ if [ ! -e "${candidate}" ] ; then
|
|
candidate="$1"
|
|
shift
|
|
fi
|
|
|
|
- if [[ -L "${candidate}" ]]; then
|
|
+ if [ -L "${candidate}" ]; then
|
|
candidate="$(realpath "${candidate}")"
|
|
fi
|
|
|
|
- if [[ -f "${candidate}" ]]; then
|
|
+ if [ -f "${candidate}" ]; then
|
|
export GRUB_CONFIG_FILE="${candidate}"
|
|
return 0
|
|
fi
|
|
@@ -175,11 +175,11 @@ if ! find_grub_cfg ${startlink} ${grubdir}/grub.cfg ; then
|
|
exit 1
|
|
fi
|
|
|
|
-if [[ ! -d "${blsdir}" ]]; then
|
|
+if [ ! -d "${blsdir}" ]; then
|
|
install -m 700 -d "${blsdir}"
|
|
fi
|
|
|
|
-if [[ -f /etc/machine-id ]]; then
|
|
+if [ -f /etc/machine-id ]; then
|
|
MACHINE_ID=$(cat /etc/machine-id)
|
|
else
|
|
MACHINE_ID=$(dmesg | sha256sum)
|
|
@@ -194,9 +194,9 @@ mkbls() {
|
|
local debugid=""
|
|
local flavor=""
|
|
|
|
- if [[ "$kernelver" == *\+* ]] ; then
|
|
+ if [ "$kernelver" == *\+* ] ; then
|
|
local flavor=-"${kernelver##*+}"
|
|
- if [[ "${flavor}" == "-debug" ]]; then
|
|
+ if [ "${flavor}" == "-debug" ]; then
|
|
local debugname=" with debugging"
|
|
local debugid="-debug"
|
|
fi
|
|
@@ -219,15 +219,15 @@ EOF
|
|
}
|
|
|
|
for kernelver in $(cd /lib/modules/ ; ls -1) "" ; do
|
|
- if [[ ! -d "/lib/modules/${kernelver}" ]] ; then
|
|
+ if [ ! -d "/lib/modules/${kernelver}" ] ; then
|
|
continue
|
|
fi
|
|
- if [[ ! -f "/boot/vmlinuz-${kernelver}" ]]; then
|
|
+ if [ ! -f "/boot/vmlinuz-${kernelver}" ]; then
|
|
continue
|
|
fi
|
|
bls_target="${blsdir}/${MACHINE_ID}-${kernelver}.conf"
|
|
kernel_dir="/lib/modules/${kernelver}"
|
|
- if [[ -f "${kernel_dir}/bls.conf" ]]; then
|
|
+ if [ -f "${kernel_dir}/bls.conf" ]; then
|
|
cp -af "${kernel_dir}/bls.conf" "${bls_target}"
|
|
else
|
|
mkbls "${kernelver}" \
|
|
@@ -240,7 +240,7 @@ for kernelver in $(cd /lib/modules/ ; ls -1) "" ; do
|
|
linux_relpath="$("${grub_mkrelpath}" /boot/$linux)"
|
|
initrd_relpath="$("${grub_mkrelpath}" /boot/$initrd)"
|
|
|
|
- if [[ $linux != $linux_relpath ]]; then
|
|
+ if [ $linux != $linux_relpath ] ; then
|
|
sed -i -e "s,^linux.*,linux ${linux_relpath},g" "${bls_target}"
|
|
sed -i -e "s,^initrd.*,initrd ${initrd_relpath},g" "${bls_target}"
|
|
fi
|
|
@@ -257,8 +257,8 @@ for kernelver in $(cd /lib/modules/ ; ls -1) "" ; do
|
|
fi
|
|
done
|
|
|
|
-if [[ -f "/boot/vmlinuz-0-rescue-${MACHINE_ID}" ]]; then
|
|
- if [[ $linux != $linux_relpath ]]; then
|
|
+if [ -f "/boot/vmlinuz-0-rescue-${MACHINE_ID}" ]; then
|
|
+ if [ $linux != $linux_relpath ]; then
|
|
bootprefix="$(dirname ${linux_relpath})"
|
|
fi
|
|
mkbls "0-rescue-${MACHINE_ID}" "0" "${bootprefix}" >"${blsdir}/${MACHINE_ID}-0-rescue.conf"
|
|
@@ -282,7 +282,7 @@ elif ! grep -q '^GRUB_ENABLE_BLSCFG=.*' "${etcdefaultgrub}" ; then
|
|
GENERATE=1
|
|
fi
|
|
|
|
-if [[ "${GENERATE}" -eq 1 ]] ; then
|
|
+if [ "${GENERATE}" -eq 1 ] ; then
|
|
cp -af "${GRUB_CONFIG_FILE}" "${GRUB_CONFIG_FILE}${backupsuffix}"
|
|
if ! grub2-mkconfig -o "${GRUB_CONFIG_FILE}" ; then
|
|
cp -af "${GRUB_CONFIG_FILE}${backupsuffix}" "${GRUB_CONFIG_FILE}"
|