mount-usb: suppress error output from calls to stat

If no USB storage devices inserted, stat will output
unnecessary error text to console

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
This commit is contained in:
Matt DeVillier 2020-01-28 20:47:00 -06:00
parent a2d50a10f7
commit 8d6f47fb4d
No known key found for this signature in database
GPG Key ID: 2BBB776A35B978FD

View File

@ -21,7 +21,7 @@ if [ ! -d /media ]; then
mkdir /media
fi
stat -c %N /sys/block/sd* | grep usb | cut -f1 -d ' ' | sed "s/[']//g;s|/sys/block|/dev|" > /tmp/usb_block_devices
stat -c %N /sys/block/sd* 2>/dev/null | grep usb | cut -f1 -d ' ' | sed "s/[']//g;s|/sys/block|/dev|" > /tmp/usb_block_devices
if [ -z `cat /tmp/usb_block_devices` ]; then
if [ -x /bin/whiptail ]; then
whiptail --title 'USB Drive Missing' \
@ -31,7 +31,7 @@ if [ -z `cat /tmp/usb_block_devices` ]; then
read
fi
sleep 1
stat -c %N /sys/block/sd* | grep usb | cut -f1 -d ' ' | sed "s/[']//g;s|/sys/block|/dev|" > /tmp/usb_block_devices
stat -c %N /sys/block/sd* 2>/dev/null | grep usb | cut -f1 -d ' ' | sed "s/[']//g;s|/sys/block|/dev|" > /tmp/usb_block_devices
if [ -z `cat /tmp/usb_block_devices` ]; then
if [ -x /bin/whiptail ]; then
whiptail $CONFIG_ERROR_BG_COLOR --title 'ERROR: USB Drive Missing' \