Fail loudly is scriptlets cannot be run via /bin/sh

If /bin/sh is missing in the root directory, scriptlets cannot be executed, as
we're explicitly calling it.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
This commit is contained in:
Aaron Griffin 2007-10-04 21:36:25 -05:00
parent 98bcd1f5b1
commit 4853a4aad9
1 changed files with 7 additions and 0 deletions

View File

@ -552,6 +552,13 @@ int _alpm_runscriptlet(const char *root, const char *installfn,
return(0);
}
snprintf(tmpdir, PATH_MAX, "%sbin/sh", root);
if(stat(tmpdir, &buf)) {
/* not found */
_alpm_log(PM_LOG_ERROR, _("No /bin/sh in root dir (%s), aborting scriptlet\n"), root);
return(0);
}
if(!strcmp(script, "pre_upgrade") || !strcmp(script, "pre_install")) {
snprintf(tmpdir, PATH_MAX, "%stmp/", root);
if(stat(tmpdir, &buf)) {