X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=scripts%2Fvserver-build.functions.apt;fp=scripts%2Fvserver-build.functions.apt;h=4973fedcaee82bc43788c55cc8947ca3a2f776f3;hb=8cf13bb177d92c93eb73dc8939777150536c2d00;hp=0000000000000000000000000000000000000000;hpb=6bf3f95de36c804c97716b2d0bdf10680c559044;p=util-vserver.git diff --git a/scripts/vserver-build.functions.apt b/scripts/vserver-build.functions.apt new file mode 100644 index 0000000..4973fed --- /dev/null +++ b/scripts/vserver-build.functions.apt @@ -0,0 +1,82 @@ +# $Id: vserver-build.functions.apt,v 1.8 2005/04/16 21:20:45 ensc Exp $ --*- sh -*-- + +# Copyright (C) 2003 Enrico Scholz +# +# This program 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; version 2 of the License. +# +# This program 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 program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +function apt.installBasePackages +{ + local name="$1" + local dir="$2" + + test "$dir" != / || return 0 + for filelist in "$dir"/*; do + isRegularFile "$filelist" || continue + local idx=0 + local can_fail=false + local flags= + + set -- $(<$filelist) + while test "$#" -gt 0; do + case "$1" in + --reinstall) flags='--reinstall';; + --can-fail) can_fail=true;; + *) break;; + esac + shift + done + "$_VAPT_GET" "$name" -- install -y $flags $* || $can_fail + done +} + +function apt.initVariables +{ + findFile APTCONFDEFAULT \ + "$__CONFDIR/.distributions/$DISTRIBUTION/apt.conf" \ + "$__CONFDIR/.defaults/apps/pkgmgmt/apt.conf" \ + "$__DISTRIBDIR/$DISTRIBUTION/apt.conf" \ + "$__DISTRIBDIR/defaults/apt.conf" \ + '' + + findFile APTVENDORDEFAULT \ + "$__CONFDIR/.distributions/$DISTRIBUTION/vendor.conf" \ + "$__CONFDIR/.defaults/apps/pkgmgmt/vendor.conf" \ + /etc/apt/vendors.list \ + "$__DISTRIBDIR/$DISTRIBUTION/vendor.conf" \ + "$__DISTRIBDIR/defaults/vendor.conf" \ + '' +} + +function apt.initFilesystem +{ + mkdir -p "$PKGCFGDIR"/apt/{etc/sources.list.d,etc/vendors.list.d,etc/apt.conf.d,archives/partial,cache,state/lists/partial} + + populateDirectory "$PKGCFGDIR/apt/etc" \ + "$__DISTRIBDIR/defaults/apt" \ + "$__DISTRIBDIR/$DISTRIBUTION/apt" \ + "$__CONFDIR/.distributions/$DISTRIBUTION/apt" + + local f="$PKGCFGDIR"/apt/etc/apt.conf + if test -e "$f"; then + $_SED -e "s!@APTETCDIR@!$PKGCFGDIR/apt/etc!g" "$f" >"$f.tmp" + $_CMP -s "$f" "$f.tmp" || $_CAT "$f.tmp" >"$f" + $_RM -f "$f.tmp" + fi + + test -z "$APTCONFDEFAULT" || \ + $_LN_S "$APTCONFDEFAULT" "$PKGCFGDIR"/apt/etc/apt.conf.d/default.conf + + test -z "$APTVENDORDEFAULT" || \ + $_LN_S "$APTVENDORDEFAULT" "$PKGCFGDIR"/apt/etc/vendors.list.d/default.conf +}