Update the main sdk file.

This brings in the Dockerfile parsing support along with a libdevuansdk
update.
This commit is contained in:
parazyd 2018-09-18 16:36:54 +02:00
parent 2826c92558
commit 32a3790c34
No known key found for this signature in database
GPG Key ID: F0CB28FCF78637DE
2 changed files with 43 additions and 14 deletions

@ -1 +1 @@
Subproject commit fa3c7ea707e6a740b8a98f4eb671483104e26e88
Subproject commit c922031a0cb2eade8922cf3c2d40dff2b13cd54c

55
sdk
View File

@ -60,24 +60,53 @@ load() {
)
oslib="${os_map[$os]}"
blendlib="${blend_map[$blend]}"
[[ $blendlib =~ '^http' ]] && {
notice "grabbing blend from the internetz"
pushd $R/extra/blends
curl -Ls -O $blendlib
popd
blendlib="$R/extra/blends/$(basename $blendlib)"
}
[[ -f $oslib ]] || { die "no valid distro specified"; exit 1 }
[[ -f $blendlib ]] || { act "no valid blend specified" }
source $oslib
blendlib="${blend_map[$blend]}"
if [[ -z "$blendlib" ]]; then
if [[ "$blend" =~ '^http' ]]; then
notice "grabbing blend from the internetz"
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
[[ -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"
parsedfile="$($LIBPATH/extra/dockerfile_parse.py "$blend")"
[[ $? = 0 ]] || { die "Could not parse the Dockerfile" ; exit 1}
cat > "$R/$(basename ${blend}).blend" << __EOF__
#!/usr/bin/env zsh
# Parsed with dockerfile_parse.py
#
blend_postinst() {
fn blend_postinst
req=(strapdir blend)
ckreq || return 1
notice "executing blend postinst"
cat << ___EOF___ | sudo tee \$strapdir/blendpostinst >/dev/null
${parsedfile}
___EOF___
chroot-script -d blendpostinst || zerr
}
__EOF__
blendlib="$R/$(basename ${blend}).blend"
fi
fi
fi
[[ -f $blendlib ]] || { act "no blend specified" }
[[ -f $blendlib ]] && {
source $blendlib || zerr
act "$os blend loaded"
act "$(basename $blend) blend loaded"
export BLEND=1
}