minimal blend management and stub for package management

This commit is contained in:
KatolaZ 2016-06-16 08:21:42 +01:00
parent ec1c3080bd
commit d7abbc1393
2 changed files with 161 additions and 0 deletions

97
zlibs/blends Normal file
View File

@ -0,0 +1,97 @@
#!/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/>.
## blend-related functions
## Apply a blend, i.e. read the "blend" file and source the
## corresponding *_init and *_run files
##
## FIXME!!!! We need a way to check that the source of init and run
## files were successful, so that we can popd as necessary upon failure
##
blend_apply(){
fn blend_apply $@
blenddir=$1
req=(blenddir strapdir arch)
reqck || return 1
if [[ ! -d $blenddir || ! -f ${blenddir}/blend ]]; then
error "::1 dir:: is not a valid blend" $blenddir
return 1
fi
pushd $blenddir
source blend
## Check if release is among the supported blend_releases
[[ -z ${blend_releases[(r)$release]} ]] && {
error "::1 rel:: is not among the releases supported by blend ::2 dir:: " $rel $blenddir;
popd;
return 1
}
[[ -z ${blend_archs[(r)$arch]} ]] && {
error "::1 arch:: is not among the architectures supported by blend ::2 dir:: " $arch $blenddir;
popd;
return 1
}
notice "Selecting blend architecture ::1 arch:: " $arch
pushd ${arch}
[[ -n ${blend_init} ]] && {
notice "Initialising blend ::1 blend:: " $blenddir
##
[[ ! -f ${blend_init} ]] && {
error "Blend initialisation file \"::1 file::\" not found" ${blend_init}
popd
popd
return 1
}
source ${blend_init}
act "Initialisation successful"
}
[[ -n ${blend_run} ]] && {
notice "Applying blend ::1 blend:: " $blenddir
##
[[ ! -f ${blend_run} ]] && {
error "Blend run file \"::1 file::\" not found" ${blend_run}
popd
popd
return 1
}
source ${blend_run}
act "Application successful"
}
# come back to blend main dir
popd
# come back to working directory before the call to blend_apply
popd
}

64
zlibs/packages Normal file
View File

@ -0,0 +1,64 @@
#!/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/>.
pkg_install_chroot(){
fn pkg_install_chroot $@
pkg_name=$1
root=${2:-$strapdir}
req=(pkg_name root)
reqck || return 1
mountdevprocsys ${root}
sudo chroot ${root} apt-get --yes --force-yes install $kernel
umountdevprocsys ${root}
}
pkg_install_ssh(){
}
pkg_remove_chroot(){
}
pkg_remove_ssh(){
}
pkg_set_package_list(){
}