added function sdk_init in libdevuansdk

This commit is contained in:
KatolaZ 2016-06-14 05:28:49 +01:00
parent fb9cb40d33
commit d1a3995bff
1 changed files with 84 additions and 76 deletions

View File

@ -28,99 +28,107 @@ setopt pushdsilent
SDK_LIB=${SDK_LIB:-`pwd`} SDK_LIB=${SDK_LIB:-`pwd`}
[[ "$core_packages" = "" ]] && { sdk_init(){
fn sdk_init
req=(os release version mirror section)
ckreq || { error "configuration is missing"; zshexit; return 1 }
# setting core, base, and other packages
[[ "$core_packages" = "" ]] && {
# core packages for the system # core packages for the system
core_packages=(devuan-keyring debian-keyring) core_packages=(devuan-keyring debian-keyring)
core_packages+=(initramfs-tools binutils ca-certificates curl) core_packages+=(initramfs-tools binutils ca-certificates curl)
core_packages+=(console-common less nano vim) core_packages+=(console-common less nano vim)
} }
[[ "$base_packages" = "" ]] && { [[ "$base_packages" = "" ]] && {
# base packages for the system # base packages for the system
base_packages=(bzip2 dialog apt-utils fakeroot e2fsprogs parted) base_packages=(bzip2 dialog apt-utils fakeroot e2fsprogs parted)
} }
[[ "$system_packages" = "" ]] && { [[ "$system_packages" = "" ]] && {
# other system packages # other system packages
system_packages=(sysvinit ssh) system_packages=(sysvinit ssh)
} }
# default size for an img # default size for an img
imgsize=${imgsize:-1337} imgsize=${imgsize:-1337M}
## libdevuansdk-specific settings ## libdevuansdk-specific settings
workdir="$H/workdir" workdir="$H/workdir"
strapdir="${workdir}/${os}-${release}-${version}" strapdir="${workdir}/${os}-${release}-${version}"
outdir="$H/builds" outdir="$H/builds"
# KatolaZ says: wtf????
[[ -r $SDK_LIB/libdevuansdk ]] || { [[ -r $SDK_LIB/libdevuansdk ]] || {
print "Devuan SDK is not installed in: $SDK_LIB" print "Devuan SDK is not installed in: $SDK_LIB"
print "export SDK_LIB if installed on a different path" print "export SDK_LIB if installed on a different path"
} }
######################## ########################
## Load Zuper extensions ## Load Zuper extensions
# conclude initialization # conclude initialization
if [[ -r $SDK_LIB/zuper/zuper ]]; then if [[ -r $SDK_LIB/zuper/zuper ]]; then
source $SDK_LIB/zuper/zuper source $SDK_LIB/zuper/zuper
else source ./zuper/zuper; fi else source ./zuper/zuper; fi
DEBUG=${DEBUG:-0} DEBUG=${DEBUG:-0}
QUIET=${QUIET:-0} QUIET=${QUIET:-0}
LOG=${LOG:-""} LOG=${LOG:-""}
# path and debugging # path and debugging
vars+=(R H E) vars+=(R H E)
vars+=(SDK_LIB SDK_PREFIX SDK_CONF SDK_HOME) vars+=(SDK_LIB SDK_PREFIX SDK_CONF SDK_HOME)
# config globals # config globals
vars+=(os release version mirror section) vars+=(os release version mirror section)
vars+=(workdir strapdir) vars+=(workdir strapdir)
vars+=(imgsize) vars+=(imgsize)
# source $R/zlibs/library # source $R/zlibs/library
source $SDK_LIB/zlibs/bootstrap source $SDK_LIB/zlibs/bootstrap
source $SDK_LIB/zlibs/helpers source $SDK_LIB/zlibs/helpers
# source $R/zlibs/imaging # source $R/zlibs/imaging
source $SDK_LIB/zlibs/isolinux source $SDK_LIB/zlibs/isolinux
source $SDK_LIB/zlibs/kernel source $SDK_LIB/zlibs/kernel
source $SDK_LIB/zlibs/qemu source $SDK_LIB/zlibs/qemu
source $SDK_LIB/zlibs/grub source $SDK_LIB/zlibs/grub
source $SDK_LIB/zlibs/sysconf source $SDK_LIB/zlibs/sysconf
# name of target by default, omits arch # name of target by default, omits arch
vars+=(name_default) vars+=(name_default)
name_default=${os}_${release}_${version} name_default=${os}_${release}_${version}
# conclude initialization # conclude initialization
if [[ -r $SDK_LIB/zuper/zuper.init ]]; then if [[ -r $SDK_LIB/zuper/zuper.init ]]; then
source $SDK_LIB/zuper/zuper.init source $SDK_LIB/zuper/zuper.init
else source ./zuper/zuper.init; fi else source ./zuper/zuper.init; fi
# add all other binaries to the path # add all other binaries to the path
path+=($SDK_LIB/bin) path+=($SDK_LIB/bin)
rehash rehash
# For gettext # For gettext
TEXTDOMAIN=devuan TEXTDOMAIN=devuan
# create mandatory workdirs # create mandatory workdirs
mkdir -p ${strapdir} mkdir -p ${strapdir}
notice "Loading Devuan SDK library v$devuan_sdk_version" notice "Loading Devuan SDK library v$devuan_sdk_version"
# ... # ...
req=(os release version mirror section) act "library succesfully loaded"
ckreq || { error "configuration is missing"; zshexit; return 1 }
act "library succesfully loaded"
# default operational paths # default operational paths
R=${R:-$SDK_PREFIX} R=${R:-$SDK_PREFIX}
H=${H:-$SDK_HOME} H=${H:-$SDK_HOME}
E=${E:-$SDK_CONF} E=${E:-$SDK_CONF}
} # Closes sdk_init