summaryrefslogtreecommitdiffhomepage
path: root/src/logic
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2021-03-21 07:46:57 +0000
committermidipix <writeonce@midipix.org>2021-03-21 07:48:06 +0000
commit430840c04ba2ae086226e2ba68966a16894b3fd2 (patch)
treea55a5ae1bba6c960b52b418ffe0fb0097338ab70 /src/logic
parentf23d994965845536db0e6b21fc9c65091184b3f5 (diff)
downloadslibtool-430840c04ba2ae086226e2ba68966a16894b3fd2.tar.bz2
slibtool-430840c04ba2ae086226e2ba68966a16894b3fd2.tar.xz
slbt_exec_install(): support wrapping of /path/to/sh /path/to/install-sh.
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/slbt_exec_install.c19
1 files 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];