tazpanel rev 626

Remove ashism ==
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 26 08:30:05 2019 +0100 (2019-02-26)
parents de45f1a88907
children b932799f8ae1
files boot.cgi bootloader hardware.cgi hosts.cgi index.cgi lib/libtazpanel network.cgi settings.cgi
line diff
     1.1 --- a/boot.cgi	Mon Jul 30 12:18:05 2018 +0200
     1.2 +++ b/boot.cgi	Tue Feb 26 08:30:05 2019 +0100
     1.3 @@ -36,7 +36,7 @@
     1.4  case " $(GET) " in
     1.5  	*\ syslog\ *)
     1.6  		logtype="$(GET syslog)"
     1.7 -		[ "${logtype:-syslog}" == 'syslog' ] && logtype='messages'
     1.8 +		[ "${logtype:-syslog}" = 'syslog' ] && logtype='messages'
     1.9  		xhtml_header "$(_ 'System logs')"
    1.10  
    1.11  		cat <<EOT
    1.12 @@ -54,7 +54,7 @@
    1.13  EOT
    1.14  		for i in $(sed '/var\/log/!d;s|.*/log/||' /etc/syslog.conf); do
    1.15  			unset act
    1.16 -			[ "$i" == "$logtype" ] && act=' class="active"'
    1.17 +			[ "$i" = "$logtype" ] && act=' class="active"'
    1.18  			cat <<EOT
    1.19  	<li$act><a href="?syslog=$i" title="$(sed "/$i$/!d;s/[\t ].*//" /etc/syslog.conf)">$i</a></li>
    1.20  EOT
    1.21 @@ -487,7 +487,7 @@
    1.22  	<button name="syslog"  data-icon="@logs@">$(_ 'System logs')</button>
    1.23  	<button name="daemons" data-icon="@daemons@" data-root>$(_ 'Manage daemons')</button>
    1.24  EOT
    1.25 -		[ "$REMOTE_USER" == "root" -a -x /usr/bin/taziso ] && cat <<EOT
    1.26 +		[ "$REMOTE_USER" = "root" -a -x /usr/bin/taziso ] && cat <<EOT
    1.27  	<button name="iso"     data-icon="@cd@">$(_ 'ISO mine')</button>
    1.28  EOT
    1.29  		[ -w /boot/grub/menu.lst ] && cat <<EOT
     2.1 --- a/bootloader	Mon Jul 30 12:18:05 2018 +0200
     2.2 +++ b/bootloader	Tue Feb 26 08:30:05 2019 +0100
     2.3 @@ -110,7 +110,7 @@
     2.4  		ddq bs=16 count=$syssz >>kernel
     2.5  		[ $(($syssz % 32)) -ne 0 ] &&
     2.6  		ddq bs=16 of=/dev/null count=$((32 - ($syssz % 32)))
     2.7 -		if [ $(get $Magic kernel 4) == 1400005704 ]; then
     2.8 +		if [ $(get $Magic kernel 4) = 1400005704 ]; then
     2.9  	  		ddq bs=1 count=200 skip=$((512+$(get 0x20E kernel 2))) \
    2.10  	  			if=kernel | strings | sed q
    2.11  			len=$(get $RamfsLenOfs kernel 4)
    2.12 @@ -379,7 +379,7 @@
    2.13  	rm -f $bs
    2.14  }
    2.15  
    2.16 -if [ "$FORMAT" == "0" ]; then # unsplitted
    2.17 +if [ "$FORMAT" = "0" ]; then # unsplitted
    2.18  	floppyset > $PREFIX
    2.19  	PAD=$(( 512 - ($(stat -c %s $PREFIX) % 512) ))
    2.20  	[ $PAD -ne 512 ] && ddq if=/dev/zero bs=1 count=$PAD >> $PREFIX
     3.1 --- a/hardware.cgi	Mon Jul 30 12:18:05 2018 +0200
     3.2 +++ b/hardware.cgi	Tue Feb 26 08:30:05 2019 +0100
     3.3 @@ -428,7 +428,7 @@
     3.4  			[ -n "$mp" ] && action="umount"
     3.5  			type=$(blkid $fs | sed '/ TYPE=/!d;s/.* TYPE="\([^"]*\).*/\1/')
     3.6  			[ -n "$type" ] || continue
     3.7 -			[ "$type" == "swap" ] && action="swapon"
     3.8 +			[ "$type" = "swap" ] && action="swapon"
     3.9  			if grep -q "^$fs " /proc/swaps; then
    3.10  				action="swapoff"
    3.11  				set -- $(grep "^$fs " /proc/swaps)
    3.12 @@ -459,7 +459,7 @@
    3.13  			case " $bootdevs " in *\ $fs\ *) dsk="<i>$dsk</i>";; esac
    3.14  
    3.15  			radio="<input type=\"radio\" name=\"device\" value=\"$action $fs\" id=\"${fs##*/}\"/>"
    3.16 -			[ "$REMOTE_USER" == "root" ] || radio=""
    3.17 +			[ "$REMOTE_USER" = "root" ] || radio=""
    3.18  			cat <<EOT
    3.19  			<tr>
    3.20  				<td>$radio<!--
    3.21 @@ -491,7 +491,7 @@
    3.22  			</tbody>
    3.23  		</table>
    3.24  EOT
    3.25 -		[ "$REMOTE_USER" == "root" ] && cat <<EOT
    3.26 +		[ "$REMOTE_USER" = "root" ] && cat <<EOT
    3.27  		$(lib crypto input)
    3.28  
    3.29  		<footer>
    3.30 @@ -570,7 +570,7 @@
    3.31  	*) ro="" ;;
    3.32  	esac
    3.33  	size=$(blk2h $(cat $dir/size))
    3.34 -	[ "$size" == "0.0K" ] && size="" && ro=""
    3.35 +	[ "$size" = "0.0K" ] && size="" && ro=""
    3.36  	set -- $(losetup $devloop)
    3.37  	set -- "${3:-$(cat $dir/loop/backing_file)}" "${2:-$(cat $dir/loop/offset)}" ${ro// /&nbsp;}
    3.38  	cat <<EOT
     4.1 --- a/hosts.cgi	Mon Jul 30 12:18:05 2018 +0200
     4.2 +++ b/hosts.cgi	Tue Feb 26 08:30:05 2019 +0100
     4.3 @@ -258,8 +258,8 @@
     4.4  	<td>$name</td>
     4.5  	<td><a data-icon="@info@" target="_blank" rel="noopener" href="$info">$(_ 'info')</a></td>
     4.6  	<td>
     4.7 -		$([ "$updated" == 'monthly'   ] && _ 'Updated monthly')
     4.8 -		$([ "$updated" == 'regularly' ] && _ 'Updated regularly')
     4.9 +		$([ "$updated" = 'monthly'   ] && _ 'Updated monthly')
    4.10 +		$([ "$updated" = 'regularly' ] && _ 'Updated regularly')
    4.11  	</td>
    4.12  	<td>
    4.13  EOT
    4.14 @@ -285,7 +285,7 @@
    4.15  			check='yes'
    4.16  		fi
    4.17  
    4.18 -		if [ "$check" == 'yes' ]; then
    4.19 +		if [ "$check" = 'yes' ]; then
    4.20  			# Check for update (not really download)
    4.21  			busybox wget -s --header "If-Modified-Since: $(date -Rur "$HOSTSDIR/$letter")" "$url"
    4.22  			if [ "$?" -eq 0 ]; then
     5.1 --- a/index.cgi	Mon Jul 30 12:18:05 2018 +0200
     5.2 +++ b/index.cgi	Tue Feb 26 08:30:05 2019 +0100
     5.3 @@ -52,7 +52,7 @@
     5.4  # Terminal prompt
     5.5  
     5.6  term_prompt() {
     5.7 -	if [ "$user" == 'root' ]; then
     5.8 +	if [ "$user" = 'root' ]; then
     5.9  		local color1='color31' sign='#'
    5.10  	else
    5.11  		local color1='color32' sign='$'
    5.12 @@ -73,7 +73,7 @@
    5.13  		case "$(GET do)" in
    5.14  
    5.15  		*-selection)		# display Yad file/dir picker (AJAX)
    5.16 -			if [ "$(GET do)" == 'dir-selection' ]; then
    5.17 +			if [ "$(GET do)" = 'dir-selection' ]; then
    5.18  				title="$(_ 'Choose directory')"
    5.19  				extra='--directory'
    5.20  				icon='folder'
    5.21 @@ -307,7 +307,7 @@
    5.22  
    5.23  		# Terminal history
    5.24  
    5.25 -		if [ "$cmd" == 'history' ]; then
    5.26 +		if [ "$cmd" = 'history' ]; then
    5.27  			cat <<EOT
    5.28  <section>
    5.29  	<header>
    5.30 @@ -517,11 +517,11 @@
    5.31  <form>
    5.32  	<p>$(_ 'Refresh:')
    5.33  	<input type="hidden" name="top"/>
    5.34 -	<input type="radio" name="refresh" value="1"  id="r1" $([ "$r" == 1  ] && echo checked) onchange="this.form.submit()"/>
    5.35 +	<input type="radio" name="refresh" value="1"  id="r1" $([ "$r" = 1  ] && echo checked) onchange="this.form.submit()"/>
    5.36  	<label for="r1">$(_ '1s'  )</label>
    5.37 -	<input type="radio" name="refresh" value="5"  id="r2" $([ "$r" == 5  ] && echo checked) onchange="this.form.submit()"/>
    5.38 +	<input type="radio" name="refresh" value="5"  id="r2" $([ "$r" = 5  ] && echo checked) onchange="this.form.submit()"/>
    5.39  	<label for="r2">$(_ '5s'  )</label>
    5.40 -	<input type="radio" name="refresh" value="10" id="r3" $([ "$r" == 10 ] && echo checked) onchange="this.form.submit()"/>
    5.41 +	<input type="radio" name="refresh" value="10" id="r3" $([ "$r" = 10 ] && echo checked) onchange="this.form.submit()"/>
    5.42  	<label for="r3">$(_ '10s' )</label>
    5.43  	<input type="radio" name="refresh" value=""   id="r4" $([ -z "$r"    ] && echo checked) onchange="this.form.submit()"/>
    5.44  	<label for="r4">$(_ 'none')</label>
     6.1 --- a/lib/libtazpanel	Mon Jul 30 12:18:05 2018 +0200
     6.2 +++ b/lib/libtazpanel	Tue Feb 26 08:30:05 2019 +0100
     6.3 @@ -14,16 +14,16 @@
     6.4  _n() { local T="$1"; shift; printf "$(gettext "$T")" "$@"; }
     6.5  
     6.6  
     6.7 -[ $(busybox ps | grep '127.0.0.1.*guiuser=root' |grep -v grep| awk {'print $2'}) == 'root' ] && REMOTE_USER='root'
     6.8 +[ $(busybox ps | grep '127.0.0.1.*guiuser=root' |grep -v grep| awk {'print $2'}) = 'root' ] && REMOTE_USER='root'
     6.9  GUI_USER=nobody
    6.10 -[ "${HTTP_HOST/:*/:}" == "127.0.0.1:" ] &&
    6.11 +[ "${HTTP_HOST/:*/:}" = "127.0.0.1:" ] &&
    6.12  for i in "$HTTP_COOKIE" "$QUERY_STRING" ; do
    6.13  	v="$(echo "$i" | sed '/guiuser=/!d;s/.*guiuser=\([A-Za-z0-9_]*\).*/\1/')"
    6.14  	[ "$v" ] || continue
    6.15  	busybox ps | sed '/d;/d;/127\.0\.0\.1:/!d' | grep -q " $v " || continue
    6.16  	GUI_USER="$v"
    6.17  done
    6.18 -[ "$(id -un)" == "${REMOTE_USER:=$GUI_USER}" ] || exec su -s /bin/sh -c "$(realpath $0) $@" $REMOTE_USER
    6.19 +[ "$(id -un)" = "${REMOTE_USER:=$GUI_USER}" ] || exec su -s /bin/sh -c "$(realpath $0) $@" $REMOTE_USER
    6.20  
    6.21  
    6.22  # Get parameters with GET, POST, COOKIE and FILE functions
    6.23 @@ -150,10 +150,10 @@
    6.24  	scan=""
    6.25  	if ifconfig | grep -A1 $1 | grep -q inet; then
    6.26  		ip=$(ifconfig | grep -A1 $1 | grep inet | awk '{ print $2 }' | cut -d: -f2)
    6.27 -		[ "$(cat /sys/class/net/$1/carrier)" == "1" ] &&
    6.28 +		[ "$(cat /sys/class/net/$1/carrier)" = "1" ] &&
    6.29  		scan='<a data-icon="@scan@" href="network.cgi?scan='$ip'&amp;back=network.cgi">'$(_ 'Scan')'</a>'
    6.30  	fi
    6.31 -	[ "$(cat /sys/class/net/$1/carrier)" == "1" ] &&
    6.32 +	[ "$(cat /sys/class/net/$1/carrier)" = "1" ] &&
    6.33  	status="$(_ 'connected')" &&
    6.34  	speed="$(cat /sys/class/net/$1/speed 2> /dev/null)" &&
    6.35  	[ "$speed" ] && status="$status ${speed}M"
    6.36 @@ -387,7 +387,7 @@
    6.37  # Mark select option as checked
    6.38  
    6.39  selected() {
    6.40 -	[ "$1" == "$2" ] && echo -n 'selected'
    6.41 +	[ "$1" = "$2" ] && echo -n 'selected'
    6.42  }
    6.43  
    6.44  
     7.1 --- a/network.cgi	Mon Jul 30 12:18:05 2018 +0200
     7.2 +++ b/network.cgi	Tue Feb 26 08:30:05 2019 +0100
     7.3 @@ -404,7 +404,7 @@
     7.4  				fi
     7.5  
     7.6  				# Check encryption type
     7.7 -				if [ "$ENCRYPTION" == 'on' ]; then
     7.8 +				if [ "$ENCRYPTION" = 'on' ]; then
     7.9  					# "WPA" or "WPA2" or "WPA/WPA2" (maybe also "WPA2/WPA")
    7.10  					ENC_SIMPLE=$(echo "$SCAN" | sed -n '/.*WPA.*/ s|.*\(WPA[^ ]*\).*|\1|p')
    7.11  					ENC_SIMPLE=$(echo $ENC_SIMPLE | sed 's| |/|')
    7.12 @@ -676,7 +676,7 @@
    7.13  		[ $(cat $ip_forward) -eq 1 ] && echo ' checked')/>
    7.14  EOT
    7.15  		_ 'forward packets between interfaces'
    7.16 -		[ "$REMOTE_USER" == 'root' ] && cat <<EOT
    7.17 +		[ "$REMOTE_USER" = 'root' ] && cat <<EOT
    7.18  		<button form="mainform" name="toggleipforward" data-icon="@ok@">$(_ 'Change')</button>
    7.19  EOT
    7.20  		cat <<EOT
    7.21 @@ -725,7 +725,7 @@
    7.22  			[ $(($(cat /sys/class/net/$i/flags) & 0x1080)) -eq 4096 ] &&
    7.23  			echo $i
    7.24  		done)"
    7.25 -		if [ "$REMOTE_USER" == "root" -a -n "$devs" ]; then
    7.26 +		if [ "$REMOTE_USER" = "root" -a -n "$devs" ]; then
    7.27  			cat <<EOT
    7.28  <section>
    7.29  	<header id="vlan">$(_ 'VLAN')</header>
    7.30 @@ -799,7 +799,7 @@
    7.31  <section>
    7.32  	<header id="arp">$(_ 'ARP table')</header>
    7.33  EOT
    7.34 -		if [ "$REMOTE_USER" == "root" ]; then
    7.35 +		if [ "$REMOTE_USER" = "root" ]; then
    7.36  			echo "<table>"
    7.37  			arp -n | while read line ; do
    7.38  				cat <<EOT
    7.39 @@ -837,7 +837,7 @@
    7.40  </section>
    7.41  
    7.42  EOT
    7.43 -		[ "$REMOTE_USER" == "root" -a "$(which iptables-save)" ] && cat <<EOT
    7.44 +		[ "$REMOTE_USER" = "root" -a "$(which iptables-save)" ] && cat <<EOT
    7.45  <section>
    7.46  	<header id="iptables">$(_ 'Firewall')
    7.47  		$(edit_button /etc/knockd.conf "$(_ 'Port knocker')")
     8.1 --- a/settings.cgi	Mon Jul 30 12:18:05 2018 +0200
     8.2 +++ b/settings.cgi	Tue Feb 26 08:30:05 2019 +0100
     8.3 @@ -48,7 +48,7 @@
     8.4  		lxpanel_user="$(ps -o pid,user 2>/dev/null | fgrep "$lxpanel_pid " | awk '{print $2}')"
     8.5  
     8.6  		# ... current user?
     8.7 -		if [ "$USER" == "$lxpanel_user" ]; then
     8.8 +		if [ "$USER" = "$lxpanel_user" ]; then
     8.9  			# custom command?
    8.10  			lxpanel_comm="$(ps -o pid,args 2>/dev/null | grep -e "^\ *$lxpanel_pid " | awk '{$1="";print}')"
    8.11  			[ -z "$lxpanel_comm" ] && lxpanel_comm='lxpanel -p slitaz'
    8.12 @@ -478,7 +478,7 @@
    8.13  		locale_name=$(basename $locale)
    8.14  		locale_title=$(grep -m 1 -e '^	*title' $locale | cut -d'"' -f2)
    8.15  		if [ -n "$locale_title" ]; then
    8.16 -			sel=''; [ "$locale_name" == "$cur_loc" ] && sel='checked="checked"'
    8.17 +			sel=''; [ "$locale_name" = "$cur_loc" ] && sel='checked="checked"'
    8.18  			cat <<EOT
    8.19  				<tr>
    8.20  					<td>
    8.21 @@ -663,7 +663,7 @@
    8.22  			<input type="number" name="day" value="$(date +%d)" min="1" max="31" size="4" required/>
    8.23  			<select name="month" value="$(date +%m)">
    8.24  				$(for i in $(seq 12); do
    8.25 -					sel=''; [ "$i" == "$(date +%-m)" ] && sel=' selected'
    8.26 +					sel=''; [ "$i" = "$(date +%-m)" ] && sel=' selected'
    8.27  					printf "<option value=\"%s\"$sel>%s</option>" $(date -d $i.01-01:01 '+%m %B')
    8.28  				done)
    8.29  			</select>