This new setting allows choosing a custom script interpreter used for the various tinc callbacks.
If none is specified, the script itself is called as executable (as before).
This is particularly useful when storing tinc configuration and script on a mount point with no-exec attribute.
int status, len;
char *scriptname;
int i;
int status, len;
char *scriptname;
int i;
+ char *aInterpreter = NULL;
#ifndef HAVE_MINGW
len = xasprintf(&scriptname, "\"%s/%s\"", confbase, name);
#ifndef HAVE_MINGW
len = xasprintf(&scriptname, "\"%s/%s\"", confbase, name);
free(scriptname);
return true;
}
free(scriptname);
return true;
}
+#endif
+
+ // Custom scripts interpreter
+ if(get_config_string(lookup_config(config_tree, "ScriptsInterpreter"), &aInterpreter))
- // Ugly hard-code allowing execution of scripts on android without execution flag (such as on /sdcard)
+ // Force custom scripts interpreter allowing execution of scripts on android without execution flag (such as on /sdcard)
- len = xasprintf(&scriptname, "/system/bin/sh \"%s/%s\"", confbase, name);
+ len = xasprintf(&scriptname, "%s \"%s/%s\"", aInterpreter, confbase, name);
ifdebug(STATUS) logger(LOG_INFO, "Executing script %s", name);
ifdebug(STATUS) logger(LOG_INFO, "Executing script %s", name);