From 430840c04ba2ae086226e2ba68966a16894b3fd2 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 21 Mar 2021 07:46:57 +0000 Subject: slbt_exec_install(): support wrapping of /path/to/sh /path/to/install-sh. --- src/logic/slbt_exec_install.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/logic/slbt_exec_install.c b/src/logic/slbt_exec_install.c index b8d3ee9..4a24b87 100644 --- a/src/logic/slbt_exec_install.c +++ b/src/logic/slbt_exec_install.c @@ -563,6 +563,9 @@ int slbt_exec_install( char ** iargv; char ** src; char ** dst; + char * slash; + char * optsh; + char * script; struct slbt_exec_ctx * actx; struct argv_meta * meta; struct argv_entry * entry; @@ -589,10 +592,16 @@ int slbt_exec_install( slbt_disable_placeholders(ectx); iargv = ectx->cargv; fdout = slbt_driver_fdout(dctx); + optsh = 0; + script = 0; /* work around non-conforming uses of --mode=install */ - if (!(strcmp(iargv[0],"/bin/sh")) || !strcmp(iargv[0],"/bin/bash")) - iargv++; + if (iargv[1] && (slash = strrchr(iargv[1],'/'))) { + if (!strcmp(++slash,"install-sh")) { + optsh = *iargv++; + script = *iargv; + } + } /* missing arguments? */ argv_optv_init(slbt_install_options,optv); @@ -620,6 +629,9 @@ int slbt_exec_install( dest = 0; last = 0; + if (optsh) + *argv++ = script; + *argv++ = iargv[0]; for (entry=meta->entries; entry->fopt || entry->arg; entry++) { @@ -679,6 +691,9 @@ int slbt_exec_install( /* install */ if (copy) { /* using alternate argument vector */ + if (optsh) + ectx->altv[0] = optsh; + ectx->argv = ectx->altv; ectx->program = ectx->altv[0]; -- cgit v1.2.3