Merge pull request #511 from fewtarius/dev
Redirect stdout/stderr and eliminate the pipes.
This commit is contained in:
commit
9055572a2f
1 changed files with 2 additions and 43 deletions
|
@ -54,6 +54,8 @@ BIGFONT="1080"
|
|||
|
||||
TEE_PID=""
|
||||
|
||||
exec >/dev/console 2>&1
|
||||
|
||||
# common functions
|
||||
. /functions 2>/dev/null
|
||||
. /device.init 2>/dev/null
|
||||
|
@ -76,7 +78,6 @@ debug_msg() {
|
|||
}
|
||||
|
||||
debug_shell() {
|
||||
redirect_output_to_screen # restore output to a screen
|
||||
echo "### Starting debugging shell for boot step: $BOOT_STEP... type exit to quit ###"
|
||||
showcursor
|
||||
setsid cttyhack sh
|
||||
|
@ -515,8 +516,6 @@ do_reboot() {
|
|||
if [ -s /dev/init.log ]; then
|
||||
mv /dev/init.log /storage/init-previous.log
|
||||
fi
|
||||
redirect_output_to_screen
|
||||
delete_descriptors
|
||||
|
||||
# syncing filesystem
|
||||
sync
|
||||
|
@ -874,9 +873,6 @@ check_update() {
|
|||
#return 0
|
||||
fi
|
||||
|
||||
redirect_output_to_screen
|
||||
delete_descriptors
|
||||
|
||||
mkdir -p $UPDATE_DIR/.tmp &>/dev/null
|
||||
sync
|
||||
|
||||
|
@ -1154,36 +1150,6 @@ check_amlogic_dtb() {
|
|||
fi
|
||||
}
|
||||
|
||||
# create pipe and save original descriptors
|
||||
create_output_pipe() {
|
||||
# save original stdout and stderr descriptors
|
||||
exec 4>&1
|
||||
exec 5>&2
|
||||
|
||||
# create pipe and use it with tee
|
||||
mknod /tmp/output_pipe p
|
||||
tee </tmp/output_pipe /dev/init.log &
|
||||
TEE_PID=$!
|
||||
}
|
||||
|
||||
# redirect stdout and stderr
|
||||
redirect_output_to_pipe() {
|
||||
exec 1>/tmp/output_pipe
|
||||
exec 2>/tmp/output_pipe
|
||||
}
|
||||
|
||||
# restore original descriptors
|
||||
redirect_output_to_screen() {
|
||||
exec 1>&4
|
||||
exec 2>&5
|
||||
}
|
||||
|
||||
# delete descriptor
|
||||
delete_descriptors() {
|
||||
exec 4>&-
|
||||
exec 5>&-
|
||||
}
|
||||
|
||||
# Do init tasks to bring up system
|
||||
|
||||
# run platform_init script if exists
|
||||
|
@ -1195,9 +1161,6 @@ fi
|
|||
clear >/dev/console
|
||||
hidecursor
|
||||
|
||||
create_output_pipe
|
||||
redirect_output_to_pipe
|
||||
|
||||
# parse command line arguments
|
||||
for arg in $(cat /proc/cmdline); do
|
||||
case $arg in
|
||||
|
@ -1405,10 +1368,6 @@ else
|
|||
rm -f /sysroot/storage/init.log
|
||||
fi
|
||||
|
||||
# restore original descriptors and delete descriptors
|
||||
redirect_output_to_screen
|
||||
delete_descriptors
|
||||
|
||||
# switch to new sysroot and start real init
|
||||
exec /usr/bin/busybox switch_root /sysroot /usr/lib/systemd/systemd $INIT_ARGS $INIT_UNIT
|
||||
|
||||
|
|
Loading…
Reference in a new issue