summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2023-03-05 10:50:42 -0700
committerAaron Ball <nullspoon@oper.io>2023-03-05 10:50:42 -0700
commit9dddbfed944f9afaa3ebba37e65d20b5a0ad85bf (patch)
tree568ad6c4e5ae300067c740ea1e9f68c04a67a482 /init
parent641531cb671f9a172cb60cd2b47a23a3f1a37f83 (diff)
downloadmkinitramfs-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.
Diffstat (limited to 'init')
-rwxr-xr-xinit11
1 files changed, 6 insertions, 5 deletions
diff --git a/init b/init
index b1d3fca..51758a9 100755
--- a/init
+++ b/init
@@ -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

Generated by cgit