#!/bin/bash SCRIPT="$(readlink -f $0)" PARENT="$(dirname ${SCRIPT%/*})" TOOL_CONF=tools/kconfig/conf single() { local OID REV SER NNV JUIS="$*" # echo -e "\nJuis: $JUIS" >&2 OID="$(echo '00040E 00150C 001A4F 001C4A 001F3F 0024FE 0896D7 246511 2C3AFD 2C91AB 3431C4 3481C4 3810D5 3CA62F 444E6D 5C4979 74427F 7CFF4D 989BCB 9CC7A6 BC0500 BC0543 C02506 C80E14 CCCE1E DC396F E0286D E8DF70 F0B014' | sed 's/ /\n/g' | shuf -n1)" while [ "${#REV}" != "3" ]; do REV="$(echo $(( RANDOM % 10 ))$(( RANDOM % 10 ))$(( RANDOM % 10 )) | sed 's/[^0-9]//')"; done while [ "${#SER}" != "7" ]; do SER="$(hexdump -n3 -e '/1 "%02X"' /dev/urandom | sed 's/[^0-9A-F]//') "; done NNC="$(dd if=/dev/urandom bs=16 count=1 2>/dev/null | base64 | sed 's/\//\\\//g')" JUIS="$(echo "$JUIS" | sed "s/%REV%/$REV/;s/%OID%/$OID/;s/%SER%/$SER/;s/%NNC%/$NNC/;s/\!/\\\!/g")" [ "$f" != "f" -a "$m" == "m" ] && echo -ne "\nJUIS: $JUIS\n" >&2 # echo "env - tools/yf/juis/juis_check --debug -i $JUIS" && return # env - tools/yf/juis/juis_check --debug -i $JUIS >&2 [ "$f" != "f" ] && env - tools/yf/juis/juis_check -i $JUIS 2>&1 | sed -n 's/^URL=//p' [ "$f" == "f" ] && nohup env - tools/yf/juis/juis_check -i $JUIS 2>&1 | grep -vE "^DelayDownload|Found newer version" & # [ "$f" == "f" ] && nohup env - tools/yf/juis/juis_check -i $JUIS 2>/dev/null & } miniconfig() { local i for i in "$@"; do echo "$i=y"; done cat << EOF FREETZ_USER_LEVEL_DEVELOPER=y FREETZ_SERIES_ALL=y FREETZ_TYPE_FIRMWARE_DETECT_LATEST=y EOF } juisstring() { ( miniconfig "$@" > $PARENT/.config $PARENT/$TOOL_CONF --olddefconfig $PARENT/config/Config.in >/dev/null grep -q '^FREETZ_TYPE_FIRMWARE_DETECT_LATEST=y$' $PARENT/.config || return env - . $PARENT/.config single "$FREETZ_DL_JUIS_STRING" # echo " >> $@" >&2 ) } multi() { make $TOOL_CONF >/dev/null [ ! -x $PARENT/tools/yf/juis/juis_check ] && make yf-juis-host for device in $(grep 'prompt "Hardware type"' $PARENT/config/ui/firmware.in -A999 | grep '^endchoice' -m1 -B999 | sed -rn 's/.*config //p' | tac); do juisstring $device grep -Eq '^FREETZ_TYPE_FIRMWARE_(LABOR|INHAUS)=y$' $PARENT/.config && continue for nonfinal in $(sed -rn 's/^(FREETZ_AVM_HAS_FIRMWARE_[0-9_X]*_(LABOR|INHAUS))=y$/\1/p' $PARENT/.config); do juisstring $device ${nonfinal/AVM_HAS/TYPE} done done [ "$f" == "f" ] && sleep 9 echo } if [ "$#" != "0" ]; then [ "$1" == "m" ] && m=m && shift [ "$1" == "f" ] && m=m && f=f && shift [ "$#" == "0" ] && multi || single "$*" fi exit 0