Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37868119
en ru br
ALT Linux repositórios
S:7.0.83.5-alt1

Group :: Sistema/Configurações/Rede
RPM: vztt

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: vztt-7.0.83.5.patch
Download


 .gear/rules                                        |   2 +
 .../tags/77d01d55243d306fafa606188a9d286ff1e95b8a  |   6 +
 .gear/tags/list                                    |   1 +
 Makefile                                           |   2 +-
 etc/vztt.conf.in                                   |   2 +-
 include/template.h                                 |   3 +-
 include/util.h                                     |   4 -
 include/vzcommon.h                                 |   6 +-
 scripts/ovz-template-converter.in                  |  10 +-
 src/apt.c                                          |  50 +++----
 src/cache.c                                        |   1 +
 src/env_compat.c                                   |   6 -
 src/misc.c                                         |   2 +-
 src/modify.c                                       |   1 -
 src/pfcache.c                                      |   2 +-
 src/template.c                                     |  16 +-
 src/tmplset.c                                      |  19 ++-
 src/transaction.c                                  |  21 +--
 src/util.c                                         |  45 ------
 src/vztt.c                                         |   1 +
 src/yum.c                                          |  19 +--
 src/zypper.c                                       |   6 -
 targets.list                                       |   2 +
 vztt.spec                                          | 165 +++++++++++++++++++++
 24 files changed, 250 insertions(+), 142 deletions(-)
diff --git a/.gear/rules b/.gear/rules
new file mode 100644
index 0000000..26340af
--- /dev/null
+++ b/.gear/rules
@@ -0,0 +1,2 @@
+tar: v@version@:.
+diff: v@version@:. . name=@name@-@version@.patch
diff --git a/.gear/tags/77d01d55243d306fafa606188a9d286ff1e95b8a b/.gear/tags/77d01d55243d306fafa606188a9d286ff1e95b8a
new file mode 100644
index 0000000..b43689d
--- /dev/null
+++ b/.gear/tags/77d01d55243d306fafa606188a9d286ff1e95b8a
@@ -0,0 +1,6 @@
+object 714062f92464d46e41f3728239a201d08572faa8
+type commit
+tag v7.0.83.5
+tagger Apache <apache@kojihub.eng.sw.ru> 1649453105 +0300
+
+AUTO v7.0.83.5 tag
diff --git a/.gear/tags/list b/.gear/tags/list
new file mode 100644
index 0000000..f3302a5
--- /dev/null
+++ b/.gear/tags/list
@@ -0,0 +1 @@
+77d01d55243d306fafa606188a9d286ff1e95b8a v7.0.83.5
diff --git a/Makefile b/Makefile
index 2f41033..395a33a 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ MANDIR=$(DESTDIR)/usr/share/man
 MAN8DIR=$(MANDIR)/man8
 MAN5DIR=$(MANDIR)/man5
 CONFDIR=$(DESTDIR)/etc/vztt
-VZCONFDIR=$(DESTDIR)/vz/template/conf/vztt
+VZCONFDIR=$(DESTDIR)/var/lib/vz/template/conf/vztt
 INCDIR=$(DESTDIR)/usr/include/vz
 LIBEXECDIR=$(DESTDIR)/usr/libexec
 
diff --git a/etc/vztt.conf.in b/etc/vztt.conf.in
index 2516771..210a34c 100644
--- a/etc/vztt.conf.in
+++ b/etc/vztt.conf.in
@@ -33,5 +33,5 @@
 #ARCHIVE="lz4"
 
 # Attention: Do not add *_SERVER variable to this file. 
-# Use /vz/template/conf/vztt/url.map
+# Use /var/lib/vz/template/conf/vztt/url.map
 
diff --git a/include/template.h b/include/template.h
index 44d31e1..5b1ce4a 100644
--- a/include/template.h
+++ b/include/template.h
@@ -226,7 +226,8 @@ int app_tmpl_list_add(struct app_tmpl_list *ls, struct app_tmpl *tmpl);
 /* find app template with name <name> in list <ls> */
 struct app_tmpl_list_el *app_tmpl_list_find(
 		struct app_tmpl_list *ls, 
-		char *name);
+		char *name,
+		int need_reorder);
 
 /* remove element <el> from list <ls> and return pointer to previous elem
    This function does not free content */
diff --git a/include/util.h b/include/util.h
index 4d0ed14..7310380 100644
--- a/include/util.h
+++ b/include/util.h
@@ -322,10 +322,6 @@ int create_ve_layout(unsigned long velayout, char *ve_private);
 
 int create_veroot_unjump_checker(struct Transaction *pm, struct string_list *envs);
 
-int get_ploop_disk_stats(const char *ctid, struct vzctl_disk_stats *stats);
-
-int set_trusted(const char *ctid, const char *flag);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/vzcommon.h b/include/vzcommon.h
index 961d1b9..8d1181b 100644
--- a/include/vzcommon.h
+++ b/include/vzcommon.h
@@ -65,7 +65,7 @@
 
 /* TODO: defined in vzctl/libvzctl.h */
 #undef VZ_DIR
-#define VZ_DIR		"/vz/"
+#define VZ_DIR		"/var/lib/vz/"
 #define TEMPLATE_DIR	VZ_DIR "template/"
 
 #define PM_LIST_SUBDIR  "list/"
@@ -77,8 +77,8 @@
 #define MAXVERSIONLEN	100
 #define VZCTLPATH	"/dev/vzctl"
 #define VZCTL		"/usr/sbin/vzctl"
-#define VZ_PKGENV_DIR	"/vz/pkgenv/"
-#define VZ_TMP_DIR	"/vz/tmp/"
+#define VZ_PKGENV_DIR	"/var/lib/vz/pkgenv/"
+#define VZ_TMP_DIR	"/var/lib/vz/tmp/"
 #define TAR		"tar"
 #define PRL_COMPRESS	"prlcompress"
 #define PRL_COMPRESS_FP	"/bin/" PRL_COMPRESS
diff --git a/scripts/ovz-template-converter.in b/scripts/ovz-template-converter.in
index 973d4a3..aaf1b3c 100755
--- a/scripts/ovz-template-converter.in
+++ b/scripts/ovz-template-converter.in
@@ -95,6 +95,8 @@ if (not len(templateinfo) in (3, 4)):
     print("Error: Incorrect template file format", args.template, "(should be distribution-version-arch[-setname].tar.gz)")
     sys.exit(73)
 
+dist = templateinfo[0]
+
 arch = templateinfo[2]
 if arch != "x86_64" and arch != "x86":
     print("Error: Incorrect architecture or template file format", args.template, "(should be distribution-version-arch[-setname].tar.gz)")
@@ -194,7 +196,7 @@ except:
     print("Error: Failed to create cache file tarball")
     sys.exit(73)
 try:
-    subprocess.call(["lz4", "-1", tarpath, lz4path], **kwargs)
+    subprocess.call(["lz4", "-9", tarpath, lz4path], **kwargs)
 except:
     print("Error: Failed to LZ4-compress cache file tarball")
     sys.exit(73)
@@ -226,4 +228,8 @@ if (not os.path.exists(defaultconfpath)):
 
 package_manager_file = ''.join([defaultconfpath, "/", "package_manager"])
 if (not os.path.exists(package_manager_file)):
-    writeconfig(package_manager_file, '')
+    writeconfig(package_manager_file, 'rpm')
+
+distribution_file = ''.join([defaultconfpath, "/", "distribution"])
+if (not os.path.exists(distribution_file)):
+    writeconfig(distribution_file, dist)
diff --git a/src/apt.c b/src/apt.c
index a48a10b..03c170f 100644
--- a/src/apt.c
+++ b/src/apt.c
@@ -694,8 +694,7 @@ static int apt_run(
 		struct AptTransaction *apt,
 		const char *cmd, \
 		const char *action, \
-		struct string_list *packages,
-		const char *ctid)
+		struct string_list *packages)
 {
 	int rc;
 	struct string_list args;
@@ -734,22 +733,20 @@ static int apt_run(
 
 	/* add proxy in environments */
 	if ((rc = add_proxy_env(&apt->http_proxy, HTTP_PROXY, &envs)))
-		goto cleanup;
+		return rc;
 	if ((rc = add_proxy_env(&apt->ftp_proxy, FTP_PROXY, &envs)))
-		goto cleanup;
+		return rc;
 	if ((rc = add_proxy_env(&apt->https_proxy, HTTPS_PROXY, &envs)))
-		goto cleanup;
+		return rc;
 
 	/* add templates environments too */
 	if ((rc = add_tmpl_envs(apt->tdata, &envs)))
-		goto cleanup;
-
-	if (!EMPTY_CTID(ctid))
-		set_trusted(ctid, "1");
+		return rc;
 
 	/* run cmd from chroot environment */
-	rc = run_from_chroot((char *)cmd, apt->envdir, apt->debug, \
-			apt->ign_pm_err, &args, &envs, apt->osrelease);
+	if ((rc = run_from_chroot((char *)cmd, apt->envdir, apt->debug, \
+			apt->ign_pm_err, &args, &envs, apt->osrelease)))
+		return rc;
 
 	apt_remove_config(apt);
 
@@ -757,30 +754,21 @@ static int apt_run(
 	string_list_clean(&args);
 	string_list_clean(&envs);
 
-cleanup:
-	if (!EMPTY_CTID(ctid))
-		set_trusted(ctid, "0");
-	return rc;
+	return 0;
 }
 
 /* run dpkg command */
-static int dpkg_run(struct AptTransaction *apt, char *cmd, struct string_list *args, const char* ctid)
+static int dpkg_run(struct AptTransaction *apt, char *cmd, struct string_list *args)
 {
 	int rc;
 	struct string_list envs;
 
 	string_list_init(&envs);
 
-	if (!EMPTY_CTID(ctid))
-		set_trusted(ctid, "1");
-
 	/* run cmd from chroot environment */
 	rc = run_from_chroot(cmd, apt->envdir, apt->debug, 
 		apt->ign_pm_err, args, &envs, apt->osrelease);
 
-	if (!EMPTY_CTID(ctid))
-		set_trusted(ctid, "0");
-
 	return rc;
 }
 
@@ -805,7 +793,7 @@ int apt_update_metadata(struct Transaction *pm, const char *name)
 	will created in template area */
 	pm->data_source = OPT_DATASOURCE_REMOTE;
 	string_list_add(&apt->options, "APT::Get::List-Cleanup=false");
-	rc = apt_run(apt, APT_GET_BIN, "update", NULL, pm->ctid);
+	rc = apt_run(apt, APT_GET_BIN, "update", NULL);
 	pm->data_source = data_source;
 	if (rc)
 		return rc;
@@ -824,7 +812,7 @@ int apt_update_metadata(struct Transaction *pm, const char *name)
 
 	/* get full packages list and update metadata */
 	pm->data_source = OPT_DATASOURCE_REMOTE;
-	rc = apt_run(apt, APT_CACHE_BIN, "pkgnames", NULL, pm->ctid);
+	rc = apt_run(apt, APT_CACHE_BIN, "pkgnames", NULL);
 	pm->data_source = data_source;
 	if (rc)
 		return rc;
@@ -995,7 +983,7 @@ int apt_action(
 
 	progress(progress_stage, 0, apt->progress_fd);
 
-	rc = apt_run(apt, bin, cmd, packages, pm->ctid);
+	rc = apt_run(apt, bin, cmd, packages);
 
 	progress(progress_stage, 100, apt->progress_fd);
 
@@ -1766,7 +1754,7 @@ int apt_create_init_cache(
 	string_list_add(&apt->dpkg_options, "--force-overwrite");
 	string_list_add(&apt->dpkg_options, "--force-downgrade");
 	apt->download_only = 1;
-	if ((rc = apt_run(apt, APT_GET_BIN, "install", &ls, pm->ctid)))
+	if ((rc = apt_run(apt, APT_GET_BIN, "install", &ls)))
 		return rc;
 	apt->download_only = 0;
 	string_list_clean(&pm->options);
@@ -1805,7 +1793,7 @@ int apt_create_init_cache(
 		apt_get_pkg_dirname(pkg, buf+strlen(buf), sizeof(buf)-strlen(buf));
 		strncat(buf, DEB_EXT, sizeof(buf)-strlen(buf)-1);
 		string_list_add(&opts, buf);
-		if ((rc = dpkg_run(apt, DPKG_BIN, &opts, pm->ctid)))
+		if ((rc = dpkg_run(apt, DPKG_BIN, &opts)))
 			goto cleanup;
 	}
 	progress(PROGRESS_PKGMAN_INST_PACKAGES1, 100, pm->progress_fd);
@@ -1834,7 +1822,7 @@ int apt_create_init_cache(
 
 		strncat(buf, DEB_EXT, sizeof(buf)-strlen(buf)-1);
 		string_list_add(&opts, buf);
-		if ((rc = dpkg_run(apt, DPKG_BIN, &opts, pm->ctid)))
+		if ((rc = dpkg_run(apt, DPKG_BIN, &opts)))
 			goto cleanup;
 	}
 
@@ -1924,7 +1912,7 @@ int apt_create_post_init_cache(
 			strncat(path, DEB_EXT, sizeof(path)-strlen(path)-1);
 			string_list_add(&opts, path);
 		}
-		if ((rc = dpkg_run(apt, DPKG_BIN, &opts, pm->ctid)))
+		if ((rc = dpkg_run(apt, DPKG_BIN, &opts)))
 			goto cleanup;
 	}
 
@@ -1961,7 +1949,7 @@ int apt_create_post_init_cache(
 	}
 
 	if (string_list_size(packages1)) {
-		if ((rc = dpkg_run(apt, DPKG_BIN, &opts, pm->ctid)))
+		if ((rc = dpkg_run(apt, DPKG_BIN, &opts)))
 			goto cleanup;
 
 		snprintf(cmd, sizeof(cmd), \
@@ -2364,7 +2352,7 @@ int apt_last_repair_fetch(
 	data_source = pm->data_source;
 	pm->data_source = OPT_DATASOURCE_REMOTE;
 	string_list_add(&pm->options, "APT::Get::List-Cleanup=false");
-	rc = apt_run(apt, APT_GET_BIN, "update", NULL, pm->ctid);
+	rc = apt_run(apt, APT_GET_BIN, "update", NULL);
 	string_list_clean(&pm->options);
 	pm->data_source = data_source;
 	if (rc)
diff --git a/src/cache.c b/src/cache.c
index b2250bd..d495e6c 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -41,6 +41,7 @@
 #include <utime.h>
 #include <asm/unistd.h>
 #include <sys/mount.h>
+#include <sys/sysmacros.h>
 
 #include <vzctl/libvzctl.h>
 #include <vzctl/vzerror.h>
diff --git a/src/env_compat.c b/src/env_compat.c
index 92c763a..464470d 100644
--- a/src/env_compat.c
+++ b/src/env_compat.c
@@ -755,16 +755,10 @@ static int remove_pkg_byrpm(struct Transaction *pm,
 	if ((rc = add_tmpl_envs(pm->tdata, &envs)))
 		return rc;
 
-	if (!EMPTY_CTID(pm->ctid))
-		set_trusted(pm->ctid, "1");
-
 	/* run cmd from chroot environment */
 	rc = run_from_chroot("/usr/lib/rpm/rpmi", pm->envdir, pm->debug,
 			pm->ign_pm_err, &args, &envs, pm->osrelease);
 
-	if (!EMPTY_CTID(pm->ctid))
-		set_trusted(pm->ctid, "0");
-
 	/* free mem */
 	string_list_clean(&args);
 	string_list_clean(&envs);
diff --git a/src/misc.c b/src/misc.c
index 74473c5..aefa8b2 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1662,7 +1662,7 @@ int vztt2_remove_app_template(char *app, struct options_vztt *opts_vztt)
 		goto cleanup_0;
 
 	/* check that this template really exist */
-	if ((a = app_tmpl_list_find(&tmpl->avail_apps, app)) == NULL) {
+	if ((a = app_tmpl_list_find(&tmpl->avail_apps, app, 0)) == NULL) {
 		vztt_logger(0, 0, "EZ apptemplate %s for %s does not exist", \
 			app, opts_vztt->for_obj);
 		rc = VZT_TMPL_NOT_EXIST;
diff --git a/src/modify.c b/src/modify.c
index a3ea3bb..24b4950 100644
--- a/src/modify.c
+++ b/src/modify.c
@@ -174,7 +174,6 @@ static int cmd_modify(
 	if ((rc = tmpl_lock(&gc, tmpl->base, 
 			LOCK_READ, opts_vztt->flags, &lockdata)))
 		goto cleanup_3;
-
 	switch(cmd) {
 		case VZPKG_INSTALL:
 			/* Install packages into VE */
diff --git a/src/pfcache.c b/src/pfcache.c
index f2ef18b..7d8dc16 100644
--- a/src/pfcache.c
+++ b/src/pfcache.c
@@ -33,7 +33,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/param.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
 #include <dirent.h>
 #include <error.h>
 #include <limits.h>
diff --git a/src/template.c b/src/template.c
index ac4cb20..b5b7042 100644
--- a/src/template.c
+++ b/src/template.c
@@ -921,13 +921,25 @@ int app_tmpl_list_add(struct app_tmpl_list *ls, struct app_tmpl *tmpl)
 /* find app template with name <name> in list <ls> */
 struct app_tmpl_list_el *app_tmpl_list_find(
 		struct app_tmpl_list *ls, 
-		char *name)
+		char *name,
+		int need_reorder)
 {
 	struct app_tmpl_list_el *p;
 
 	for (p = ls->tqh_first; p != NULL; p = p->e.tqe_next) {
-		if (strcmp(name, p->tmpl->name) == 0)
+		if (strcmp(name, p->tmpl->name) == 0) {
+			/* Move found template to the end of the queue.
+			   This will bring the list of templates to the same
+			   order as order of cmdline arguments.
+			   So e.g. scripts of templates will be launched in the
+			   same order as templates are listed in the cmdline
+			*/
+			if (need_reorder == 1) {
+				TAILQ_REMOVE(ls, p, e);
+				TAILQ_INSERT_TAIL(ls, p, e);
+			}
 			return p;
+		}
 	}
 	return NULL;
 }
diff --git a/src/tmplset.c b/src/tmplset.c
index 7fd599d..9447c94 100644
--- a/src/tmplset.c
+++ b/src/tmplset.c
@@ -751,7 +751,7 @@ int tmplset_init(
 
 	string_list_init(&tmpls);
 	string_list_for_each(apps, p) {
-		a = app_tmpl_list_find(&(*tmpl)->avail_apps, p->s);
+		a = app_tmpl_list_find(&(*tmpl)->avail_apps, p->s, 0);
 		if (a == NULL) {
 			not_found = 1;
 			string_list_add(&tmpls, p->s);
@@ -780,7 +780,7 @@ int tmplset_init(
             /* find available apps in <apps> and
             copy to used apps list in success*/
             string_list_for_each(apps, p) {
-                    a = app_tmpl_list_find(&(*tmpl)->avail_apps, p->s);
+                    a = app_tmpl_list_find(&(*tmpl)->avail_apps, p->s, 0);
                     if (a == NULL) {
                             vztt_logger(0, 0, "App template %s not found", p->s);
                             rc = VZT_TMPL_NOT_EXIST;
@@ -913,7 +913,14 @@ int tmplset_mark(
 		return 0;
 	}
 
+	struct string_list found;
+	string_list_init(&found);
+
 	string_list_for_each(ls, p) {
+		if (string_list_find(&found, p->s)) {
+			continue;
+		}
+		string_list_add(&found, p->s);
 		if (mask & TMPLSET_MARK_OS) {
 			if (strcmp(t->os->name, p->s) == 0)
 				t->os->marker = 1;
@@ -925,13 +932,13 @@ int tmplset_mark(
 			}
 		}
 		if (mask & TMPLSET_MARK_AVAIL_APP_LIST) {
-			if ((a = app_tmpl_list_find(&t->avail_apps, p->s))) {
+			if ((a = app_tmpl_list_find(&t->avail_apps, p->s, 1))) {
 				a->tmpl->marker = 1;
 				continue;
 			}
 		}
 		if (mask & TMPLSET_MARK_USED_APP_LIST) {
-			if ((a = app_tmpl_list_find(&t->used_apps, p->s))) {
+			if ((a = app_tmpl_list_find(&t->used_apps, p->s, 1))) {
 				a->tmpl->marker = 1;
 				continue;
 			}
@@ -1702,7 +1709,7 @@ int tmplset_find_upgrade(
 			   in packages mode */
 			continue;
 		}
-		d = app_tmpl_list_find(&(*dst)->avail_apps, s->tmpl->name);
+		d = app_tmpl_list_find(&(*dst)->avail_apps, s->tmpl->name, 0);
 		if (d != NULL) {
 			rc = app_tmpl_list_add(&(*dst)->used_apps, d->tmpl);
 			if (rc)
@@ -1823,7 +1830,7 @@ int tmplset_check_for_update(
 			if (strcmp(t->os->name, s->s) == 0)
 				continue;
 		}
-		if (app_tmpl_list_find(&t->used_apps, s->s) == NULL) {
+		if (app_tmpl_list_find(&t->used_apps, s->s, 0) == NULL) {
 			if (rc == 0)
 				vztt_logger(0, 0, "Template(s) "\
 					"does not installed into CT:");
diff --git a/src/transaction.c b/src/transaction.c
index 2f7c05f..e85157d 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -469,7 +469,6 @@ int add_tmpl_envs(
 	return rc;
 }
 
-#define VIRT_OSRELEASE "/proc/sys/kernel/virt_osrelease"
 #define K_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
 #define OSRELEASE_SIZE 10
 #define STACK_SIZE 2 * 4096
@@ -538,7 +537,7 @@ static int run_clone(void *data)
 {
 	struct clone_params *params;
 	char osrelease[OSRELEASE_SIZE] = "";
-	int dir_fd, fd, osrelease_fd;
+	int dir_fd, fd;
 	int rc = 0;
 
 	params = data;
@@ -547,24 +546,6 @@ static int run_clone(void *data)
 		if ((rc = change_osrelease(params->osrelease, osrelease, OSRELEASE_SIZE)))
 			return rc;
 
-	/* Apply the osrelease hack */
-	if (osrelease[0] != '\0')
-	{
-		if ((osrelease_fd = open(VIRT_OSRELEASE,
-			O_RDWR | O_TRUNC)) < 0) {
-			vztt_logger(-1, errno, "Can't open " VIRT_OSRELEASE);
-			return VZT_CANT_OPEN;
-		}
-		if ((write(osrelease_fd, osrelease,
-			strlen(osrelease))) <= 0)
-		{
-			vztt_logger(-1, errno, "Can't write to " VIRT_OSRELEASE);
-			close(osrelease_fd);
-			return VZT_CANT_WRITE;
-		}
-		close(osrelease_fd);
-	}
-
 	/* open /dev/null in root, because of it is absent in environments */
 	fd = open("/dev/null", O_WRONLY);
 
diff --git a/src/util.c b/src/util.c
index c6a14d0..7666cd9 100644
--- a/src/util.c
+++ b/src/util.c
@@ -2178,48 +2178,3 @@ int create_veroot_unjump_checker(struct Transaction *pm, struct string_list *env
 
 	return rc;
 }
-
-int get_ploop_disk_stats(const char *ctid, struct vzctl_disk_stats *stats) {
-	int rc = 0, err;
-	struct vzctl_env_handle *h;
-
-	h = vzctl2_env_open(ctid, VZCTL_CONF_SKIP_NON_EXISTS, &err);
-	if (h == NULL) {
-		vztt_logger(0, 0, "vzctl2_env_open %s: %s",
-				ctid, vzctl2_get_last_error());
-		return VZT_CANT_LOCK;
-	}
-
-	rc = vzctl2_env_get_disk_stats(h, "{00000000-0000-0000-0000-000000000000}", stats, sizeof(*stats));
-
-	vzctl2_env_close(h);
-
-	return rc;
-}
-
-int set_trusted(const char *ctid, const char *flag) {
-	int rc = 0, fd = 0;
-	struct vzctl_disk_stats st = {};
-	char buf[PATH_MAX];
-
-	if ((rc = get_ploop_disk_stats(ctid, &st)))
-		return vztt_error(VZT_PLOOP_ERROR, rc, "Failed to get ploop stats");
-
-	snprintf(buf, sizeof(buf), "/sys/devices/virtual/block/%s/ptune/trusted", st.device + 5);
-
-	if ((fd = open(buf, O_WRONLY)) == -1) {
-		rc = VZT_PLOOP_ERROR;
-		vztt_logger(2, errno, "Can't open ploop trusted %s", buf);
-		goto cleanup;
-	}
-
-	if (write(fd, flag, 1) == -1) {
-		rc = VZT_PLOOP_ERROR;
-		vztt_logger(2, errno, "Can't write ploop trusted %s", buf);
-	}
-
-cleanup:
-	if (fd)
-		close(fd);
-	return rc;
-}
diff --git a/src/vztt.c b/src/vztt.c
index b56d874..435a859 100644
--- a/src/vztt.c
+++ b/src/vztt.c
@@ -1555,6 +1555,7 @@ int main(int argc, char **argv)
 		}
 		break;
 	case VZTT_CMD_UPDATE_CACHE:
+		opts_vztt->flags |= OPT_VZTT_UPDATE_CACHE;
 		if (argc == ind) {
 			/* for all base OS template */
 			if ((rc = vztt_get_all_base(&base_os)))
diff --git a/src/yum.c b/src/yum.c
index 82a4a5a..42460a7 100644
--- a/src/yum.c
+++ b/src/yum.c
@@ -485,7 +485,6 @@ static int yum_run(
 		string_list_add(&args, "--vps");
 		snprintf(buf, sizeof(buf), "%s", yum->ctid);
 		string_list_add(&args, buf);
-		set_trusted(yum->ctid, "1");
 	}
 	if (action == VZPKG_GET) {
 		string_list_add(&args, "--not-resolve");
@@ -656,21 +655,22 @@ static int yum_run(
 
 	/* add proxy in environments */
 	if ((rc = add_proxy_env(&yum->http_proxy, HTTP_PROXY, &envs)))
-		goto cleanup;
+		return rc;
 	if ((rc = add_proxy_env(&yum->ftp_proxy, FTP_PROXY, &envs)))
-		goto cleanup;
+		return rc;
 	if ((rc = add_proxy_env(&yum->https_proxy, HTTPS_PROXY, &envs)))
-		goto cleanup;
+		return rc;
 
 	/* add templates environments too */
 	if ((rc = add_tmpl_envs(yum->tdata, &envs)))
-		goto cleanup;
+		return rc;
 
 	progress(progress_stage, 0, yum->progress_fd);
 
 	/* run cmd from chroot environment */
-	rc = run_from_chroot(cmd, yum->envdir, yum->debug,
-			yum->ign_pm_err, &args, &envs, yum->osrelease);
+	if ((rc = run_from_chroot(cmd, yum->envdir, yum->debug,
+			yum->ign_pm_err, &args, &envs, yum->osrelease)))
+		return rc;
 
 	yum_remove_config(yum);
 
@@ -680,10 +680,7 @@ static int yum_run(
 
 	progress(progress_stage, 100, yum->progress_fd);
 
-cleanup:
-	if (!EMPTY_CTID(yum->ctid))
-		set_trusted(yum->ctid, "0");
-	return rc;
+	return 0;
 }
 
 /* run yum transaction */
diff --git a/src/zypper.c b/src/zypper.c
index 5b3fb9e..540afaf 100644
--- a/src/zypper.c
+++ b/src/zypper.c
@@ -643,16 +643,10 @@ static int zypper_run(
 
 	progress(progress_stage, 0, zypper->progress_fd);
 
-	if (!EMPTY_CTID(zypper->ctid))
-		set_trusted(zypper->ctid, "1");
-
 	/* run cmd from chroot environment */
 	rc = run_from_chroot(cmd, zypper->envdir, zypper->debug,
 			zypper->ign_pm_err, &args, &envs, zypper->osrelease);
 
-	if (!EMPTY_CTID(zypper->ctid))
-		set_trusted(zypper->ctid, "0");
-
 	// Save the generated zypp.log on the high debug level
 	if (zypper->debug > 5) {
 		snprintf(buf, sizeof(buf), "%s/zypp.log", zypper->tmpdir);
diff --git a/targets.list b/targets.list
new file mode 100644
index 0000000..ae53470
--- /dev/null
+++ b/targets.list
@@ -0,0 +1,2 @@
+vztt dist-vz7-u16
+vztt dist-vz8-alpha
diff --git a/vztt.spec b/vztt.spec
new file mode 100644
index 0000000..9eff952
--- /dev/null
+++ b/vztt.spec
@@ -0,0 +1,165 @@
+
+%define _libexecdir /usr/libexec
+%define confdir /etc/vztt
+%define vztempldir /var/lib/vz/template
+%define vzconfdir %vztempldir/conf/%name
+%define vztt_conf %confdir/vztt.conf
+%define nojquota_conf %confdir/nojquota.conf
+%define url_map %vzconfdir/url.map
+%define url_map_link %confdir/url.map
+%define vztmp /var/lib/vz/tmp
+%define tmp_url_map %vztmp/tmp_url_map
+%define tmp_vztt_conf %vztmp/tmp_vztt_conf
+%add_python3_path %_libexecdir
+
+Name: vztt
+Version: 7.0.83.5
+Release: alt1
+Summary: OpenVZ EZ template management tools
+Source: %name-%version.tar
+Patch: %name-%version.patch
+License: GPLv2
+Group: System/Configuration/Other
+Url: https://openvz.org/
+Vcs: https://src.openvz.org/scm/ovzl/vztt.git
+
+Packager: Andrew A. Vasilyev <andy@altlinux.org>
+
+ExclusiveArch: x86_64
+
+Requires: lib%name = %version-%release
+Requires: libploop >= 6.1.0
+Requires: attr
+Requires: vztt_checker
+Requires: lz4 gzip tar
+Requires: e2fsprogs
+Requires: python3-module-configobj
+
+BuildRequires(pre): rpm-build-python3
+BuildRequires: libattr-devel
+BuildRequires: glibc-devel-static
+BuildRequires: libuuid-devel
+BuildRequires: libploop-devel >= 6.1.0
+BuildRequires: libvzctl-devel >= 7.0.16
+BuildRequires: libe2fs-devel
+
+%description
+OpenVZ EZ template management tools are used for software installation
+inside Containers.
+
+%package -n lib%name
+Summary: OpenVZ EZ template management API library
+Group: System/Libraries
+License: GPLv2 or LGPLv2.1
+
+%description -n lib%name
+OpenVZ EZ template management API library
+
+%package -n lib%name-devel
+Summary: OpenVZ EZ template management API development library
+Group: Development/C
+License: GPLv2 or LGPLv2.1
+Requires: lib%name = %version-%release
+
+%description -n lib%name-devel
+OpenVZ EZ template management library and include files
+
+%prep
+%setup
+%patch -p1
+
+%build
+%make_build CFLAGS="%optflags"
+
+%install
+%makeinstall_std LIBDIR=%buildroot%_libdir
+
+# create logrotate config
+mkdir -p %buildroot%_logrotatedir
+echo "/var/log/vztt.log {
+        compress
+        missingok
+}" > %buildroot%_logrotatedir/vztt
+rm -f %buildroot%_libdir/lib%name.a
+
+%files
+%_sbindir/vzpkg
+%dir %_libdir/%name
+%_libdir/%name/myinit
+%_man8dir/vzpkg.8.*
+%dir %confdir
+%dir %vztempldir
+%dir %vztempldir/conf
+%dir %vzconfdir
+%config(noreplace) %vztt_conf
+%config(noreplace) %nojquota_conf
+%config(noreplace) %url_map
+%url_map_link
+%config(noreplace) %_logrotatedir/vztt
+%_libexecdir/*
+
+%files -n lib%name
+%_libdir/lib%name.so.*
+
+%files -n lib%name-devel
+%_includedir/vz/*.h
+%_libdir/lib%name.so
+
+%changelog
+* Mon Apr 11 2022 Andrew A. Vasilyev <andy@altlinux.org> 7.0.83.5-alt1
+- 7.0.83.5
+
+* Tue Dec 21 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.83.3-alt1
+- 7.0.83.3
+
+* Tue May 04 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.80-alt2
+- BR: +rpm-build-python3
+
+* Thu Apr 08 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.80-alt1
+- 7.0.80
+
+* Fri Feb 26 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.76-alt1
+- 7.0.76
+
+* Wed Jan 20 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.73-alt2
+- add simfs template creation
+
+* Mon Aug 03 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.73-alt1
+- 7.0.73
+
+* Mon Apr 20 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.71-alt1
+- 7.0.71
+
+* Wed Apr 15 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.69-alt1
+- 7.0.69
+
+* Tue Nov 12 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.68-alt1
+- 7.0.68
+
+* Fri Nov 01 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.67-alt1
+- 7.0.67
+
+* Fri Oct 11 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.66-alt1
+- 7.0.66
+
+* Tue Oct 01 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.65-alt5
+- convert to python3
+
+* Thu Sep 12 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.65-alt4
+- spec cleanup
+
+* Thu Sep 12 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.65-alt3
+- add distribution name to config in template converter
+
+* Fri Aug 23 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.65-alt2
+- remove static lib
+- package_manager file should not be empty
+
+* Mon Aug 19 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.65-alt1
+- 7.0.65
+
+* Sun Nov 04 2018 Alexey Shabalin <shaba@altlinux.org> 7.0.60-alt1
+- 7.0.60
+
+* Mon Feb 26 2018 Alexey Shabalin <shaba@altlinux.ru> 7.0.57-alt1
+- initial build for ALT
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009