]> git.proxmox.com Git - vzctl.git/blame - debian/patches/allow-abs-ostemplate-path.diff
update to vzctl 4.0
[vzctl.git] / debian / patches / allow-abs-ostemplate-path.diff
CommitLineData
49ee0bad
DM
1Index: new/src/lib/create.c
2===================================================================
508802f8
DM
3--- new.orig/src/lib/create.c 2012-09-28 09:05:45.000000000 +0200
4+++ new/src/lib/create.c 2012-09-28 09:57:03.000000000 +0200
5@@ -113,19 +113,25 @@
6 if (ploop && check_ploop_size(dq->diskspace[1]) < 0)
7 return VZ_DISKSPACE_NOT_SET;
8 find:
49ee0bad 9- for (i = 0; ext[i] != NULL; i++) {
211c83e2
DM
10- snprintf(tarball, sizeof(tarball), "%s/cache/%s.tar%s",
11- fs->tmpl, tmpl->ostmpl, ext[i]);
49ee0bad
DM
12- logger(1, 0, "Looking for %s", tarball);
13- if (stat_file(tarball))
14- break;
15- }
16- if (ext[i] == NULL) {
211c83e2
DM
17- if (download_template(tmpl->ostmpl) == 0)
18- goto find;
19- logger(-1, 0, "Cached OS template %s/cache/%s.tar%s not found",
20- fs->tmpl, tmpl->ostmpl, errmsg_ext);
49ee0bad 21- return VZ_OSTEMPLATE_NOT_FOUND;
508802f8 22+
211c83e2
DM
23+ if (tmpl->ostmpl[0] == '/' && stat_file(tmpl->ostmpl)) {
24+ snprintf(tarball, sizeof(tarball), "%s", tmpl->ostmpl);
49ee0bad 25+ } else {
211c83e2 26+
49ee0bad 27+ for (i = 0; ext[i] != NULL; i++) {
211c83e2
DM
28+ snprintf(tarball, sizeof(tarball), "%s/cache/%s.tar%s",
29+ fs->tmpl, tmpl->ostmpl, ext[i]);
49ee0bad
DM
30+ logger(1, 0, "Looking for %s", tarball);
31+ if (stat_file(tarball))
32+ break;
33+ }
34+ if (ext[i] == NULL) {
211c83e2
DM
35+ if (download_template(tmpl->ostmpl) == 0)
36+ goto find;
37+ logger(-1, 0, "Cached OS template %s/cache/%s.tar%s not found",
38+ fs->tmpl, tmpl->ostmpl, errmsg_ext);
49ee0bad
DM
39+ return VZ_OSTEMPLATE_NOT_FOUND;
40+ }
41 }
42 /* Lock CT area */
43 if (make_dir(fs->private, 0))
508802f8 44@@ -236,6 +242,7 @@
211c83e2 45 int ret = 0;
49ee0bad
DM
46 char src[STR_SIZE];
47 char dst[STR_SIZE];
48+ char *p;
49 const char *sample_config;
50 fs_param *fs = &vps_p->res.fs;
51 tmpl_param *tmpl = &vps_p->res.tmpl;
508802f8
DM
52@@ -364,6 +371,12 @@
53 vps_p->opt.layout,
54 vps_p->opt.mode)))
55 goto err_root;
49ee0bad 56+
211c83e2
DM
57+ if ((p = strrchr(tmpl->ostmpl, '/'))) {
58+ p = strdup(p + 1);
59+ free(tmpl->ostmpl);
60+ tmpl->ostmpl = p;
61+ }
62 }
63
64 if ((ret = vps_postcreate(veid, &vps_p->res)))