#!/bin/sh
set -e
INITRAMFS_CONF=/etc/initramfs-tools/initramfs.conf
function_most_change_dep(){
    sed  -i '20s/most/dep/g' $INITRAMFS_CONF
}

if [ "x`archdetect`" != "xloongarch64/generic" ];then
    if [ ischroot ];then
         function_most_change_dep
        echo "waiting update-grub"
        update-initramfs -u > /dev/null 2>&1
    fi
fi

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