#!/bin/sh
set -e
###for modify initramfs.conf
update-grub-conf
###end

###sw架构特殊处理
###不能insmod以及主题显示,grub,cfg文件中删除字段
if [ "x`archdetect`" = "xsw64/generic" ];then
   if [ -f /etc/grub.d/06_ubuntukylin_theme ];then 
      rm /etc/grub.d/06_ubuntukylin_theme
   fi	
fi

update-grub-st
if [ "x`archdetect`" = "xarm64/efi" ];then
  update-grub-ftefi
elif [ "x`archdetect`" = "xloongarch64/generic" ];then
  update-grub-loongsonefi
fi

if [ "x`archdetect`" != "xloongarch64/generic" ] && [ "x`archdetect`" != "xsw64/generic" ];then
  grub-measurelist-init
  grub-measureconf-init
fi

if [ "x`archdetect`" = "xsw64/generic" ];then
 sed -i '/recordfail/d' /boot/grub/grub.cfg
 sed -i '/insmod/d' /boot/grub/grub.cfg
fi

update-grub-params
