On 07/31/2013 11:37 PM, Paul Komkoff wrote: > Good morning. > > I'm trying to achieve a very specific thing and I'm wondering if you can point > me in the right direction. > > I have a system that sets up dual-boot workstations and makes grub the > bootloader. Now, I need to provide 2 network boot targets: one that will set > grub default to windows, another one to fedora. For that, I have a script that > updates grubenv; now, I need to package it into initramfs. > > Before dracut/systemd what I did is just took mkinitrd result, unpacked, added > my script to it, and modified init to run it and then reboot. With dracut I was > hoping to try to reuse it as much as possible, as to run grub2-editenv I need > /boot mounted - means device detection and that's something I have to use > dracut/udev for. > > I have the following ideas so far: > - just stick my code somehow into mount triggers, and when root is mounted > mount /boot, run, and then reboot -f don't forget to umount before "reboot -f" > - stick my code into pre-pivot (mount /boot and edit env etc), then instead of > initrd-switch-root.target do reboot.target > > I was wondering if there are better and/or cleaner ways for doing that (I'd > probably start implementing a module for the second one in the meantime). > > Thanks! Both solutions will work. For Fedora >= 19, it's even simpler. Just add the option "x-initrd.mount" to the /boot /etc/fstab entry. The /usr/lib/systemd/system-generators/systemd-fstab-generator takes care of generating a mount unit, after root is mounted. systemd mounts it as part of initrd-fs.target. See man dracut.bootup(7). You can put your custom service in initrd.target.wants with: After: initrd-fs.target Before: initrd-cleanup.service /boot is mounted at that point of time. -- To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html