diff options
author | Aaron Ball <nullspoon@oper.io> | 2023-03-05 10:50:42 -0700 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2023-03-05 10:50:42 -0700 |
commit | 9dddbfed944f9afaa3ebba37e65d20b5a0ad85bf (patch) | |
tree | 568ad6c4e5ae300067c740ea1e9f68c04a67a482 | |
parent | 641531cb671f9a172cb60cd2b47a23a3f1a37f83 (diff) | |
download | mkinitramfs-9dddbfed944f9afaa3ebba37e65d20b5a0ad85bf.tar.gz mkinitramfs-9dddbfed944f9afaa3ebba37e65d20b5a0ad85bf.tar.xz |
Remove clear and cat from output init ram fs
Both the clear and cat commands are not technically required, as they
have bash builtin equivelants. This will shave off tens of kilobytes
(very little unfortunately).
This also changes the syntax of the parse_cmdline function to something
more reasonable, also no longer using cat but using a bash builtin.
-rwxr-xr-x | init | 11 | ||||
-rwxr-xr-x | mkinitramfs | 4 |
2 files changed, 8 insertions, 7 deletions
@@ -23,10 +23,10 @@ export MOUNTOPTS=() screen_init() { # Clear screen - [ "${QUIET}" -eq 1 ] && clear + [ "${QUIET}" -eq 1 ] && printf '\033c' # Output message file if it exists - [ -f /etc/msg ] && cat /etc/msg + [ -f /etc/msg ] && printf '%s\n' "$(</etc/msg)" } @@ -58,10 +58,11 @@ log() { # # Resolves the path to the root device from the cmdline root= syntax. -# Currently handles UUID syntax and /dev/sdx syntax +# Currently handles UUID syntax and /dev/sdx syntax, btrfs subvols, debugging, +# and quiet options. # parse_cmdline() { - local cmdline=${1} + local cmdline="$(<${1:?})" for i in ${cmdline[@]}; do case "${i}" in @@ -159,7 +160,7 @@ main() { log INFO "Fake root location ${fakeroot} does not exist. Cannot boot." fi - parse_cmdline "$(cat /proc/cmdline)" + parse_cmdline /proc/cmdline # display fanciful boot image screen_init diff --git a/mkinitramfs b/mkinitramfs index 676c770..70802a2 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -203,14 +203,14 @@ function main { # List of binaries to exist in the new initramfs # Standard shell binaries - resolve_bins bash cat pidof ps ls clear grep less switch_root kill + resolve_bins bash pidof ps ls grep less switch_root kill # Module management resolve_bins udevadm udevd modprobe rmmod # For encrypted and block device support resolve_bins partprobe dmsetup mount umount cryptsetup # For debugging - #resolve_bins sleep mkdir chmod chown tr + #resolve_bins sleep mkdir chmod chown tr clear cat # Set up the archive source dir. cache_dir_setup ${cache} |