Custom initramfs libraries & scripts meant for runtime are executed while building the initrd

Today I noticed this in a build log:

/usr/share/initramfs-tools/scripts/lib/first_boot_repartition: 3: .: cannot open /scripts/functions: No such file
+ ORIG_DISK_GUID=17B81DA0-8B1E-4269-9C39-FE5C7B9B58A3
+ MIN_SYSTEM_PARTITION_SIZE=2617245696
+ PARENT_DEVICE=prereqs
/usr/share/initramfs-tools/scripts/lib/verify_partition_table: 16: 2: parameter not set

I'm not sure why these are loaded (I would assume that only scripts in well-known directories are loaded, not in a new sub-directory like lib) and when exactly, but I'm pretty sure this was not what segfault intended to happen when he moved code there. Let's find a better location for these scripts before they end up having unintended consequences that are worse than this.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information