55 lines
1.6 KiB
Plaintext
55 lines
1.6 KiB
Plaintext
#/bin/bash
|
|
clear
|
|
echo '|--------------|'
|
|
echo '|Boot generator|'
|
|
echo '|--------------|'
|
|
iso_date=$(date "+%Y.%m.")
|
|
|
|
read -p "Do you want to use the archlinux-${iso_date}01-x86_64.iso?(YES/NO) :" archlinux
|
|
if [ "$archlinux" = "NO" ]; then
|
|
echo -e "\e[31mAttention\e[0m"
|
|
read -p "Enter the date like '2026.04.': " iso_date
|
|
fi
|
|
echo ''
|
|
echo '-----------------------------------------------------------------------------------------------------------'
|
|
blkid
|
|
echo '-----------------------------------------------------------------------------------------------------------'
|
|
echo ''
|
|
read -p "Which partition is the ISO located? 1 or 2(line) :" p_iso
|
|
echo ''
|
|
uuid=$(blkid | sed -n "${p_iso}p"| grep -Eo '\<UUID=.{9}-.{4}-.{4}-.{4}-.{12}' | grep -Eo '.{8}-.{4}-.{4}-.{4}-.{12}')
|
|
echo -e "\e[32mUUID=${uuid}\e[0m"
|
|
echo -e "\e[32mRelease=archlinux-${iso_date}01-x86_64.iso\e[0m"
|
|
echo ''
|
|
|
|
cat << EOF > grub_arch
|
|
menuentry "Arch ISO" {
|
|
|
|
set isofile="/archlinux-${iso_date}01-x86_64.iso"
|
|
|
|
insmod part_gpt
|
|
insmod ext2
|
|
insmod loopback
|
|
insmod iso9660
|
|
|
|
search --no-floppy --fs-uuid --set=root $uuid
|
|
|
|
loopback loop \$isofile
|
|
|
|
linux (loop)/arch/boot/x86_64/vmlinuz-linux \\
|
|
img_dev=/dev/disk/by-uuid/$uuid \\
|
|
img_loop=\$isofile
|
|
|
|
initrd (loop)/arch/boot/x86_64/initramfs-linux.img
|
|
}
|
|
EOF
|
|
|
|
read -p "Do you want to copy it to /boot/grub/grub.cfg and backup the old grub.cof?(YES/NO) :" grub_file
|
|
if [ "$grub_file" = "YES" ]; then
|
|
cp grub_arch /boot/grub/
|
|
mv /boot/grub/grub.cfg /boot/grub/grub.cfg.back
|
|
mv /boot/grub/grub_arch /boot/grub/grub.cfg
|
|
sed -n '1p' /boot/grub/grub.cfg
|
|
fi
|
|
|