opkg

statically linked package installer
git clone anongit@rnpnr.xyz:opkg.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

probe-size.sh (380B)


      1 set -e
      2 
      3 if [ "$#" -lt 3 ] ; then
      4 	printf 'usage: %s var out command...\n' "$0" >&2
      5 	exit 2
      6 fi
      7 
      8 var=$1
      9 out=$2
     10 shift 2
     11 for size in 8 4 2 1 ; do
     12 	echo "==> trying $var=$size..." >&2
     13 	if "$@" -D "$var=$size" ; then
     14 		echo '==> success' >&2
     15 		echo "#define $var $size" >"$out"
     16 		exit 0
     17 	fi
     18 done 2>"$out.log"
     19 
     20 cat "$out.log"
     21 printf "%s: could not determine %s\n" "$0" "$var" >&2
     22 exit 1