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.
21 function pkgmgmt._setPkgCfgBase
23 test -z "$PKGCFGBASE" || return 0
25 for item in "\"$__CONFDIR/.defaults/apps/pkgmgmt/base\" 1" ${ROOTDIR:+"$ROOTDIR/.pkg"} "$__DEFAULT_VSERVERPKGDIR"; do
29 test ! -d "$PKGCFGBASE" || break
32 test -d "$PKGCFGBASE" || {
33 echo "pkgcfgbase-dir '$PKGCFGBASE' does not exist or is invalid" >&2
38 function pkgmgmt._setPkgCfg
40 pkgmgmt._setPkgCfgBase
42 test -z "$PKGCFGDIR" || return 0
43 PKGCFGDIR="$PKGCFGBASE/$VSERVERDIRNAME"
46 function pkgmgmt._renameVserverPkgCfg
48 local suffix=.~$(date +'%s')~
51 for i in "$PKGCFGDIR"; do
54 say "Renamed '$i' to '$i$suffix'"
59 function pkgmgmt.initFilesystem
61 test -z "$1" || pkgmgmt._renameVserverPkgCfg
62 test ! -d "$PKGCFGDIR" || {
64 "vserver pkgmgmt-directory exists already; please try to use
65 '--force'; or remove it manually" >&2
69 mkdir -p "${SETUP_CONFDIR:?}"/apps/pkgmgmt
71 test -z "$PKGCFGDIR" || {
72 ln -s "$PKGCFGDIR" "$SETUP_CONFDIR/apps/pkgmgmt/base"
74 test "$_EXECDIR" = / || ln -s "${_EXECDIR:?}" "$SETUP_CONFDIR/apps/pkgmgmt/execdir"
79 function pkgmgmt.initVariables
82 findDir PKGINSTALLDIR "$__CONFDIR/.distributions/$DISTRIBUTION/pkgs" "$__DISTRIBDIR/$DISTRIBUTION/pkgs" /