Allow downloading other files with the blend param.

This commit is contained in:
parazyd 2018-09-18 15:56:56 +02:00
parent 9455ee1b94
commit 7099be9155
No known key found for this signature in database
GPG Key ID: F0CB28FCF78637DE
1 changed files with 18 additions and 15 deletions

13
sdk
View File

@ -88,7 +88,6 @@ load() {
)
blend_map=(
"dowse" "https://github.com/dyne/dowse/raw/master/ops/dowse.blend"
"decode" "../decode.blend"
"maemo" "../maemo.blend"
)
@ -103,14 +102,17 @@ load() {
blendlib="${blend_map[$blend]}"
if [[ "$blendlib" =~ '^http' ]]; then
if [[ -z "$blendlib" ]]; then
if [[ "$blend" =~ '^http' ]]; then
notice "grabbing blend from the internetz"
wget -O "$R/extra/blends/$(basename $blendlib)" "$blendlib"
blendlib="$R/extra/blends/$(basename $blendlib)"
dlpath="$R/extra/blends/$(basename $blend)"
wget -O "$dlpath" "$blend"
sed 1q "$dlpath" | grep -q '^#!/usr/bin/env zsh' && blendlib="$dlpath"
fi
if [[ -z "$blendlib" ]]; then
notice "trying to parse an unknown blend"
[[ -n "$dlpath" ]] && blend="$dlpath"
act "trying to parse an unknown blend"
# Check if it's a Dockerfile
if grep -qi '^FROM ' "$blend"; then
act "The blend is a Dockerfile"
@ -136,6 +138,7 @@ __EOF__
blendlib="$R/$(basename ${blend}).blend"
fi
fi
fi
[[ -f $blendlib ]] || { act "no blend specified" }
source $boardlib && act "$device_name build script loaded"