delphinium-sdk/sdk
2022-12-05 23:06:38 -03:00

92 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env zsh
# shellcheck shell=bash
# Copyright (c) 2016-2021 Ivan J. <parazyd@dyne.org>
# live-sdk is written and maintained by Ivan J. <parazyd@dyne.org>
#
# 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)
ckreq || return 1
os_map=(
"delphinium" "$R/lib/libdevuansdk/libdevuansdk"
)
blend_map=(
"delphinium-desktop-live" "$R/blends/devuan-desktop-live/devuan-desktop-live.blend"
"delphinium-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%} "