Fix @exec/post-install script execution with pkg register -i [1]

Fix MTREE not properly being extracted with pkg register -i [2]

Reported by:	garga [1]
		bdrewery [2]
This commit is contained in:
Baptiste Daroussin 2013-09-24 12:26:43 +00:00
parent eb6071c811
commit 93fdaf74af
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=328121
4 changed files with 55 additions and 1 deletions

View file

@ -2,7 +2,7 @@
PORTNAME= pkg
DISTVERSION= 1.1.4
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= ports-mgmt
MASTER_SITES= http://files.etoilebsd.net/pkg/ \
http://mirror.shatow.net/freebsd/${PORTNAME}/ \

View file

@ -0,0 +1,35 @@
--- ./libpkg/pkg.c.orig 2013-09-24 14:53:00.000000000 +0200
+++ ./libpkg/pkg.c 2013-09-24 14:58:33.000000000 +0200
@@ -1181,6 +1181,20 @@
struct pkg_dir *dir = NULL;
char spath[MAXPATHLEN + 1];
char dpath[MAXPATHLEN + 1];
+ bool disable_mtree;
+ const char *prefix;
+ char *mtree;
+
+ pkg_config_bool(PKG_CONFIG_DISABLE_MTREE, &disable_mtree);
+ if (!disable_mtree) {
+ pkg_get(pkg, PKG_PREFIX, &prefix, PKG_MTREE, &mtree);
+ do_extract_mtree(mtree, prefix);
+ }
+
+ /*
+ * Execute pre-install scripts
+ */
+ pkg_script_run(pkg, PKG_SCRIPT_PRE_INSTALL);
if (packing_init(&pack, dest, 0) != EPKG_OK) {
/* TODO */
@@ -1200,6 +1214,11 @@
}
+ /*
+ * Execute post install scripts
+ */
+ pkg_script_run(pkg, PKG_SCRIPT_POST_INSTALL);
+
return (packing_finish(pack));
}

View file

@ -0,0 +1,11 @@
--- libpkg/pkg_add.c.orig 2013-07-06 12:48:19.000000000 +0200
+++ libpkg/pkg_add.c 2013-09-24 14:22:38.561062335 +0200
@@ -100,7 +100,7 @@
return (retcode);
}
-static int
+int
do_extract_mtree(char *mtree, const char *prefix)
{
struct archive *a = NULL;

View file

@ -0,0 +1,8 @@
--- ./libpkg/private/pkg.h.orig 2013-09-24 14:56:39.000000000 +0200
+++ ./libpkg/private/pkg.h 2013-09-24 14:57:23.000000000 +0200
@@ -405,4 +405,5 @@
int pkg_emit_filelist(struct pkg *, FILE *);
int pkg_parse_manifest_archive(struct pkg *pkg, struct archive *a, struct pkg_manifest_key *keys);
+int do_extract_mtree(char *mtree, const char *prefix);
#endif