X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fsrc%2Fvbuild.cc;h=706ce3ef8305899c118b24f1e4006fafe8424a6e;hb=a917f24ef7b003dcef54a3db2644cf9cb4bc2db2;hp=adce35d36d7d3c5165e5092ea6f0dde361626007;hpb=029c42bd92af3a0f6584cc7e3e035d643c7f0e91;p=util-vserver.git diff --git a/util-vserver/src/vbuild.cc b/util-vserver/src/vbuild.cc index adce35d..706ce3e 100644 --- a/util-vserver/src/vbuild.cc +++ b/util-vserver/src/vbuild.cc @@ -38,6 +38,8 @@ #include #include #include +#include + #include "vutil.h" using namespace std; @@ -215,6 +217,12 @@ static int vbuild_copy ( return ret; } +static void +prepareVserver(Vserver const UNUSED &src, char const UNUSED *dst) +{ + assert(false); +} + int main (int argc, char *argv[]) { int ret = -1; @@ -245,8 +253,10 @@ int main (int argc, char *argv[]) if (i!=argc-2){ usage(); }else{ - string refserv = argv[i++]; - string newserv = argv[i]; + Vserver refserv(argv[i++]); + + prepareVserver(refserv, argv[i]); + Vserver newserv(argv[i]); list packages; // Load the files which are not configuration files from // the packages @@ -257,19 +267,18 @@ int main (int argc, char *argv[]) } // Now, we do a recursive copy of refserv into newserv umask (0); - mkdir (newserv.c_str(),0755); // Check if it is on the same volume struct stat refst,newst; - if (vutil_lstat(refserv,refst)!=-1 - && vutil_lstat(newserv,newst)!=1){ + if (vutil_lstat(refserv.getVdir().c_str(),refst)!=-1 + && vutil_lstat(newserv.getVdir().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.c_str(),refserv.c_str()); + fprintf (stderr,"Can't vbuild %s because it is not on the same volume as %s\n", + newserv.getVdir().c_str(),refserv.getVdir().c_str()); }else{ stats.nbdir = stats.nblink = stats.nbcopy = stats.nbsymlink = 0; stats.nbspc = 0; stats.size_copy = 0; - ret = vbuild_copy (refserv,newserv,refst.st_dev,"",files); + ret = vbuild_copy (refserv.getVdir(),newserv.getVdir(),refst.st_dev,"",files); if (statistics){ printf ("Directory created: %d\n",stats.nbdir); printf ("Files copied : %d\n",stats.nbcopy);