main/postmarketos-mkinitfs: Append extra initfs hash to file contents
Partial revert of 24fa68c9 ("avoid storing initramfs-extra twice").
Some people have (rightfully) complained that including the hash in the filename of the initramfs-extra prevents the device from booting whenever the boot partition gets out of sync with the boot image.
In general we should assume that those two are in sync, but there is no need to unnecessarily break this if previously booting the outdated extra initramfs worked just fine.
At the end, the hash is just an implementation detail for the caching mechanism - we need it when (re-)generating the initramfs, but it does not have to be within the filename. Instead, we can simply append the hash to the file contents. GZIP will simply ignore the trailing garbage.
The boot partition will then look like:
$ cat /boot/initramfs-<flavor>-extra
<GZIP data>d3c7b449c6fc811d97351bbc46852b66 (the hash)
This makes the filename of initramfs-extra nice and stable again. It also fixes a regression where the initramfs-extra would no longer get symlinked by "pmbootstrap export" (I was going to fix that in pmbootstrap but now this solution is more appealing...)
While we're at it: Make the script more resilient again by writing to a temporary file first, then move it (atomically) to the real path.
Cc: @TravMurav @okias @drebrez