Commit d26a9de2 authored by Alessandro Rubini's avatar Alessandro Rubini

boot-procedure: fix use of "tee" command

We had
   /etc/init.d/wrs-boot-procedure: line 104: tee: not found

because tee is not in /bin; we need to always use "busybox tee".
This adds a variable TEE="busybox tee" to make it easier to remind, at
later edits, and fit in 80 columns at the same time.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent bdccd4d9
...@@ -51,6 +51,8 @@ mkdev_sh () { ...@@ -51,6 +51,8 @@ mkdev_sh () {
mkdev_sh "/sys/devices/virtual/misc/ubi_ctrl" mkdev_sh "/sys/devices/virtual/misc/ubi_ctrl"
TEE="busybox tee"; # often used.
# Installing is like updating, but there are more steps to do initially # Installing is like updating, but there are more steps to do initially
if $install; then if $install; then
...@@ -59,9 +61,9 @@ if $install; then ...@@ -59,9 +61,9 @@ if $install; then
sleep 1; # extra delay, so sleep above opens device before echo below sleep 1; # extra delay, so sleep above opens device before echo below
# format the ubi device and create volumes # format the ubi device and create volumes
echo -n "Formatting UBI device..." | busybox tee /dev/ttyGS0 echo -n "Formatting UBI device..." | $TEE /dev/ttyGS0
busybox yes yes | ubiformat -q /dev/mtd1; # takes 40s busybox yes yes | ubiformat -q /dev/mtd1; # takes 40s
echo " done" | busybox tee /dev/ttyGS0 echo " done" | $TEE /dev/ttyGS0
ubiattach -p /dev/mtd1 ubiattach -p /dev/mtd1
mkdev_sh "/sys/devices/virtual/ubi/ubi0" mkdev_sh "/sys/devices/virtual/ubi/ubi0"
...@@ -80,19 +82,19 @@ if $install; then ...@@ -80,19 +82,19 @@ if $install; then
# Eth0 is already up, thanks to ip= passed by bootloader # Eth0 is already up, thanks to ip= passed by bootloader
cd /update cd /update
echo -n "Getting tftp://$SERVERIP/$WRS_FW ..." | busybox tee /dev/ttyGS0 echo -n "Getting tftp://$SERVERIP/$WRS_FW ..." | $TEE /dev/ttyGS0
busybox tftp -g -r $WRS_FW -l $WRS_FW $SERVERIP 2>&1 | tee /dev/ttyGS0 busybox tftp -g -r $WRS_FW -l $WRS_FW $SERVERIP 2>&1 | $TEE /dev/ttyGS0
while [ ! -f $WRS_FW ]; do while [ ! -f $WRS_FW ]; do
echo "Downloading tftp://$SERVERIP/$WRS_FW failed" | \ echo "Downloading tftp://$SERVERIP/$WRS_FW failed" | \
busybox tee /dev/ttyGS0 $TEE /dev/ttyGS0
# this loops forever # this loops forever
sleep 5 sleep 5
busybox tftp -g -r $WRS_FW -l $WRS_FW $SERVERIP 2>&1 | tee /dev/ttyGS0 busybox tftp -g -r $WRS_FW -l $WRS_FW $SERVERIP 2>&1 | $TEE /dev/ttyGS0
done done
cd /; umount /update cd /; umount /update
echo " done" | busybox tee /dev/ttyGS0 echo " done" | $TEE /dev/ttyGS0
else else
# Not installing, access existing UBI volumes # Not installing, access existing UBI volumes
...@@ -109,7 +111,7 @@ mount -t ubifs ubi0:update /update ...@@ -109,7 +111,7 @@ mount -t ubifs ubi0:update /update
if [ -f /update/$WRS_FW ]; then if [ -f /update/$WRS_FW ]; then
# FIXME: save configuration somewhere, and recover it later # FIXME: save configuration somewhere, and recover it later
echo -n "Extracting filesystem..." | busybox tee /dev/ttyGS0 echo -n "Extracting filesystem..." | $TEE /dev/ttyGS0
# since we are upgrading, we'd better remove and recreate the volume # since we are upgrading, we'd better remove and recreate the volume
ubirmvol /dev/ubi0 --name=usr ubirmvol /dev/ubi0 --name=usr
ubimkvol /dev/ubi0 -s 150MiB -N usr ubimkvol /dev/ubi0 -s 150MiB -N usr
...@@ -118,7 +120,7 @@ if [ -f /update/$WRS_FW ]; then ...@@ -118,7 +120,7 @@ if [ -f /update/$WRS_FW ]; then
cd /usr cd /usr
tar -xOf /update/$WRS_FW wrs-usr.tar.gz | zcat | tar xf - tar -xOf /update/$WRS_FW wrs-usr.tar.gz | zcat | tar xf -
sync; cd /; umount /usr sync; cd /; umount /usr
echo " done" | busybox tee /dev/ttyGS0 echo " done" | $TEE /dev/ttyGS0
# check if we have an initramfs and/or kernel too # check if we have an initramfs and/or kernel too
mkdir -p /boot mkdir -p /boot
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment