File: vserver-build.functions.apt

package info (click to toggle)
util-vserver 0.30.212-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 6,648 kB
  • ctags: 3,145
  • sloc: ansic: 19,781; sh: 13,258; xml: 1,618; makefile: 364; perl: 85
file content (82 lines) | stat: -rw-r--r-- 2,560 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# $Id: vserver-build.functions.apt 2030 2005-04-16 21:20:45Z ensc $	--*- sh -*--

# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
#  
# 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
}