Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.61 KB | None | 0 0
  1. #2.sh
  2. #! /bin/sh
  3. echo "submenu 'All variants' {"
  4.  
  5. initrd=$(ls /boot | grep -E -o -e "^initrd.*$")
  6. for i in $initrd; do
  7.     version=$(echo $i | grep -E -o -e "-.*$")
  8.     #version=${version/./\.}
  9.     cores=$(ls /boot | grep -E -o -e ".*$version$")
  10.     for j in $cores; do
  11.         echo "menuentry '$j' {"
  12.         echo "set root='hd0,msdos1'"
  13.         echo "echo \"loading linux /boot/$j\""
  14.         echo "linux /boot/$j -root=/dev/sda ro"
  15.         echo "echo \"loading initrd /boot/$i\""
  16.         echo "initrd /boot/$i"
  17.         echo "}"
  18.     done
  19. done
  20.  
  21. echo "}"
  22.  
  23. #copytogrub.sh
  24. sudo cp 2.sh /etc/grub.d/42_mygrub
  25. sudo chmod +x /etc/grub.d/42_mygrub
  26. sudo update-grub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement