From: Johannes Truschnigg Date: Fri, 2 Sep 2022 20:27:50 +0000 (+0200) Subject: Implement minor config wizard ergonomics improvements X-Git-Url: https://johannes.truschnigg.info/gitweb/?a=commitdiff_plain;h=efad703d5a113539fe72ac48f8eddefb32ef879d;p=sqm_lagthrottle Implement minor config wizard ergonomics improvements --- diff --git a/sqm_lagthrottle_suggest_config.sh b/sqm_lagthrottle_suggest_config.sh index 0f4aa4e..747dced 100755 --- a/sqm_lagthrottle_suggest_config.sh +++ b/sqm_lagthrottle_suggest_config.sh @@ -19,7 +19,7 @@ TZ=UTC LC_ALL=C export TZ LC_ALL -for p in sort sleep cat awk tee date fping find head +for p in sort sleep cat awk tee date fping find head clear do type "${p}" >/dev/null || { printf 'FATAL: Required program "%s" not installed.\n' "${p}" >&2; exit 1; } done @@ -31,6 +31,14 @@ _goon() { printf '\n\n' >&2 } +_h() { + local l + l=$(( 60 - ${#1} )) + clear + printf '=== [ %s ] %'"${l}"'s \n\n' "${1}" "===" >&2 +} + + fpo="/tmp/fping_${$}.out" sto="${fpo}.stats" cfgo="./sqm_lagthrottle.conf.$(date +%s)" @@ -38,7 +46,7 @@ POTENTIAL_PING_PEERS='1.1.1.1 8.8.8.8 a.root-servers.net b.root-servers.net c.ro set -u -echo "Welcome to the interactive sqm_lagthrottle configuration wizard." >&2 +_h "sqm_lagthrottle configuration wizard - WELCOME" echo "" >&2 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' _goon @@ -48,6 +56,7 @@ echo "" >&2 _goon +_h "set SQM device (downstream)" ifb_dev=$(find /sys/devices/virtual/net/ -name ifb\* -print | head -n 1) if [ -e /sys/devices/virtual/net/ifb* ] then @@ -68,7 +77,9 @@ fi stats_rx="${ifb_dev}"/statistics/tx_bytes iface_rx="${ifb_dev%%*/}" +_goon +_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 @@ -77,12 +88,14 @@ printf 'Please key in the positive integer UPPER bound (=maximum) bandwidth in K read bw_down_max echo "" >&2 -if ! [ ${bw_down_min} -lt ${bw_down_max} ] +if ! [ ${bw_down_min}0 -lt ${bw_down_max}0 ] then printf 'FATAL: Maximum shaping bandwith must be greater than minimum.\n' exit 1 fi +_goon +_h "configure sqm_lagthrottle behavior" 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 ] @@ -102,10 +115,11 @@ else relaxed_or_eager="eager" fi printf 'Effective choice: [%s]\n\n' "${relaxed_or_eager}" -echo "" >&2 -echo "" >&2 +_goon + +_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 this is happening!\n' >&2 +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 'Performing pings, please be patient...' >&2