#!/usr/bin/env zsh # shellcheck shell=bash # Copyright (c) 2016-2021 Ivan J. # 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 . vmsdk_version="1.0" 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" "maemo" "$R/../maemo.blend" "cobox" "$R/../cobox.blend" "sdkvm" "$R/../sdkvm.blend" ) oslib="${os_map[$os]}" [[ -f "$oslib" ]] || { die "No valid distro specified"; return 1; } source "$oslib" blendlib="${blend_map[$blend]}" [[ -f "$blendlib" ]] || act "No blend specified" [[ -f "$blendlib" ]] && { source "$blendlib" || { zerr; return 1; } act "$(basename "$blend") 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 $vmsdk_version loaded" export PROMPT="%F{yellow}%(?..%? )%{$reset_color%}vmsdk@%{$fg[red]%}%m %{$reset_color%}%3c %# "