vshost-util-vserver

Build script and sources for util-vserver.
git clone https://ccx.te2000.cz/git/vshost-util-vserver
Log | Files | Refs

vserver-build.functions.apt (2499B)


      1 # $Id$	--*- sh -*--
      2 
      3 # Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
      4 #  
      5 # This program is free software; you can redistribute it and/or modify
      6 # it under the terms of the GNU General Public License as published by
      7 # the Free Software Foundation; version 2 of the License.
      8 #  
      9 # This program is distributed in the hope that it will be useful,
     10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 # GNU General Public License for more details.
     13 #  
     14 # You should have received a copy of the GNU General Public License
     15 # along with this program; if not, write to the Free Software
     16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
     17 
     18 function apt.installBasePackages
     19 {
     20     local name="$1"
     21     local dir="$2"
     22 
     23     test "$dir" != / || return 0
     24     for filelist in "$dir"/*; do
     25 	isRegularFile "$filelist" || continue
     26 	local idx=0
     27 	local can_fail=false
     28 	local flags=
     29 
     30 	set -- $(<$filelist)
     31 	while test "$#" -gt 0; do
     32 	    case "$1" in
     33 		--reinstall) flags='--reinstall';;
     34 		--can-fail)  can_fail=true;;
     35 		*)  	     break;;
     36 	    esac
     37 	    shift
     38 	done
     39 	"$_VAPT_GET" "$name" -- install -y $flags $* || $can_fail
     40     done
     41 }
     42 
     43 function apt.initVariables
     44 {
     45     findFile APTCONFDEFAULT \
     46 	"$__CONFDIR/.distributions/$DISTRIBUTION/apt.conf" \
     47 	"$__CONFDIR/.defaults/apps/pkgmgmt/apt.conf" \
     48 	"$__DISTRIBDIR/$DISTRIBUTION/apt.conf" \
     49 	"$__DISTRIBDIR/defaults/apt.conf" \
     50 	''
     51 
     52     findFile APTVENDORDEFAULT \
     53 	"$__CONFDIR/.distributions/$DISTRIBUTION/vendor.conf" \
     54 	"$__CONFDIR/.defaults/apps/pkgmgmt/vendor.conf" \
     55 	/etc/apt/vendors.list \
     56 	"$__DISTRIBDIR/$DISTRIBUTION/vendor.conf" \
     57 	"$__DISTRIBDIR/defaults/vendor.conf" \
     58 	''
     59 }
     60 
     61 function apt.initFilesystem
     62 {
     63     mkdir -p "$PKGCFGDIR"/apt/{etc/sources.list.d,etc/vendors.list.d,etc/apt.conf.d,archives/partial,cache,state/lists/partial}
     64     
     65     populateDirectory "$PKGCFGDIR/apt/etc" \
     66 	"$__DISTRIBDIR/defaults/apt" \
     67 	"$__DISTRIBDIR/$DISTRIBUTION/apt" \
     68 	"$__CONFDIR/.distributions/$DISTRIBUTION/apt"
     69 
     70     local f="$PKGCFGDIR"/apt/etc/apt.conf
     71     if test -e "$f"; then
     72 	$_SED -e "s!@APTETCDIR@!$PKGCFGDIR/apt/etc!g" "$f" >"$f.tmp"
     73 	$_CMP -s "$f" "$f.tmp" || $_CAT "$f.tmp" >"$f"
     74 	$_RM -f "$f.tmp"
     75     fi
     76 
     77     test -z "$APTCONFDEFAULT" || \
     78 	$_LN_S "$APTCONFDEFAULT"   "$PKGCFGDIR"/apt/etc/apt.conf.d/default.conf
     79 
     80     test -z "$APTVENDORDEFAULT" || \
     81 	$_LN_S "$APTVENDORDEFAULT" "$PKGCFGDIR"/apt/etc/vendors.list.d/default.conf
     82 }