The “𝚀𝚞𝚋𝚎𝚜 𝚒𝚗 𝚝𝚖𝚙𝚏𝚜” will be like a green wig feature for LiveUSB. At least till, that becames a mainstram, hah!
Continue, the automation:
This boot scripts will ask you “𝙱𝚘𝚘𝚝 𝚝𝚘 𝚁𝙰𝙼? (𝚗)” question at graphical boot splash, just after the “𝙳𝚒𝚜𝚔 𝚙𝚊𝚜𝚜𝚠𝚘𝚛𝚍” screen. You can just press Enter if 𝚗𝚘.
The boot to 𝚁𝙰𝙼 automation with a 𝚍𝚛𝚊𝚌𝚞𝚝 module
See the man dracut.modules
1. Create foder for the boot module
cd /usr/lib/dracut/modules.d/
sudo mkdir 01ramboot
2. module-setup.sh: the module main script
echo '#!/usr/bin/bash
check() {
return 0
}
depends() {
return 0
}
install() {
inst_simple "$moddir/tmpfs.sh" "/usr/bin/tmpfs"
inst_hook cleanup 00 "$moddir/pass.sh"
}
' | sudo tee 01ramboot/module-setup.sh
3. pass.sh: ask question script
echo '#!/usr/bin/bash
command -v ask_for_password >/dev/null || . /lib/dracut-crypt-lib.sh
PROMPT="Boot to RAM? (n)"
CMD="/usr/bin/tmpfs"
TRY="3"
ask_for_password \
--cmd "$CMD" \
--prompt "$PROMPT" \
--tries "$TRY" \
--ply-cmd "$CMD" \
--ply-prompt "$PROMPT" \
--ply-tries "$TRY" \
--tty-cmd "$CMD" \
--tty-prompt "$PROMPT" \
--tty-tries "$TRY" \
--tty-echo-off
' | sudo tee 01ramboot/pass.sh
See the man plymouth
.
4. tmpfs.sh: mount 𝚝𝚖𝚙𝚏𝚜 script
echo '#!/usr/bin/bash
read line
case "${line:-Nn}" in
[Yy]* )
mkdir /mnt
umount /sysroot
mount /dev/mapper/qubes_dom0-root /mnt
mount -t tmpfs -o size=100% none /sysroot
cp -a /mnt/* /sysroot
exit 0
;;
[Nn]* )
exit 0
;;
* )
exit 1
;;
esac
' | sudo tee 01ramboot/tmpfs.sh
5. Make scritps executable:
sudo chmod 755 01ramboot/pass.sh 01ramboot/tmpfs.sh
6. Enable the module
echo 'add_dracutmodules+=" ramboot "' | sudo tee /etc/dracut.conf.d/ramboot.conf
See the man dracut.conf
.
7. Regenerate the latest /boot/initramfs...
image with ramboot
sudo dracut --verbose --force
sudo reboot
_
NOTE: This method can be modify with dracut 𝙷𝚘𝚘𝚔: 𝚌𝚖𝚍𝚕𝚒𝚗𝚎
if you need to have a special kernel boot string in the grub boot menu and not to use the graphical boot splash screen.
0. To remove the scripts
sudo rm -Rf /usr/lib/dracut/modules.d/01ramboot
sudo rm -f /etc/dracut.conf.d/ramboot.conf
sudo dracut --verbose --force