Merge pull request #23 from sargon/autoupdate-enforce
gluon-autoupdater: Always allow forced autoupdate.
This commit is contained in:
		
						commit
						45189d1066
					
				| @ -1,15 +1,15 @@ | |||||||
| #!/bin/sh | #!/bin/sh | ||||||
| 
 | 
 | ||||||
| if test $(uci get autoupdater.settings.enabled) != 1; then |  | ||||||
|   echo "autoupdater is disabled" |  | ||||||
|   exit 0 |  | ||||||
| fi |  | ||||||
| 
 | 
 | ||||||
| BRANCH=$(uci get autoupdater.settings.branch) | BRANCH=$(uci get autoupdater.settings.branch) | ||||||
| 
 | 
 | ||||||
| PROBABILITY=$(uci get autoupdater.${BRANCH}.probability) | PROBABILITY=$(uci get autoupdater.${BRANCH}.probability) | ||||||
| 
 | 
 | ||||||
| if test "a$1" != "a-f"; then | if test "a$1" != "a-f"; then | ||||||
|  |   if test $(uci get autoupdater.settings.enabled) != 1; then | ||||||
|  |     echo "autoupdater is disabled" | ||||||
|  |     exit 0 | ||||||
|  |   fi | ||||||
|   # get one random byte from /dev/urandom, convert it to decimal and check |   # get one random byte from /dev/urandom, convert it to decimal and check | ||||||
|   # against update_probability*255 |   # against update_probability*255 | ||||||
|   hexdump -n1 -e '/1 "%d"' /dev/urandom | awk "{exit \$1 > $PROBABILITY * 255}" |   hexdump -n1 -e '/1 "%d"' /dev/urandom | awk "{exit \$1 > $PROBABILITY * 255}" | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user