
efi=
fdisk -l 2>&1 | grep -q 'BIOS boot' && efi="-efi"

imgfile=$(wget -O- https://downloads.x-wrt.com/rom/Downloads/inst_x86.txt --no-check-certificate | grep x86 | grep -o "x-wrt-2.*combined${efi}.img.gz" | cut -d\" -f1)
test -n "$imgfile" && {
	wget -O /tmp/xx.img.gz https://downloads.x-wrt.com/rom/Downloads/$imgfile --no-check-certificate && \
		sysupgrade /tmp/xx.img.gz
}
