diff --git a/build_falter b/build_falter index c7aff77..a91f510 100755 --- a/build_falter +++ b/build_falter @@ -4,16 +4,27 @@ # memory of a single 4MB-Device exceeds. # set -e +REALPATH_SCRIPT=$(realpath "$0") +BUILTER_DIR=$(dirname "$REALPATH_SCRIPT") + RELEASE_LINK_BASE="https://downloads.openwrt.org/releases/" -RELEASES=" - https://downloads.openwrt.org/releases/19.07.5/targets/ - https://downloads.openwrt.org/releases/19.07.6/targets/ - https://downloads.openwrt.org/releases/21.02-SNAPSHOT/targets/ - https://downloads.openwrt.org/snapshots/targets/" # General variables FALTER_REPO_BASE="src/gz openwrt_falter https://firmware.berlin.freifunk.net/feed/" FREIFUNK_RELEASE="" +OPENWRT_TOH="https://openwrt.org/_media/toh_dump_tab_separated.gz" + +# list of packages, that get omitted on 8 MiB devices +OMIT_LIST_8MiB=" + mtr + iperf3 + tmux + vnstat + " +# list of devices, that have technically 16 MiB flash, but have two partitions a 8 MiB +OVERRIDE_TO_8MiB=" + ubnt_unifiac-mesh +" ################## # CMD-PARSER # @@ -220,20 +231,51 @@ done # repository derives directly from the falter-version. Download freifunk_release # file and determine openwrt-version by its variables -BASE_URL=$(echo $FALTER_REPO_BASE | cut -d' ' -f 3) +BASE_URL=$(echo "$FALTER_REPO_BASE" | cut -d' ' -f 3) FEEDURL="$BASE_URL$PARSER_FALTER_VERSION/packages/mips_24kc/falter/" if ! curl --silent --fail "$FEEDURL" >/dev/null; then echo "Error: failed retrieving feed URL. Wrong version '$PARSER_FALTER_VERSION'?" exit 2 fi -COMMONFILEURL=$FEEDURL$(curl -s ${FEEDURL}/Packages | sed -n '/falter-common$/,/^$/p' | awk '{if(/Filename: /) print $2}') -TMP=$(curl -s $COMMONFILEURL | tar xzOf - ./data.tar.gz | tar xzOf - ./etc/freifunk_release) -eval $TMP + +COMMONFILEURL=$FEEDURL$(curl -s "${FEEDURL}"/Packages | sed -n '/falter-common$/,/^$/p' | awk '{if(/Filename: /) print $2}') +TMP=$(curl -s "$COMMONFILEURL" | tar xzOf - ./data.tar.gz | tar xzOf - ./etc/freifunk_release) +eval "$TMP" ################# # FUNCTIONS # ################# +function build_router_db { + # load the table-of-hardware from openwrt project, to get further information on router, + # like i.e. flash-size + wget "$OPENWRT_TOH" -O "$BUILTER_DIR/build/toh.gz" + gunzip "$BUILTER_DIR/build/toh.gz" + echo -e '.separator "\t"\n.import '"$BUILTER_DIR/build/toh"' toh' | sqlite3 "$BUILTER_DIR/build/toh.db" +} + +function request_router_from_db { + local board="$1" + local response + + response=$(sqlite3 -batch "$BUILTER_DIR/build/toh.db" <