代码拉取完成,页面将自动刷新
同步操作将从 src-anolis-os/grub2 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
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 2482483a4..dac41e738 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}"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。