Browse Source

blockcheck: add lua sleep support in older openwrt

pull/172/head
bol-van 1 year ago
parent
commit
ed333c1251
  1. 10
      common/base.sh

10
common/base.sh

@ -209,10 +209,13 @@ fsleep_setup()
if [ -z "$errtext" ]; then if [ -z "$errtext" ]; then
FSLEEP=3 FSLEEP=3
# newer openwrt has ucode with system function that supports timeout in ms # newer openwrt has ucode with system function that supports timeout in ms
elif ucode -e "system(['sleep','1'], 1)"; then elif ucode -e "system(['sleep','1'], 1)" 2>/dev/null; then
FSLEEP=4 FSLEEP=4
# older openwrt may have lua and nixio lua module
elif lua -e 'local nixio = require "nixio"; nixio.nanosleep(0,1);' 2>/dev/null ; then
FSLEEP=5
else else
FSLEEP=0 FSLEEP=5
fi fi
fi fi
} }
@ -232,6 +235,9 @@ minsleep()
4) 4)
ucode -e "system(['sleep','1'], 100)" ucode -e "system(['sleep','1'], 100)"
;; ;;
5)
lua -e 'local nixio = require "nixio"; nixio.nanosleep(0,100000000);'
;;
*) *)
sleep 1 sleep 1
esac esac

Loading…
Cancel
Save