vshost-util-vserver

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

vunify-init.hc (2164B)


      1 // $Id$    --*- c -*--
      2 
      3 // Copyright (C) 2004 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 #include "pathconfig.h"
     19 
     20 static void
     21 initModeManually(struct Arguments const UNUSED *args, int argc, char *argv[])
     22 {
     23   int		i, count=argc/2;
     24   
     25   if (argc%2) {
     26     WRITE_MSG(2, "Odd number of (path,excludelist) arguments\n");
     27     exit(1);
     28   }
     29 
     30   if (count<2) {
     31     WRITE_MSG(2, "No reference path(s) given\n");
     32     exit(1);
     33   }
     34 
     35   MatchList_initManually(&global_info.dst_list, 0, strdup(argv[0]), argv[1]);
     36 
     37   --count;
     38   global_info.src_lists.v = Emalloc(sizeof(struct MatchList) * count);
     39   global_info.src_lists.l = count;
     40 
     41   for (i=0; i<count; ++i)
     42     MatchList_initManually(global_info.src_lists.v+i, 0,
     43 			   strdup(argv[2 + i*2]), argv[3 + i*2]);
     44 }
     45 
     46 
     47 static void
     48 initModeVserver(struct Arguments const UNUSED *args, int argc, char *argv[])
     49 {
     50   struct MatchVserverInfo		vserver = {
     51     .name        = argv[0],
     52     .use_pkgmgmt = true
     53   };
     54 
     55   if (!MatchVserverInfo_init(&vserver)) {
     56     WRITE_MSG(2, "Failed to initialize unification for this vserver\n");
     57     exit(1);
     58   }
     59   
     60   if (argc!=1) {
     61     WRITE_MSG(2, "More than one vserver is not supported\n");
     62     exit(1);
     63   }
     64 
     65   if (!MatchList_initByVserver(&global_info.dst_list, &vserver)) {
     66     WRITE_MSG(2, "unification not configured for this vserver\n");
     67     exit(1);
     68   }
     69 
     70   MatchList_initRefserverList(&global_info.src_lists.v,
     71 			      &global_info.src_lists.l,
     72 			      vserver.appdir.d);
     73 
     74   MatchVserverInfo_free(&vserver);
     75 }