113 lines
3.0 KiB
Bash
Executable File
113 lines
3.0 KiB
Bash
Executable File
#!/usr/bin/env zsh
|
|
#
|
|
# Copyright (c) 2016 Dyne.org Foundation
|
|
# libdevuansdk is written and maintained by
|
|
# Jaromil <jaromil@dyne.org>
|
|
# KatolaZ <katolaz@freaknet.org>
|
|
# parazyd <parazyd@dyne.org>
|
|
#
|
|
# This file is part of libdevuansdk
|
|
#
|
|
# 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/>.
|
|
|
|
fn libdevuansdk.init
|
|
libdevuansdk_version=0.1
|
|
notice "Initializing Devuan SDK library v$libdevuansdk_version"
|
|
|
|
vars+=(SDK_PREFIX SDK_HOME SDK_CONF SDK_LIB SDK_ARM SDK_VM SDK_LIVE)
|
|
vars+=(libdevuansdk_version os release version mirror section arch)
|
|
|
|
# defaults if less sofisticated dir
|
|
SDK_HOME=${SDK_HOME:-$SDK_PREFIX}
|
|
SDK_CONF=${SDK_CONF:-$SDK_PREFIX}
|
|
|
|
# default operational paths
|
|
vars+=(R H E)
|
|
R=${R:-$SDK_PREFIX}
|
|
H=${H:-$SDK_HOME}
|
|
E=${E:-$SDK_CONF}
|
|
|
|
req=(os release version mirror section R H E)
|
|
freq=($SDK_LIB/zuper/zuper.init)
|
|
ckreq || { error "configuration is missing"; zshexit; return 1 }
|
|
|
|
# name of target by default, omits arch
|
|
vars+=(name_default)
|
|
name_default=${os}_${release}_${version}
|
|
# For gettext
|
|
TEXTDOMAIN=devuan
|
|
|
|
# setting core, base, and other packages
|
|
|
|
[[ "$core_packages" = "" ]] && {
|
|
# core packages for the system
|
|
arrs+=(core_packages)
|
|
core_packages=(devuan-keyring debian-keyring)
|
|
core_packages+=(initramfs-tools binutils ca-certificates curl)
|
|
core_packages+=(console-common less nano vim)
|
|
}
|
|
[[ "$base_packages" = "" ]] && {
|
|
# base packages for the system
|
|
arrs+=(base_packages)
|
|
base_packages=(bzip2 dialog apt-utils fakeroot e2fsprogs parted)
|
|
}
|
|
[[ "$system_packages" = "" ]] && {
|
|
# other system packages
|
|
arrs+=(system_packages)
|
|
system_packages=(sysvinit ssh)
|
|
}
|
|
|
|
# default size for an img
|
|
vars+=(imgsize)
|
|
imgsize=${imgsize:-1337M}
|
|
|
|
|
|
## libdevuansdk-specific settings
|
|
vars+=(workdir strapdir outdir)
|
|
outdir=${outdir:-$H/builds}
|
|
workdir=${workdir:-$H/workdir}
|
|
strapdir="${workdir}/${name_default}_${arch}"
|
|
|
|
# conclude initialization
|
|
|
|
DEBUG=${DEBUG:-0}
|
|
QUIET=${QUIET:-0}
|
|
LOG=${LOG:-""}
|
|
|
|
# config globals
|
|
|
|
# source $R/zlibs/library
|
|
source $SDK_LIB/zlibs/bootstrap
|
|
source $SDK_LIB/zlibs/helpers
|
|
# source $R/zlibs/imaging
|
|
source $SDK_LIB/zlibs/isolinux
|
|
source $SDK_LIB/zlibs/kernel
|
|
source $SDK_LIB/zlibs/qemu
|
|
source $SDK_LIB/zlibs/grub
|
|
source $SDK_LIB/zlibs/sysconf
|
|
|
|
source $SDK_LIB/zlibs/blends
|
|
source $SDK_LIB/zlibs/packages
|
|
|
|
# create mandatory workdirs
|
|
# $strapdir
|
|
mkdir -p ${strapdir}
|
|
# $outdir
|
|
mkdir -p ${outdir}
|
|
|
|
# conclude initialization
|
|
source $SDK_LIB/zuper/zuper.init
|
|
|
|
act "library succesfully loaded"
|