I want to run a script automatically after every grub-update. The script itself consists of a single line
sed -i 's/[\]"!Windows 2006[\]"/"!Windows 2006"/g' /boot/grub/grub.cfg
For this purpose, I edited the already existing file
/etc/grub.d/40_custom
to read as follows:
#!/bin/sh
set -e
sed -i 's/[\]"!Windows 2006[\]"/"!Windows 2006"/g' /boot/grub/grub.cfg
This, however doesn't seem to work and I can't figure out why.
touch /tmp/grubtest
and runupdate-grub
. Is the file create?/etc/grub.d
are run as part of creatinggrub.cfg
. I doubt you can process that file while it is being created./usr/sbin/update-grub
and the/usr/sbin/grub-mkconfig
which it executes and add a simpleecho
command to each of the scripts, but they were not processed for some reason. Are those scripts cached somewhere so that the changes did not affect the executed commands or is anything in there that terminates the script before reaching the last line?touch /tmp/grubtest
works just fine. @muru maybe you are right. do you guys have some alternative?cp /boot/grub/grub.cfg /tmp/grub.cfg
. So you can see what's inside the grub file after running sed.