libdevuansdk/zlibs/packages

116 lines
2.2 KiB
Bash

#!/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(){
fn pkg_install $@
pkg_name=$1
root=${2:-$strapdir}
req=(pkg_name root)
reqck || return 1
mountdevprocsys ${root}
sudo chroot ${root} apt-get --yes --force-yes install ${pkg_name}
umountdevprocsys ${root}
}
pkg_install_ssh(){
}
pkg_remove(){
}
pkg_remove_ssh(){
}
pkg_set_list(){
fn pkg_set_list $@
pkglist=$1
root=${2:-$strapdir}
req=(pkglist root)
reqck || return 1
scriptfilebase=set_package_list.sh
scriptfile=${root}/${scriptfilebase}
pkg_config_set_list ${pkglist} | sudo tee ${scriptfile}
sudo chmod u+x ${scriptfile}
sudo cp ${pkglist} ${root}/`basename ${pkglist}`
[[ $? = 0 ]] || {
error "failed: _pkg_config_set_list ${pkglist} ${scriptfile}"
zsherr; zshexit
}
mountdevprocsys ${root}
sudo chroot ${root} ./${scriptfilebase}
umountdevprocsys ${root}
sudo rm ${scriptfile} ${root}/`basename ${pkglist}`
}
pkg_config_set_list() {
fn _pkg_config_set_list $@
pkglist=`basename $1`
req=(pkglist)
reqck || return 1
cat <<EOF
apt-get install dselect
dpkg --get-selections > selections.bak
dpkg --clear-selections
dselect update
dpkg --set-selections < ${pkglist}
dselect install
dselect config
dselect remove
## Now we purge all the packages marked as "deinstall"
apt-get purge `dpkg --get-selections | grep "deinstall$" | cut -f 1`
EOF
}