# HG changeset patch # User Pascal Bellard # Date 1636452486 0 # Node ID 9f6e7841d19cbbdae1c4fa9f1d01db3de4e23573 # Parent cd2735c8e31b95b7ed263e5752643faac86518a2 network.cgi: fix wait_up() diff -r cd2735c8e31b -r 9f6e7841d19c boot.cgi --- a/boot.cgi Sun Sep 27 16:27:37 2020 +0000 +++ b/boot.cgi Tue Nov 09 10:08:06 2021 +0000 @@ -157,7 +157,7 @@ # Name echo "$name" # First check if daemon is started at boottime - [ echo "RUN_DAEMONS" | fgrep $name ] && boot="on boot" + echo "RUN_DAEMONS" | fgrep -q $name && boot="on boot" # Standard SliTaz busybox daemons and firewall echo -n "" grep -qi "^${name}_OPTIONS=" /etc/daemons.conf && cfg="options|$cfg" @@ -350,7 +350,7 @@ entry='-1' echo "$menu" | while read line do - if [ -n "$(echo $line | grep '#')" ]; then + if echo $line | grep -q '#'; then entry=$(($entry + 1)) fi echo $line | sed "s|#|$entry|" @@ -387,7 +387,7 @@ [ "$iso" ] || msg err "$(_ 'Invalid ISO image.')" - if [ "$iso" -a "$action" -a "$action" != "nop" ]; then + if [ "$iso" ] && [ "$action" ] && [ "$action" != "nop" ]; then case "$action" in install*) dev=$(POST instdev) ;; *) dev=$(POST usbkeydev) ;; @@ -487,7 +487,7 @@ EOT - [ "$REMOTE_USER" = "root" -a -x /usr/bin/taziso ] && cat <$(_ 'ISO mine') EOT [ -w /boot/grub/menu.lst ] && cat <
'
-			cat "$HOSTSDIR/diff" | syntax_highlighter diff
+			syntax_highlighter diff < "$HOSTSDIR/diff"
 			echo '
' fi @@ -264,7 +264,7 @@ EOT - if [ -e "$HOSTSDIR/$letter" -o -n "$(grep -m1 "#$letter\$" /etc/hosts)" ]; then + if [ -e "$HOSTSDIR/$letter" ] || grep -qm1 "#$letter\$" /etc/hosts; then # List installed # If /var/run/tazpkg/hosts/ was mistakenly cleaned @@ -287,8 +287,7 @@ if [ "$check" = 'yes' ]; then # Check for update (not really download) - busybox wget -s --header "If-Modified-Since: $(date -Rur "$HOSTSDIR/$letter")" "$url" - if [ "$?" -eq 0 ]; then + if busybox wget -s --header "If-Modified-Since: $(date -Rur "$HOSTSDIR/$letter")" "$url"; then # Update available touch "$HOSTSDIR/$letter.avail" else diff -r cd2735c8e31b -r 9f6e7841d19c index.cgi --- a/index.cgi Sun Sep 27 16:27:37 2020 +0000 +++ b/index.cgi Tue Nov 09 10:08:06 2021 +0000 @@ -102,7 +102,7 @@ # Localized description desc="$(sed -n "s|^.*xml:lang=\"${LANG%%_*}\">\(.*\)<.*|\1|p" $mimefile)" fi - if [ -z "$LANG" -o -z "$desc" ]; then + if [ -z "$LANG" ] || [ -z "$desc" ]; then # Default (English) description desc="$(sed -n "s|^.*\(.*\)<.*|\1|p" $mimefile)" fi @@ -110,7 +110,7 @@ pattern=$(sed -n 's|^.*pattern=\"\(.*\)\".*|\1|p' $mimefile) extra="$extra --file-filter='$desc|$(echo $pattern)'" fi - icon="$(echo $(GET type) | tr '/' '-')" + icon="$(GET type | tr '/' '-')" fi header @@ -268,7 +268,7 @@ *.ini) echo ''; end_code='' htmlize ;; - *.conf|*.lst) + *.lst) syntax_highlighter conf ;; *Xorg.0.log) syntax_highlighter xlog ;; diff -r cd2735c8e31b -r 9f6e7841d19c lib/libtazpanel --- a/lib/libtazpanel Sun Sep 27 16:27:37 2020 +0000 +++ b/lib/libtazpanel Tue Nov 09 10:08:06 2021 +0000 @@ -404,7 +404,7 @@ if [ -n "$(which getent)" ]; then getent "$1" else - cat "/etc/$1" | sed '/^#/d' + sed '/^#/d' < "/etc/$1" fi } diff -r cd2735c8e31b -r 9f6e7841d19c network.cgi --- a/network.cgi Sun Sep 27 16:27:37 2020 +0000 +++ b/network.cgi Tue Nov 09 10:08:06 2021 +0000 @@ -29,7 +29,7 @@ # Sleep until connection established (max 5 seconds) for i in $(seq 5); do - [ -n "$(iwconfig 2>/dev/null | fgrep Link)" ] && break + iwconfig 2>/dev/null | fgrep -q Link && break sleep 1 done } @@ -108,7 +108,7 @@ wait_up() { for i in $(seq 5); do - [ -z "$(cat /sys/class/net/*/operstate | fgrep up)"] && sleep 1 + cat /sys/class/net/*/operstate | fgrep -q up || sleep 1 done } @@ -150,7 +150,7 @@ ;; *\ hostname\ *) hostname="$(GET hostname)" - echo $(_ 'Changed hostname: %s' "$hostname") | log + _ 'Changed hostname: %s' "$hostname" | log echo "$hostname" > /etc/hostname;; *\ rmarp\ *) arp -d $(urldecode "$(GET entry)") ;; @@ -393,10 +393,10 @@ # Authentication type AUTH="$(echo "$SCAN" | sed -n 's|.*Authentication Suites[^:]*: *\(.*\)|\1|p')" - if [ -n "$(echo -n $AUTH | fgrep PSK)" ]; then + if echo -n $AUTH | fgrep -q PSK; then # WPA-Personal. Authentication using password (PSK = pre-shared key) WIFI_KEY_TYPE='WPA' - elif [ -n "$(echo -n $AUTH | fgrep 802.1x)" ]; then + elif echo -n $AUTH | fgrep -q 802.1x; then # WPA-Enterprise. Authentication using username, password, certificates... WIFI_KEY_TYPE='EAP' else @@ -725,7 +725,7 @@ [ $(($(cat /sys/class/net/$i/flags) & 0x1080)) -eq 4096 ] && echo $i done)" - if [ "$REMOTE_USER" = "root" -a -n "$devs" ]; then + if [ "$REMOTE_USER" = "root" ] && [ -n "$devs" ]; then cat <
$(_ 'VLAN')
@@ -837,7 +837,7 @@ EOT - [ "$REMOTE_USER" = "root" -a "$(which iptables-save)" ] && cat <
$(_ 'Firewall') $(edit_button /etc/knockd.conf "$(_ 'Port knocker')") diff -r cd2735c8e31b -r 9f6e7841d19c powersaving.cgi --- a/powersaving.cgi Sun Sep 27 16:27:37 2020 +0000 +++ b/powersaving.cgi Tue Nov 09 10:08:06 2021 +0000 @@ -21,7 +21,7 @@ case "$p" in governor) for i in /sys/devices/system/cpu/cpu*/cpufreq ; do - echo "$(POST $p)" > $i/scaling_governor + POST $p > $i/scaling_governor done esac done diff -r cd2735c8e31b -r 9f6e7841d19c settings.cgi --- a/settings.cgi Sun Sep 27 16:27:37 2020 +0000 +++ b/settings.cgi Tue Nov 09 10:08:06 2021 +0000 @@ -18,7 +18,7 @@ listdb() { for item in $(getdb $1 | cut -d: -f1); do - echo "\n" + echo -e "\n" done }