forked from parazyd/live-sdk
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sdk
executable file
·91 lines (70 loc) · 2.28 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
90
91
#!/usr/bin/env zsh
# shellcheck shell=bash
# Copyright (c) 2016-2021 Ivan J. <[email protected]>
# live-sdk is written and maintained by Ivan J. <[email protected]>
#
# This file is part of live-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/>.
livesdk_version="1.0"
R="${LIVE_SDK-$PWD}"
source "$R/lib/zuper/zuper"
# Global vars
vars+=(livesdk_version)
vars+=(R workdir strapdir)
vars+=(os oslib blendlib)
vars+=(release)
# Global arrs
arrs+=(extra_packages)
# Global maps
maps+=(os_map blend_map)
source "$R/config"
# Conclude zuper initialization
source "$R/lib/zuper/zuper.init"
load() {
fn load "$@"
os="$1"
blend="$2"
[[ $# -gt 2 ]] && release="$3"
req=(os arch)
ckreq || return 1
os_map=(
"devuan" "$R/lib/libdevuansdk/libdevuansdk"
)
blend_map=(
"devuan-desktop-live" "$R/blends/devuan-desktop-live/devuan-desktop-live.blend"
"devuan-minimal-live" "$R/blends/devuan-minimal-live/devuan-minimal-live.blend"
"heads" "$R/../heads.blend"
"decode" "$R/../decode.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 "live-sdk $livesdk_version loaded"
export PROMPT="%F{yellow}%(?..%? )%{$reset_color%}livesdk@%{$fg[red]%}%m %{$reset_color%} %{$fg[blue]%}%#%{$fg_bold[blue]%}%{$reset_color%} "