mirror of https://github.com/parazyd/vm-sdk.git
Update the main sdk file.
This brings in the Dockerfile parsing support along with a libdevuansdk update.
This commit is contained in:
parent
2826c92558
commit
32a3790c34
|
|
@ -1 +1 @@
|
||||||
Subproject commit fa3c7ea707e6a740b8a98f4eb671483104e26e88
|
Subproject commit c922031a0cb2eade8922cf3c2d40dff2b13cd54c
|
||||||
55
sdk
55
sdk
|
|
@ -60,24 +60,53 @@ load() {
|
||||||
)
|
)
|
||||||
|
|
||||||
oslib="${os_map[$os]}"
|
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 $oslib ]] || { die "no valid distro specified"; exit 1 }
|
||||||
[[ -f $blendlib ]] || { act "no valid blend specified" }
|
|
||||||
|
|
||||||
source $oslib
|
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 ]] && {
|
[[ -f $blendlib ]] && {
|
||||||
source $blendlib || zerr
|
source $blendlib || zerr
|
||||||
act "$os blend loaded"
|
act "$(basename $blend) blend loaded"
|
||||||
export BLEND=1
|
export BLEND=1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue