mirror of https://github.com/parazyd/vm-sdk.git
96 lines
2.1 KiB
Bash
Executable File
96 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env zsh
|
|
# Copyright (c) 2016-2017 Dyne.org Foundation
|
|
# vm-sdk is written and maintained by Ivan J. <parazyd@dyne.org>
|
|
#
|
|
# This file is part of vm-sdk
|
|
#
|
|
# This source code is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This software is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this source code. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
vmsdk_version="0.2"
|
|
|
|
R=${VM_SDK:-$PWD}
|
|
|
|
DEBUG=0
|
|
QUIET=0
|
|
|
|
source $R/lib/zuper/zuper
|
|
|
|
## global vars
|
|
vars+=(vmsdk_version)
|
|
vars+=(R workdir strapdir)
|
|
vars+=(os oslib blendlib)
|
|
vars+=(MAKEOPTS)
|
|
|
|
## global arrs
|
|
arrs+=(extra_packages)
|
|
|
|
## global maps
|
|
maps+=(board_map os_map blend_map)
|
|
|
|
source $R/config
|
|
|
|
## conclude zuper initialization
|
|
source $R/lib/zuper/zuper.init
|
|
|
|
load() {
|
|
fn load "$@"
|
|
os="$1"
|
|
blend="$2"
|
|
req=(os)
|
|
ckreq || return 1
|
|
|
|
os_map=(
|
|
"devuan" "$R/lib/libdevuansdk/libdevuansdk"
|
|
)
|
|
|
|
blend_map=(
|
|
"decode" "$R/../decode.blend"
|
|
)
|
|
|
|
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 ]] || { warn "no valid blend specified" }
|
|
|
|
source $oslib
|
|
[[ -f $blendlib ]] && {
|
|
source $blendlib || zerr
|
|
act "$os blend loaded"
|
|
export BLEND=1
|
|
}
|
|
|
|
workdir="$R/tmp/${os}-${arch}-build"
|
|
strapdir="$workdir/bootstrap"
|
|
mkdir -p $strapdir
|
|
|
|
export LANG=C
|
|
export LC_ALL=C
|
|
|
|
source $R/lib/zuper/zuper.init
|
|
}
|
|
|
|
TRAPZERR() { zerr; return $? }
|
|
|
|
notice "vm-sdk loaded"
|
|
export PROMPT="%F{yellow}%(?..%? )%{$reset_color%}vmsdk@%{$fg[red]%}%m %{$reset_color%}%3c %#"
|