-
Notifications
You must be signed in to change notification settings - Fork 5
/
sdk
executable file
·89 lines (69 loc) · 2.02 KB
/
sdk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env zsh
# shellcheck shell=bash
# Copyright (c) 2016-2021 Ivan J. <[email protected]>
# 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="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 %# "