[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Run script after package install, update?



On 15/06/2025 00:10, Boyan Penkov wrote:
Hello folks,

I'm wiring to ask how to get apt to run a script after a particular
package is installed or updated.  Am I looking for dpkg-triggers or
some apt conf?

Specifically, I have GRUB installed to *every* drive, with the
expectation that all but one drives can fail and the machine will
still boot (to something...).  To this end, after I see apt has
updated grub, I manually run something like:
```
sudo update-grub
sudo grub-install /dev/sda
sudo grub-install /dev/sdb
sudo update-grub
```
I'd like to automate this; if grub is changed, run this script automatically.

I'm assuming you're using grub-pc (the BIOS-compatible version of grub) rather than grub-efi (the UEFI-compatible version). This doesn't _directly_ answer your question, but have you tried running "dpkg-reconfigure -plow grub-pc" (as root)? From what I recall, this should ask you a question about where you want to install grub to. In your case, selecting _multiple drives_ should tell the _existing scripts_ to install to each of those drives. That is, it is my opinion that you don't need to write any scripts to do what you're asking for, you just need to configure the existing scripts. If, however, you're wanting to know how to add the scripts as a learning exercise, then other people's suggestions are good.



Thanks kindly, and cheers!

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


Reply to: