I would like to automatically run a script after grub-install (using Grub2) if it's possible?

Some context. The script will simply run grub-install /dev/sda1, grub-install /dev/sdb1, grub-install /dev/sdc1 as I want all three EFI boot partitions in sync.

  • grub-install is a shell script, just edit it – daisy Oct 20 '12 at 0:04
  • @warl0ck: I think it will get removed when an update of grub-install occurs. Which might very well be just when I need it. – Deleted Oct 22 '12 at 17:46

You can simply put grub-install along with these three commands in a file and add it somewhere in the PATH so that you can run it whenever you need to.

Alternatively alias grub-install in root's ~/.bashrc (depending on what shell root uses) to grub-install && grub-install /dev/sd{a,b,c}1

  • My main concern is when doing apt-get dist-upgrade, I want all three HDD's to get updated then. I don't think .bashrc is read when running commands through sudo. Creating a script and putting it somewhere on roots path also doesn't help, as it's not only when I run it I want to make sure all three HDD's are addressed. – Deleted Oct 20 '12 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.