The scripts in
/etc/kernel/postinst.d directory works,
For
/etc/kernel/preinst.d directory, I see we have
/etc/kernel/install.d directory instead and that's apparently part of systemd. (I use systemd)
Neither of my scripts at
/etc/kernel/preinst.d nor
/etc/kernel/install.d did work. My system wasn't aware of the scripts in there.
Here what I did for my each folder, and for possible future reference;
At
/etc/kernel/postinst.d I've created a file called
99-kernel.install
/etc/kernel/postinst.d/99-kernel.install
Code: Select all
#!/bin/env bash
grub-mkconfig -o /boot/grub/grub.cfg
sleep 2s
echo "Unmounting boot partition..."
umount /boot
chmod +x /etc/kernel/postinst.d/99-kernel.install
Also,
Tried both
/etc/kernel/preinst.d and
/etc/kernel/install.d directories and created the same file there so in this case,
/etc/kernel/install.d/99-kernel.install
Code: Select all
#!/bin/env bash
if mountpoint -q /boot
then
echo "Boot partition is already mounted."
else
echo "Mounting boot partition..."
mount /boot
fi
chmod +x /etc/kernel/install.d/99-kernel.install
I'm looking for further instructions to make pre-install scripts work.
What can be done here, how can I write custom system hooks, is it possible, is it safe enough?
Thanks again!