6 Star 20 Fork 6

openEuler/digest-list-tools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
setup_grub2 1.52 KB
一键复制 编辑 原始数据 按行查看 历史
anakinzhang 提交于 2021-05-08 10:09 . fix duplicated kernel parameters
#! /bin/bash
# Copyright (C) 2021 Huawei Technologies Duesseldorf GmbH
#
# Author: Roberto Sassu <roberto.sassu@huawei.com>
#
# 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, version 2 of the
# License.
#
# File: setup_grub2
# Configure grub2 boot loader.
#! /bin/bash
if [ -z "$(which new-kernel-pkg)" ]; then
echo "new-kernel-pkg binary not found"
exit 1
fi
if [ $# -lt 2 ]; then
echo "Syntax: $0 <feature> <kernel version> [--mkinitrd]"
echo
echo "Features:"
echo -e "\t- measurement"
echo -e "\t- appraisal"
echo -e "\t- measurement+appraisal"
exit 1
fi
. /etc/os-release
opts_common='ima_template=ima-sig initramtmpfs ima_hash=sha256 integrity=1'
opts_measurement='ima_policy=\\\"exec_tcb\\\" ima_digest_list_pcr=11'
opts_appraisal='ima_policy=\\\"appraise_exec_tcb|appraise_exec_immutable\\\"
ima_appraise=enforce-evm ima_appraise_digest_list=digest evm=x509
evm=complete'
opts=""
if [ "$1" = "measurement" ]; then
opts="$opts_common $opts_measurement"
elif [ "$1" = "appraisal" ]; then
opts="$opts_common $opts_appraisal"
elif [ "$1" = "measurement+appraisal" ]; then
opts="$opts_common $opts_measurement $opts_appraisal"
else
echo "Unknown feature $1"
exit 1
fi
initrdfile=$(ls /boot/ | grep $(uname -r) | grep init | head -n 1 |
sed "s/$(uname -r)/$2/")
new-kernel-pkg $3 --initrdfile /boot/$initrdfile --kernel-args "$opts" \
--install --banner "$NAME $VERSION - ${1^^}" $2
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openeuler/digest-list-tools.git
git@gitee.com:openeuler/digest-list-tools.git
openeuler
digest-list-tools
digest-list-tools
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385