set -u
-_h "sqm_lagthrottle configuration wizard - WELCOME"
+_h 'sqm_lagthrottle configuration wizard - WELCOME'
printf 'This script will prompt you for a number of settings\n(recommending sensible defaults where thought possible)\nrequired for proper operation of sqm_lagthrottle.\n\nPlease take a few minutes to follow its instructions\nto make the most out of dynamically adjusting your\nbandwidth shaper.\n'
echo "" >&2
_goon
-_h "set SQM device (downstream/rx)"
+_h 'set SQM device (downstream/rx)'
ifb_dev=$( (find /sys/devices/virtual/net/ -name ifb\* -print; echo sorry-no-dev-found) | head -n 1)
if [ -e "${ifb_dev}" ]
then
printf 'Please confirm this by supplying either this device path again,\nor a custom value to replace it:\n\t' >&2
read ifb_dev
else
- printf 'FATAL: No SQM shaping RX network device could be determined.\nAre you sure SQM has been set up via luci-app-sqm?\n' >&2
+ printf 'FATAL: No SQM shaping (rx) network device could be determined.\nAre you sure SQM has been set up via luci-app-sqm?\n' >&2
exit 1
fi
echo "" >&2
if ! [ -f "${ifb_dev}"///statistics/tx_bytes ]
then
- printf 'FATAL: No SQM shaping network device could be identified at\n\t"%s"\n' "${ifb_dev}" >&2
+ printf 'FATAL: No SQM shaping (rx) network device could be identified at\n\t"%s"\n' "${ifb_dev}" >&2
exit 1
fi
printf '\nEffective RX interface: [%s] - TX interface: [%s]\n' "${iface_rx}" "${iface_tx}"
_goon
-_h "set bandwidth limits"
+_h 'set bandwidth limits'
printf 'Please key in the positive integer LOWER bound (=minimum) bandwidth in Kbps\nfor your downstream Internet connection that you want to shape to: ' >&2
read bw_down_min
echo "" >&2
printf 'Effective RX bandwidth range: [%d ... %d Kbps]\n\n' "${bw_down_min}" "${bw_down_max}"
_goon
-_h "configure sqm_lagthrottle bias"
+_h 'configure sqm_lagthrottle bias'
printf 'sqm_lagthrottle can be configured to prioritize bandwith over latency,\nor vice versa.\n\nIf you would prefer to keep configured target bandwidth high even in\nthe face of worsening latency/bufferbloat, please key in "bandwith" below.\n\nAll other inputs will lead to a preference for lower latency.\n\n\t'
read bw_or_lat_bias
if [ x${bw_or_lat_bias} = xbandwidth ]
printf 'Effective choice: [%s]\n\n' "${bw_or_lat_bias}"
_goon
-_h "configure sqm_lagthrottle eagerness"
+_h 'configure sqm_lagthrottle eagerness'
printf 'sqm_lagthrottle can be configured to be eager or more relaxed\nwhen making shaper adjustment decisions.\n\nWith eager mode, decisions to try to react meaningfully to changing\ncircumstances are taken more often.\n\nIn relaxed mode, the bandwidth limits will be adjusted less frequently,\nwhich MAY save some CPU time.\n\nKeying in "relaxed" below chooses that mode.\nAll other inputs will lead to eager operation.\n\n\t'
read relaxed_or_eager
if [ x${relaxed_or_eager} = xrelaxed ]
printf 'Effective choice: [%s]\n\n' "${relaxed_or_eager}"
_goon
-_h "automatic ping peer selection"
+_h 'automatic ping peer selection'
printf 'Now, we will ping potential ICMP ECHO peers for a few minutes,\nrecord stats, and determine the top four peer choices.\n\nPlease keep your Internet-directed traffic AT A MINIMUM while\nthis task is active!\n' >&2
_goon
printf 'Suggested configuration values saved to\n\t%s\n\n' "${cfgo}" >&2
_goon 'Hit the [ENTER] to display full stats, or [CTRL]+[C] to exit.' >&2
-_h "Extended ping statistics (informational only)"
+_h 'Extended ping statistics (informational only)'
cat "${sto}" >&2
echo "" >&2
printf 'In case you missed it the first time around:\nSuggested configuration values saved to\n\t%s\n\n' "${cfgo}" >&2