aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2020-10-19 18:04:39 -0500
committerRob Landley <rob@landley.net>2020-10-19 18:04:39 -0500
commit273c9e72c1a578915cc4db6a83ca5e0f6a1771f4 (patch)
treea00f430bf15d4510fa07e7915b7826f05e6be634 /scripts
parent082363afd054e10d4db0188c39a7447cbce029fa (diff)
downloadtoybox-273c9e72c1a578915cc4db6a83ca5e0f6a1771f4.tar.gz
Do an "exec >/dev/console 2>&1" early in mkroot init so we have
debug output if anything later in the script fails.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/mkroot.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/mkroot.sh b/scripts/mkroot.sh
index 040f7c60..431e0d89 100755
--- a/scripts/mkroot.sh
+++ b/scripts/mkroot.sh
@@ -74,16 +74,17 @@ cat > "$ROOT"/init << 'EOF' &&
export HOME=/home PATH=/bin:/sbin
-mountpoint -q proc || mount -t proc proc proc
-mountpoint -q sys || mount -t sysfs sys sys
if ! mountpoint -q dev; then
mount -t devtmpfs dev dev || mdev -s
+ [ $$ -eq 1 ] && exec >/dev/console 2>&1
for i in ,fd /0,stdin /1,stdout /2,stderr
do ln -sf /proc/self/fd${i/,*/} dev/${i/*,/}; done
mkdir -p dev/{shm,pts}
mountpoint -q dev/pts || mount -t devpts dev/pts dev/pts
chmod +t /dev/shm
fi
+mountpoint -q proc || mount -t proc proc proc
+mountpoint -q sys || mount -t sysfs sys sys
if [ $$ -eq 1 ]; then # Setup networking for QEMU (needs /proc)
ifconfig lo 127.0.0.1