vm-sdk

simple distro kit (vm edition)
git clone git://parazyd.org/vm-sdk.git
Log | Files | Refs | Submodules | README | LICENSE

commit 32a3790c341f186f331df451102a7e2af86b1eef
parent 2826c9255813b56a0f7cb0b43d4dca5fd6914ef3
Author: parazyd <parazyd@dyne.org>
Date:   Tue, 18 Sep 2018 16:36:54 +0200

Update the main sdk file.

This brings in the Dockerfile parsing support along with a libdevuansdk
update.

Diffstat:
Msdk | 51++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 40 insertions(+), 11 deletions(-)

diff --git a/sdk b/sdk @@ -60,24 +60,53 @@ load() { ) oslib="${os_map[$os]}" + [[ -f $oslib ]] || { die "no valid distro specified"; exit 1 } + source $oslib + 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)" - } + 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 - [[ -f $oslib ]] || { die "no valid distro specified"; exit 1 } - [[ -f $blendlib ]] || { act "no valid blend specified" } + notice "executing blend postinst" + cat << ___EOF___ | sudo tee \$strapdir/blendpostinst >/dev/null +${parsedfile} +___EOF___ - source $oslib + 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 }