diff options
-rwxr-xr-x | mkinitramfs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mkinitramfs b/mkinitramfs index b0b015e..e36763b 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -191,6 +191,14 @@ function main { local cache='/tmp/initrd' local res_path=/usr/share/mkinitramfs/ + # Ensure init script has no syntax errors (linting process) + if ! bash -n ${res_path}/init; then + printf '\n\nERROR: Syntax errors were found in the init script.\n' + printf 'Please resolve the above issues and try again.\n' + printf 'Exiting to avoid creating an unbootable initramfs.\n\n' + return 1 + fi + # List of binaries to exist in the new initramfs resolve_bins \ bash cat echo ls cryptsetup chmod chown mount sleep umount clear cut \ |