1 Star 0 Fork 43

llxingkongxia/hygon-devkit

forked from anolis/hygon-devkit  
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
setup_csv3_memory.sh 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/bash
. /opt/hygon/common.sh
grub_file=/etc/default/grub
add_cmdline()
{
local result1
local result2
cmd="$1"
csv3_cmdline=`cat ${grub_file} | grep ^GRUB_CMDLINE | grep "csv_mem_percentage=[0-9][0-9]"`
result1=$?
csv3_cmdline=`cat ${grub_file} | grep ^GRUB_CMDLINE | grep "csv_mem_percentage=[0-9][ |\"]"`
result2=$?
if [ $result1 -eq 0 ];then
sed -i 's/csv_mem_percentage=[0-9][0-9]/'${cmd}'/g' ${grub_file}
elif [ $result2 -eq 0 ];then
sed -i 's/csv_mem_percentage=[0-9]/'${cmd}'/g' ${grub_file}
else
sed -i 's!\(^GRUB_CMDLINE_LINUX=.*\)"$!\1 '${cmd}'"!' ${grub_file}
fi
}
os_release=$(eval get_os_release)
default=50
case $os_release in
"anolis")
add_cmdline "csv_mem_percentage=${default}"
grub2-mkconfig -o /boot/efi/EFI/anolis/grub.cfg
;;
"centos")
add_cmdline "csv_mem_percentage=${default}"
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
;;
"ubuntu")
add_cmdline "csv_mem_percentage=${default}"
update-grub
;;
esac
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/llxingkongxia/hygon-devkit.git
[email protected]:llxingkongxia/hygon-devkit.git
llxingkongxia
hygon-devkit
hygon-devkit
master

搜索帮助