Remove deprecated files.
Daniel Hokka Zakrisson [Fri, 23 Nov 2007 18:59:18 +0000 (18:59 +0000)]
src/vbuild.cc [deleted file]
src/vserver.cc [deleted file]
src/vserver.hh [deleted file]
src/vutil.cc [deleted file]
src/vutil.h [deleted file]
src/vutil.p [deleted file]

diff --git a/src/vbuild.cc b/src/vbuild.cc
deleted file mode 100644 (file)
index 9dd6ac4..0000000
+++ /dev/null
@@ -1,296 +0,0 @@
-// $Id: vbuild.cc,v 1.4 2003/10/21 13:55:35 ensc Exp $
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-// based on vbuild.cc by Jacques Gelinas
-//  
-// 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; either version 2, or (at your option)
-// any later version.
-//  
-// 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.
-
-/*
-       This utility is used to build a new vserver using a reference vserver.
-       It uses hard link whenever possible instead of duplicating files.
-       Once done, it sets the immutable bits.
-*/
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-#include <dirent.h>
-
-#include <string>
-#include <vector>
-#include <list>
-#include <set>
-#include <cassert>
-
-#include "vutil.h"
-
-using namespace std;
-
-struct EXCLDIR{
-       string prefix;
-       int len;
-       EXCLDIR(const char *s)
-       {
-               prefix = s;
-               prefix += '/';
-               len = prefix.size();
-       }
-};
-static vector<EXCLDIR> excldirs;
-
-
-static int  ext2flags = EXT2_IMMUTABLE_FILE_FL | EXT2_IMMUTABLE_LINK_FL;
-static struct {
-       int nblink;
-       int nbcopy;
-       long size_copy;
-       int nbdir;
-       int nbsymlink;
-       int nbspc;
-} stats;
-
-
-static void usage()
-{
-       cerr <<
-               "vbuild version " << VERSION <<
-               "\n\n"
-               "vbuild [ options ] reference-server new-vservers\n"
-               "\n"
-               "--test: Show what will be done, do not do it.\n"
-               "--debug: Prints some debugging messages.\n"
-               "\n"
-               "--excldir: None of the files under a given directory will be copied\n"
-               "\tThe directory is expressed in absolute/logical form (relative\n"
-               "\tto the vserver root (ex: /var/log)\n"
-               "\n"
-               "\n"
-               "--noflags: Do not put any immutable flags on the file\n"
-               "--immutable: Set the immutable_file bit on the files.\n"
-               "--immutable-mayunlink: Sets the immutable_link flag on files.\n"
-               "--stats: Produce statistics on the number of file linked\n"
-               "         copied and so on.\n"
-               "\n"
-               "By default, the immutable_file and     immutable_link flags are\n"
-               "set on the files. So if you want no immutable flags, you must\n"
-               "use --noflags. If you want a single flag, you must use\n"
-               "--noflags first, then the --immutable or --immutable-mayunlink\n"
-               "flag.\n"
-               ;
-}
-
-/*
-       Return true if a directory lies inside a directory set
-*/
-static bool vbuild_inside (vector<EXCLDIR> &dirs, const char *path)
-{
-       bool found = false;
-       for (unsigned i=0; i<dirs.size(); i++){
-               if (strncmp(dirs[i].prefix.c_str(),path,dirs[i].len)==0){
-                       found = true;
-                       break;
-               }
-       }
-       return found;
-}
-
-
-
-static int vbuild_copy (
-       string refserv,
-       string newserv,
-       dev_t dev,                      // We stay on the same volume
-       string logical_dir,
-       set<string> &files)
-{
-       int ret = -1;
-       if (debug > 0) printf ("Copying directory %s\n",logical_dir.c_str());
-       DIR *dir = opendir (refserv.c_str());
-       if (dir == NULL){
-               fprintf (stderr,"Can't open directory %s (%s)\n",refserv.c_str()
-                       ,strerror(errno));
-       }else{
-               logical_dir += "/";
-               bool copy_files = !vbuild_inside(excldirs,logical_dir.c_str());
-               struct dirent *ent;
-               ret = 0;
-               while (ret == 0 && (ent=readdir(dir))!=NULL){
-                       if (strcmp(ent->d_name,".")==0 || strcmp(ent->d_name,"..")==0){
-                               continue;
-                       }
-                       string file = refserv + "/" + ent->d_name;
-                       struct stat st;
-                       if (vutil_lstat(file.c_str(),st) == -1){
-                               ret = -1;
-                       }else if (st.st_dev != dev){
-                               if (debug > 0) printf ("Ignore sub-directory %s\n",file.c_str());
-                       }else{
-                               string newfile = newserv + "/" + ent->d_name;
-                               if (S_ISDIR(st.st_mode)){
-                                       if (vbuild_mkdir (newfile.c_str(),st.st_mode)==-1){
-                                               fprintf (stderr,"Can't mkdir %s (%s)\n"
-                                                       ,newfile.c_str(),strerror(errno));
-                                               ret = -1;
-                                       }else{
-                                               stats.nbdir++;
-                                               if (vbuild_chown(newfile.c_str(),st.st_uid,st.st_gid)==-1){
-                                                       fprintf (stderr,"Can't chown %s (%s)\n"
-                                                               ,newfile.c_str(),strerror(errno));
-                                                       ret = -1;
-                                               }
-                                               ret |= vbuild_copy (file,newfile,dev
-                                                       ,logical_dir + ent->d_name,files);
-                                       }
-                               }else if (S_ISLNK(st.st_mode)){
-                                       char path[PATH_MAX];
-                                       int len = readlink(file.c_str(),path,sizeof(path)-1);
-                                       if (len < 0){
-                                               fprintf (stderr,"Can't readlink %s (%s)\n"
-                                                       ,file.c_str(),strerror(errno));
-                                               ret = -1;
-                                       }else{
-                                               path[len] = '\0';
-                                               stats.nbsymlink++;
-                                               if (vbuild_symlink (path,newfile.c_str())==-1){
-                                                       fprintf (stderr,"Can't symlink %s to %s (%s)\n",
-                                                               newfile.c_str(),path,strerror(errno));
-                                               }
-                                       }
-                               }else if (S_ISBLK(st.st_mode)
-                                       || S_ISCHR(st.st_mode)
-                                       || S_ISFIFO(st.st_mode)){
-                                       stats.nbspc++;
-                                       if (vbuild_mknod (newfile.c_str(),st.st_mode,st.st_rdev)==-1){
-                                               fprintf (stderr,"Can't mknod %s (%s)\n"
-                                                       ,newfile.c_str(),strerror(errno));
-                                               ret = -1;
-                                       }
-                               }else if (S_ISSOCK(st.st_mode)){
-                                       // Do nothing
-                               }else if (copy_files){
-                                       // Ok, this is a file. We either copy it or do a link
-                                       string logical_file = logical_dir + ent->d_name;
-                                       if (files.find (logical_file)==files.end()){
-                                               if (debug > 1) printf ("Copying file %s\n",file.c_str());
-                                               if (vbuild_file_copy (file.c_str(),newfile.c_str(),st)==-1){
-                                                       fprintf (stderr,"Can't copy %s to %s (%s)\n",
-                                                               file.c_str(),newfile.c_str(),strerror(errno));
-                                                       ret = -1;
-                                               }else{
-                                                       stats.size_copy += st.st_size;
-                                                       stats.nbcopy++;
-                                               }
-                                       }else{
-                                               if (debug > 2) printf ("Linking file %s\n",file.c_str());
-                                               setext2flag (file.c_str(),false,ext2flags);
-                                               stats.nblink++;
-                                               if (vbuild_link (file.c_str(),newfile.c_str())==-1){
-                                                       fprintf (stderr,"Can't link %s to %s (%s)\n",
-                                                               file.c_str(),newfile.c_str(),strerror(errno));
-                                                       ret = -1;
-                                               }
-                                               setext2flag (file.c_str(),true,ext2flags);
-                                       }
-                               }
-                       }
-               }
-               closedir(dir);
-       }
-       return ret;
-}
-
-static void
-prepareVserver(Vserver const UNUSED &src, char const UNUSED *dst)
-{
-  assert(false);
-}
-
-int main (int argc, char *argv[])
-{
-       int ret = -1;
-       bool statistics = false;
-       int i;
-       for (i=1; i<argc; i++){
-               const char *arg = argv[i];
-               //const char *opt = argv[i+1];
-               if (strcmp(arg,"--test")==0){
-                       testmode = true;
-               }else if (strcmp(arg,"--debug")==0){
-                       debug++;
-               }else if (strcmp(arg,"--stats")==0){
-                       statistics = true;
-               }else if (strcmp(arg,"--noflags")==0){
-                       ext2flags = 0;
-               }else if (strcmp(arg,"--immutable")==0){
-                       ext2flags |= EXT2_IMMUTABLE_FILE_FL;
-               }else if (strcmp(arg,"--immutable-mayunlink")==0){
-                       ext2flags |= EXT2_IMMUTABLE_LINK_FL;
-               }else if (strcmp(arg,"--excldir")==0){
-                       i++;
-                       excldirs.push_back (EXCLDIR(argv[i]));
-               }else{
-                       break;
-               }
-       }
-       if (i!=argc-2){
-               usage();
-       }else{
-               Vserver         refserv(argv[i++]);
-
-               prepareVserver(refserv, argv[i]);
-               Vserver         newserv(argv[i]);
-               list<Package> packages;
-               // Load the files which are not configuration files from
-               // the packages
-               vutil_loadallpkg (refserv,packages);
-               set<string> files;
-               for (list<Package>::iterator it=packages.begin(); it!=packages.end(); it++){
-                       (*it).loadfiles(refserv,files);
-               }
-               // Now, we do a recursive copy of refserv into newserv
-               umask (0);
-               // Check if it is on the same volume
-               struct stat refst,newst;
-               if (vutil_lstat(refserv.getName().c_str(),refst)!=-1
-                   && vutil_lstat(newserv.getName().c_str(),newst)!=1){
-                       if (refst.st_dev != newst.st_dev){
-                         fprintf (stderr,"Can't vbuild %s because it is not on the same volume as %s\n",
-                                  newserv.getName().c_str(),refserv.getName().c_str());
-                       }else{
-                               stats.nbdir = stats.nblink = stats.nbcopy = stats.nbsymlink = 0;
-                               stats.nbspc = 0;
-                               stats.size_copy = 0;
-                               ret = vbuild_copy (refserv.getName(),newserv.getName(),refst.st_dev,"",files);
-                               if (statistics){
-                                       printf ("Directory created: %d\n",stats.nbdir);
-                                       printf ("Files copied     : %d\n",stats.nbcopy);
-                                       printf ("Bytes copied     : %ld\n",stats.size_copy);
-                                       printf ("Files linked     : %d\n",stats.nblink);
-                                       printf ("Files symlinked  : %d\n",stats.nbsymlink);
-                                       printf ("Special files    : %d\n",stats.nbspc);
-                               }
-                       }
-               }
-       }
-       return ret;
-}
-
-
diff --git a/src/vserver.cc b/src/vserver.cc
deleted file mode 100644 (file)
index cddcf11..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-// $Id: vserver.cc,v 1.1 2003/10/21 13:26:21 ensc Exp $    --*- c++ -*--
-
-// 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.
-
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#include "vserver.hh"
-#include "pathconfig.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fstream>
-#include <iostream>
-
-static bool
-dirExists(std::string const &path)
-{
-  struct stat  st;
-  return (stat(path.c_str(), &st)!=-1 &&
-         S_ISDIR(st.st_mode));
-}
-
-Vserver::Vserver(std::string const &str) :
-  conf_dir_(str), vdir_(str), name_(str)
-{
-  vdir_       += "/.vdir";
-  
-  if (!dirExists(vdir_)) {
-    conf_dir_  = CONFDIR;
-    conf_dir_ += str;
-  }
-
-  rpmdb_path_  = conf_dir_;
-  rpmdb_path_ += "/apps/pkgmgmt/rpmstate";
-
-  if (!dirExists(rpmdb_path_)) {
-    rpmdb_path_  = conf_dir_;
-    rpmdb_path_ += "/apps/pkgmgmt/base/rpm/state";
-  }
-
-  if (!dirExists(rpmdb_path_)) {
-    rpmdb_path_  = vdir_;
-    rpmdb_path_ += "/var/lib/rpm";
-  }
-
-  std::string  tmp = conf_dir_;
-  tmp  += ".name";
-
-  std::ifstream                name_file(tmp.c_str());
-
-  if (name_file.good()) getline(name_file, name_);
-}
-
-std::ostream &
-operator << (std::ostream &lhs, Vserver const &rhs)
-{
-  return lhs << rhs.getName();
-}
diff --git a/src/vserver.hh b/src/vserver.hh
deleted file mode 100644 (file)
index b0059dc..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-// $Id: vserver.hh,v 1.1 2003/10/21 13:26:21 ensc Exp $    --*- c++ -*--
-
-// 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.
-
-
-#ifndef HH_UTIL_VSERVER_SRC_VSERVSER_HH
-#define HH_UTIL_VSERVER_SRC_VSERVSER_HH
-
-#include <string>
-#include <ostream>
-
-class Vserver
-{
-  public:
-    Vserver(std::string const &name);
-
-    std::string const &                getConfDir() const   { return conf_dir_; }
-    std::string const &                getVdir() const      { return vdir_; }
-    std::string const &                getRPMDbPath() const { return rpmdb_path_; }
-    std::string const &                getName() const      { return name_; }
-
-  private:
-    std::string                conf_dir_;
-    std::string                vdir_;
-    std::string                rpmdb_path_;
-    std::string                name_;
-};
-
-std::ostream & operator << (std::ostream &lhs, Vserver const &rhs);
-
-
-#endif //  HH_UTIL_VSERVER_SRC_VSERVSER_HH
diff --git a/src/vutil.cc b/src/vutil.cc
deleted file mode 100644 (file)
index 770c795..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-// $Id: vutil.cc,v 1.5 2004/02/06 17:42:53 ensc Exp $
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-// based on vutil.cc by Jacques Gelinas
-//  
-// 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; either version 2, or (at your option)
-// any later version.
-//  
-// 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.
-
-#pragma implementation
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <utime.h>
-#include "vutil.h"
-#include <sys/ioctl.h>
-#include "ext2fs.h"
-
-#include <pathconfig.h>
-
-bool testmode;
-int debug;
-
-int file_copy (const char *src, const char *dst, struct stat &st)
-{
-       int ret = -1;
-       FILE *fin = fopen (src,"r");
-       if (fin == NULL){
-               fprintf (stderr,"Can't open file %s (%s)\n",src,strerror(errno));
-       }else{
-               FILE *fout = fopen (dst,"w");
-               if (fout == NULL){
-                       fprintf (stderr,"Can't open file %s (%s)\n",dst,strerror(errno));
-               }else{
-                       char buf[8192];
-                       int len;
-                       while ((len=fread(buf,1,sizeof(buf),fin))>0){
-                               fwrite (buf,1,len,fout);
-                       }
-                       fflush (fout);
-                       ret = 0;
-                       if (fchown (fileno(fout),st.st_uid,st.st_gid)==-1){
-                               fprintf (stderr,"Can't chown file %s (%s)\n"
-                                       ,dst,strerror(errno));
-                               ret = -1;
-                       }else if (fchmod (fileno(fout),st.st_mode)==-1){
-                               fprintf (stderr,"Can't chmod file %s (%s)\n"
-                                       ,dst,strerror(errno));
-                               ret = -1;
-                       }
-                       fclose(fout);
-                       struct utimbuf timbuf;
-                       timbuf.modtime = st.st_mtime;
-                       timbuf.actime = st.st_atime;
-                       if (utime (dst,&timbuf)==-1){
-                               fprintf (stderr,"Can't set time stamp on file %s (%s)\n"
-                                       ,dst,strerror(errno));
-                       }
-               }
-               fclose (fin);
-       }
-       return ret;
-}
-
-/*
-       Set the immutable flag on a file
-*/
-int setext2flag (const char *fname, bool set, int ext2flags)
-{
-       int ret = -1;
-       if (testmode){
-               ret = 0;
-       }else{
-               int fd = open (fname,O_RDONLY);
-               if (fd == -1){
-                       fprintf (stderr,"Can't open file %s (%s)\n",fname 
-                               ,strerror(errno));
-               }else{
-                       int flags = set ? ext2flags : 0;
-                       ret = ioctl (fd,EXT2_IOC_SETFLAGS,&flags);
-                       close (fd);
-                       if (ret == -1){
-                               fprintf (stderr,"Can't %s immutable flag on file %s (%s)\n"
-                                       ,(set ? "set" : "unset")
-                                       ,fname
-                                       ,strerror(errno));
-                       }
-               }
-       }
-       return ret;
-}
-
-int vbuild_mkdir (const char *path, mode_t mode)
-{
-       int ret = -1;
-       if (testmode){
-               printf ("mkdir %s; chmod %o %s\n",path,mode,path);
-               ret = 0;
-       }else{
-               ret = mkdir (path,mode);
-               if (ret == -1 && errno == EEXIST){
-                       struct stat st;
-                       if (lstat(path,&st)!=-1 && S_ISDIR(st.st_mode)){
-                               ret = chmod (path,mode);
-                       }
-               }
-       }
-       return ret;
-}
-
-int vbuild_mknod(const char *path, mode_t mode, dev_t dev)
-{
-       int ret = -1;
-       if (testmode){
-               printf ("mknod %s %o %02x:%02x\n",path,mode,major(dev),minor(dev));
-               ret = 0;
-       }else{
-               ret = mknod (path,mode,dev);
-               if (ret == -1 && errno == EEXIST){
-                       struct stat st;
-                       lstat(path,&st);
-                       if (lstat(path,&st)!=-1
-                               && (st.st_mode & S_IFMT) == (mode & S_IFMT)
-                               && st.st_rdev == dev){
-                               ret = chmod (path,mode);
-                       }
-               }
-       }
-       return ret;
-}
-int vbuild_symlink(const char *src, const char *dst)
-{
-       int ret = -1;
-       if (testmode){
-               printf ("ln -s %s %s\n",src,dst);
-               ret = 0;
-       }else{
-               ret = symlink (src,dst);
-       }
-       return ret;
-}
-
-int vbuild_link(const char *src, const char *dst)
-{
-       int ret = -1;
-       if (testmode){
-               printf ("ln %s %s\n",src,dst);
-               ret = 0;
-       }else{
-               ret = link (src,dst);
-       }
-       return ret;
-}
-
-int vbuild_unlink(const char *path)
-{
-       int ret = -1;
-       if (testmode){
-               printf ("unlink %s\n",path);
-               ret = 0;
-       }else{
-               ret = unlink (path);
-       }
-       return ret;
-}
-
-int vbuild_chown(const char *path, uid_t uid, gid_t gid)
-{
-       int ret = -1;
-       if (testmode){
-               printf ("chown %d.%d %s\n",uid,gid,path);
-               ret = 0;
-       }else{
-               ret = chown (path,uid,gid);
-       }
-       return ret;
-}
-
-int vbuild_file_copy(
-       const char *src,
-       const char *dst,
-       struct stat &st)
-{
-       int ret = -1;
-       if (testmode){
-               printf ("cp -a %s %s\n",src,dst);
-               ret = 0;
-       }else{
-               ret = file_copy (src,dst,st);
-       }
-       return ret;
-}
-
-/*
-       Load the list of all packages in a vserver
-*/
-void vutil_loadallpkg (Vserver const &refserver, list<Package> &packages)
-{
-       FILE *fin = vutil_execdistcmd (K_PKGVERSION,refserver,NULL);
-       if (fin != NULL){
-               char line[1000];
-               while (fgets(line,sizeof(line)-1,fin)!=NULL){
-                       int last = strlen(line)-1;
-                       if (last >= 0 && line[last] == '\n') line[last] = '\0';
-                       packages.push_back (Package(line));
-               }
-               pclose (fin);
-       }
-}
-
-int vutil_lstat (string path, struct stat &st)
-{
-       int ret = 0;
-       if (lstat(path.c_str(),&st) == -1){
-               fprintf (stderr,"Can't lstat file %s (%s)\n"
-                       ,path.c_str(),strerror(errno));
-               ret = -1;
-       }
-       return ret;
-}
-
-const char K_PKGVERSION[]="pkgversion";
-const char K_DUMPFILES[]="dumpfiles";
-const char K_UNIFILES[]="unifiles";
-
-FILE *vutil_execdistcmd (const char *key, Vserver const &vserver, const char *args)
-{
-       string cmd = PKGLIBDIR "/legacy/distrib-info ";
-       cmd += vserver.getName();
-       cmd += " ";
-       cmd += key;
-       if (args != NULL){
-               cmd += " ";
-               cmd += args;
-       }
-       FILE *ret = popen (cmd.c_str(),"r");
-       if (ret == NULL){
-               fprintf (stderr,"Can't execute command %s\n",cmd.c_str());
-       }else{
-               #if 0
-               char buf[1000];
-               while (fgets(buf,sizeof(buf)-1,fin)!=NULL){
-                       int last = strlen(buf)-1;
-                       if (last >= 0) buf[last] = '\0';
-                       ret = buf;
-                       break;
-               }
-               pclose (fin);
-               #endif
-       }
-       return ret;
-}
diff --git a/src/vutil.h b/src/vutil.h
deleted file mode 100644 (file)
index 90101c0..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-// $Id: vutil.h,v 1.3 2003/10/21 13:23:28 ensc Exp $
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-// based on vutil.h by Jacques Gelinas
-//  
-// 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; either version 2, or (at your option)
-// any later version.
-//  
-// 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.
-
-#pragma interface
-#ifndef VUTIL_H
-#define VUTIL_H
-
-#include "vserver.hh"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <string>
-#include <set>
-#include <algorithm>
-#include <iostream>
-#include <list>
-
-using namespace std;
-
-extern int debug;
-extern bool testmode;
-
-// Patch to help compile this utility on unpatched kernel source
-#ifndef EXT2_IMMUTABLE_FILE_FL
-       #define EXT2_IMMUTABLE_FILE_FL  0x00000010
-       /* Set both bits for backward compatibility */
-       #define EXT2_IMMUTABLE_LINK_FL  0x08008000
-#endif
-
-
-FILE *vutil_execdistcmd (const char *, Vserver const &, const char *);
-extern const char K_DUMPFILES[];
-extern const char K_UNIFILES[];
-extern const char K_PKGVERSION[];
-
-class Package{
-public:
-       string name;
-       string version; // version + release
-       Package(string &_name, string &_version)
-               : name (_name), version(_version)
-       {
-       }
-       Package(const char *_name, const char *_version)
-               : name (_name), version(_version)
-       {
-       }
-       Package(const string &line)
-       {
-               *this = line;
-       }
-       Package & operator = (const string &_line)
-       {
-               string line (_line);
-               string::iterator pos = find (line.begin(),line.end(),'=');
-               if (pos != line.end()){
-                       name = string(line.begin(),pos);
-                       version = string(pos + 1,line.end());
-               }
-               return *this;
-       }
-       Package (const Package &pkg)
-       {
-               name = pkg.name;
-               version = pkg.version;
-       }
-       bool operator == (const Package &v) const
-       {
-               return name == v.name && version == v.version;
-       }
-       bool operator < (const Package &v) const
-       {
-               bool ret = false;
-               if (name < v.name){
-                       ret = true;
-               }else if (name == v.name && version < v.version){
-                       ret = true;
-               }
-               return ret;
-       }
-       // Load the file member of the package, but exclude configuration file
-       void loadfiles(Vserver const &ref, set<string> &files)
-       {
-               if (debug > 2) cout << "Loading files for package " << name << endl;
-               string namever = name + '-' + version;
-               FILE *fin = vutil_execdistcmd (K_UNIFILES,ref,namever.c_str());
-               if (fin != NULL){
-                       char tmp[1000];
-                       while (fgets(tmp,sizeof(tmp)-1,fin)!=NULL){
-                               int last = strlen(tmp)-1;
-                               if (last >= 0 && tmp[last] == '\n') tmp[last] = '\0';
-                               files.insert (tmp);
-                       }
-               }
-               if (debug > 2) cout << "Done\n";
-       }
-       #if 0
-       bool locate(const string &path)
-       {
-               return find (files.begin(),files.end(),path) != files.end();
-       }
-       #endif
-};
-
-// Check if two package have the same name (but potentially different version)
-class same_name{
-       const Package &pkg;
-public:
-       same_name(const Package &_pkg) : pkg(_pkg) {}
-       bool operator()(const Package &p)
-       {
-               return pkg.name == p.name;
-       }
-};
-
-
-#include "vutil.p"
-
-#endif
-
diff --git a/src/vutil.p b/src/vutil.p
deleted file mode 100644 (file)
index 29a2c61..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// $Id: vutil.p,v 1.3 2003/10/21 13:23:12 ensc Exp $           --*- c++ -*--
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-// based on vutil.p by Jacques Gelinas
-//  
-// 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; either version 2, or (at your option)
-// any later version.
-//  
-// 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.
-
-
-/* vutil.cc 11/04/2003 14.22.04 */
-int file_copy (const char *src, const char *dst, struct stat&st);
-int setext2flag (const char *fname, bool set, int ext2flags);
-int vbuild_mkdir (const char *path, mode_t mode);
-int vbuild_mknod (const char *path, mode_t mode, dev_t dev);
-int vbuild_symlink (const char *src, const char *dst);
-int vbuild_link (const char *src, const char *dst);
-int vbuild_unlink (const char *path);
-int vbuild_chown (const char *path, uid_t uid, gid_t gid);
-int vbuild_file_copy (const char *src,
-        const char *dst,
-        struct stat&st);
-void vutil_loadallpkg (Vserver const &refserver, list<Package>&packages);
-int vutil_lstat (string path, struct stat&st);
-FILE *vutil_execdistcmd (const char *key,
-        const string&vserver,
-        const char *args);
-/* syscall.cc 18/07/2003 09.50.10 */
-extern "C" int call_new_s_context (int nbctx,
-        int ctxs[],
-        int remove_cap,
-        int flags);
-extern "C" int call_set_ipv4root (unsigned long ip[],
-        int nb,
-        unsigned long bcast,
-        unsigned long mask[]);
-extern "C" int call_chrootsafe (const char *dir);
-extern "C" int has_chrootsafe (void);
-extern "C" int call_set_ctxlimit (int res, long limit);