/* either extract or copy the scriptlet */
@@ -317,14 +314,14 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn,
goto cleanup;
}
- /* chop off the root so we can find the tmpdir in the chroot */
- scriptpath = scriptfn + strlen(handle->root) - 1;
-
if(!grep(scriptfn, script)) {
/* script not found in scriptlet file */
goto cleanup;
}
+ /* chop off the root so we can find the tmpdir in the chroot */
+ scriptpath = scriptfn + strlen(handle->root) - 1;
+
if(oldver) {
snprintf(cmdline, PATH_MAX, ". %s; %s %s %s",
scriptpath, script, ver, oldver);
@@ -338,7 +335,7 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn,
retval = _alpm_run_chroot(handle, "/bin/sh", argv);