#!/bin/bashif [ "$USER" != "root" ];then echo "Need to be root" exitfiif [ "$1" = "x32" -o "$1" = "x64" ];then sysbit=$1else echo "Usage:" echo " sudo $0 x32" echo " sudo $0 x64" exit 1figw_iface=($(ip route |awk '$1=="default"{print $3,$5;exit}'))if [ ! "${gw_iface[1]}" ];then echo "Not found default gateway" exit 1fiip=$(ip -4 add list dev ${gw_iface[1]} |awk '$1=="inet"{print $2;exit}')iso=iKuai8_${sysbit}_3.3.3_Build202002040918write_grub_menu(){cat >> /etc/grub.d/40_custom <<EOFmenuentry "$iso" {loopback loop (hd0,1)/root/ik.isolinux (loop)/boot/vmlinuz bootguide=cdinitrd (loop)/boot/rootfs}EOFsed -r -i '/GRUB_TIMEOUT_STYLE/d; /GRUB_HIDDEN_TIMEOUT/d; s/GRUB_CMDLINE_LINUX_DEFAULT.*/GRUB_CMDLINE_LINUX_DEFAULT="text"/' /etc/default/grubsed -r -i 's/GRUB_TIMEOUT=.*/GRUB_TIMEOUT=5/' /etc/default/grubupdate-grubecho "address: $ip"echo "gateway: ${gw_iface[0]}"echo "install successfully, please restart system."}if wget -c https://www.hupan.vip/ikuai/iKuai8_x32_3.3.3_Build202002040918.iso -O /root/ik.iso ;then write_grub_menufi