cookutils rev 1113

modules/postcheck: fix displaying the problems
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Dec 05 17:04:10 2018 +0200 (2018-12-05)
parents 21a779d6f238
children e027dbdf061e
files lighttpd/cooker.css lighttpd/index.cgi modules/postcheck
line diff
     1.1 --- a/lighttpd/cooker.css	Mon Dec 03 13:15:17 2018 +0200
     1.2 +++ b/lighttpd/cooker.css	Wed Dec 05 17:04:10 2018 +0200
     1.3 @@ -394,6 +394,18 @@
     1.4  	padding: 0 0.8rem 0 0;
     1.5  	vertical-align: middle;
     1.6  }
     1.7 +
     1.8 +.badge::before {
     1.9 +	height: 16px;
    1.10 +	display: inline-block;
    1.11 +	padding: 0;
    1.12 +}
    1.13 +.button.badge {
    1.14 +	height: 16px;
    1.15 +	padding: 1px;
    1.16 +	margin: unset;
    1.17 +}
    1.18 +
    1.19  .badge.bdbroken::before {
    1.20  	content: url("data:image/svg+xml,<svg height='16' width='16' xmlns='http://www.w3.org/2000/svg'><circle cx='8' cy='8' fill='%23bcc' r='7.5' stroke='%23000'/><path d='m6 4-2 1v1l2-1zm4 0v1l2 1v-1zm-4 2v1h1v-1zm3 0v1h1v-1zm-2.5 4-2 2h1.5l1-1h2l1 1h1.5l-2-2z'/></svg>");
    1.21  }
     2.1 --- a/lighttpd/index.cgi	Mon Dec 03 13:15:17 2018 +0200
     2.2 +++ b/lighttpd/index.cgi	Wed Dec 05 17:04:10 2018 +0200
     2.3 @@ -1060,7 +1060,7 @@
     2.4  			list)
     2.5  				p=$(echo $p | sed 's|<a [^>]*>\([^<]*\)</a>|\1|g')
     2.6  				s=$(echo $s | sed 's|<a [^>]*>\([^<]*\)</a>|\1|g|')
     2.7 -				echo "<tr><td><a href=\"$badge\"><span class=\"badge $badge\" title=\"$t\"/></a></td><td>$p</td></tr>"
     2.8 +				echo "<tr><td><a href=\"$badge\" class=\"button badge $badge\" title=\"$t\"></a></td><td>$p</td></tr>"
     2.9  				;;
    2.10  			*)
    2.11  				echo -n "<span class=\"badge $badge\" title=\"$t\"/>"
    2.12 @@ -1357,9 +1357,9 @@
    2.13  						$(toolchain_version glibc)
    2.14  					</table>
    2.15  
    2.16 -					<p>Toolchain documentation: <a target="_blank" rel="noopener noreferrer"
    2.17 -					href="http://doc.slitaz.org/en:cookbook:toolchain">http://doc.slitaz.org/en:cookbook:toolchain</a>
    2.18 -					</p>
    2.19 +					<div id="info">
    2.20 +						<a class="button icon doc" target="_blank" rel="noopener noreferrer" href="http://doc.slitaz.org/en:cookbook:toolchain">Toolchain documentation</a>
    2.21 +					</div>
    2.22  
    2.23  					</section>
    2.24  					</div>
     3.1 --- a/modules/postcheck	Mon Dec 03 13:15:17 2018 +0200
     3.2 +++ b/modules/postcheck	Wed Dec 05 17:04:10 2018 +0200
     3.3 @@ -163,6 +163,7 @@
     3.4  
     3.5  		IFS=$'\n'
     3.6  		bad_own="$(find $install -type f \( ! -user 0 -a ! -group 0 \))"
     3.7 +		list=$(mktemp)
     3.8  		if [ -n "$bad_own" ]; then
     3.9  			if [ -e $overrides_exp ]; then
    3.10  				# There may be mix of overridden and not-overridden ownership
    3.11 @@ -175,25 +176,33 @@
    3.12  						add 'ownover'
    3.13  					else
    3.14  						add 'own'
    3.15 -						list="$list$(printf "\n  %s:%s %s" "$(stat -c %u:%g "$i")" "${i#$install}")"
    3.16 +						printf "  %s:%s %s\n" "$(stat -c %u:%g "$i")" "${i#$install}" >>$list
    3.17  						result='bad'
    3.18  					fi
    3.19  				done
    3.20  				[ "$result" == '' ] # OK, all was overridden
    3.21  			else
    3.22 +				for i in $bad_own; do
    3.23 +					printf "  %s:%s %s\n" "$(stat -c %u:%g "$i")" "${i#$install}" >>$list
    3.24 +				done
    3.25  				add 'own'
    3.26  			fi
    3.27  		fi
    3.28  		status
    3.29  		unset IFS
    3.30 -		[ -n "$list" ] && echo -e "  Problems found:$list"
    3.31 +		if [ -s "$list" ]; then
    3.32 +			echo "  Problems found:"
    3.33 +			sort -k2 $list
    3.34 +		fi
    3.35 +		rm $list
    3.36  
    3.37  
    3.38  		action "Checking permissions in ${install#$WOK/$1/}..."
    3.39  
    3.40 +		IFS=$'\n'
    3.41  		bad_files="$(find $install -type f \( ! -perm 644 -a ! -perm 755 \))"
    3.42  		bad_dirs="$(find $install -type d ! -perm 755)"
    3.43 -		list=''
    3.44 +		list=$(mktemp)
    3.45  		if [ -n "$bad_files$bad_dirs" ]; then
    3.46  			if [ -e $overrides_exp ]; then
    3.47  				# There may be mix of overridden and not-overridden permissions
    3.48 @@ -205,7 +214,7 @@
    3.49  						add 'permover'
    3.50  					else
    3.51  						add 'perm'
    3.52 -						list="$list$(printf "\n  %04d %s" "$(stat -c %a "$i")" "${i#$install}")"
    3.53 +						printf "  %04d %s\n" "$(stat -c %a "$i")" "${i#$install}" >>$list
    3.54  						result='bad'
    3.55  					fi
    3.56  				done
    3.57 @@ -214,24 +223,47 @@
    3.58  						add 'permover'
    3.59  					else
    3.60  						add 'perm'
    3.61 -						list="$list$(printf "\n  %04d %s" "$(stat -c %a "$i")" "${i#$install}/")"
    3.62 +						printf "  %04d %s\n" "$(stat -c %a "$i")" "${i#$install}/" >>$list
    3.63  						result='bad'
    3.64  					fi
    3.65  				done
    3.66  				[ "$result" == '' ] # OK, all was overridden
    3.67  			else
    3.68 +				for i in $bad_files; do
    3.69 +					printf "  %04d %s\n" "$(stat -c %a "$i")" "${i#$install}" >>$list
    3.70 +				done
    3.71 +				for i in $bad_dirs; do
    3.72 +					printf "  %04d %s\n" "$(stat -c %a "$i")" "${i#$install}/" >>$list
    3.73 +				done
    3.74  				add 'perm'
    3.75  			fi
    3.76  		fi
    3.77  		status
    3.78 -		[ -n "$list" ] && echo -e "  Problems found:$list"
    3.79 +		unset IFS
    3.80 +		if [ -s "$list" ]; then
    3.81 +			echo "  Problems found:"
    3.82 +			sort -k2 $list
    3.83 +		fi
    3.84 +		rm $list
    3.85  
    3.86  		action "Checking broken symlinks in ${install#$WOK/$1/}..."
    3.87 -		bad_sl=$(find $install -type l ! -exec test -e '{}' \; -print)
    3.88 +
    3.89 +		IFS=$'\n'
    3.90 +		bad_sl="$(find $install -type l ! -exec test -e '{}' \; -print)"
    3.91 +		result=''
    3.92  		if [ -n "$bad_sl" ]; then
    3.93  			add 'symlink'
    3.94 +			result='bad'
    3.95  		fi
    3.96 -		status
    3.97 +		[ "$result" == '' ]; status
    3.98 +
    3.99 +		if [ "$result" == 'bad' ]; then
   3.100 +			echo "  Problems found:"
   3.101 +			for i in $bad_sl; do
   3.102 +				stat -c '  %N'
   3.103 +			done
   3.104 +		fi
   3.105 +		unset IFS
   3.106  	done
   3.107  
   3.108  	if [ "$REPOLOGY" != '-' ]; then