3 # Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
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.
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.
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.
20 YUM_RELEASEPKGS=( {redhat,fedora}-release )
22 function pkgmgmt._setPkgCfgBase
24 test -z "$PKGCFGBASE" || return 0
26 for item in "\"$__CONFDIR/.defaults/apps/pkgmgmt/base\" 1" ${ROOTDIR:+"$ROOTDIR/.pkg"} "$__DEFAULT_VSERVERPKGDIR"; do
30 test ! -d "$PKGCFGBASE" || break
33 test -d "$PKGCFGBASE" || {
34 echo "pkgcfgbase-dir '$PKGCFGBASE' does not exist or is invalid" >&2
39 function pkgmgmt._setPkgCfg
41 pkgmgmt._setPkgCfgBase
43 test -z "$PKGCFGDIR" || return 0
44 PKGCFGDIR="$PKGCFGBASE/$VSERVERDIRNAME"
47 function pkgmgmt._renameVserverPkgCfg
49 local suffix=.~$(date +'%s')~
52 for i in "$PKGCFGDIR"; do
55 say "Renamed '$i' to '$i$suffix'"
60 function pkgmgmt.initFilesystem
62 test -z "$1" || pkgmgmt._renameVserverPkgCfg
63 test ! -d "$PKGCFGDIR" || {
65 "vserver pkgmgmt-directory exists already; please try to use
66 '--force'; or remove it manually" >&2
71 base._addGeneratedFile "$PKGCFGDIR"
73 mkdir -p "${SETUP_CONFDIR:?}"/apps/pkgmgmt
75 test -z "$PKGCFGDIR" || {
76 ln -s "$PKGCFGDIR" "$SETUP_CONFDIR/apps/pkgmgmt/base"
78 test "$_EXECDIR" = / || ln -s "${_EXECDIR:?}" "$SETUP_CONFDIR/apps/pkgmgmt/execdir"
83 function pkgmgmt.initVariables
86 findDir PKGINSTALLDIR "$__CONFDIR/.distributions/$DISTRIBUTION/pkgs" "$__DISTRIBDIR/$DISTRIBUTION/pkgs" /