index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Aurelien Foret <aurelien@archlinux.org> | 2005-03-29 21:15:15 +0000 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2005-03-29 21:15:15 +0000 |
commit | 3bbfdf4ce8d47f05006e5c62bbb71432b1ae67e3 (patch) | |
tree | fc8ec8f9fea68d48c653dc79d626f23d6a80fe5a | |
parent | 425a6c64489d3be253dbf58a0e7c1344f04f5a4d (diff) |
-rw-r--r-- | lib/libalpm/util.c | 12 |
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 29e39d30..73bab264 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -354,8 +354,7 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha char tmpdir[PATH_MAX] = ""; char *scriptpath; struct stat buf; - - return(0); + char cwd[PATH_MAX]; if(stat(installfn, &buf)) { /* not found */ @@ -367,7 +366,7 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha if(stat(tmpdir, &buf)) { _alpm_makepath(tmpdir); } - snprintf(tmpdir, PATH_MAX, "%stmp/pacman-XXXXXX", root); + snprintf(tmpdir, PATH_MAX, "%stmp/alpm_XXXXXX", root); if(mkdtemp(tmpdir) == NULL) { _alpm_log(PM_LOG_ERROR, "could not create temp directory"); return(1); @@ -391,6 +390,11 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha return(0); } + /* save the cwd so we can restore it later */ + getcwd(cwd, PATH_MAX); + /* just in case our cwd was removed in the upgrade operation */ + chdir("/"); + _alpm_log(PM_LOG_FLOW2, "executing %s script...", script); if(oldver) { snprintf(cmdline, PATH_MAX, "echo \"umask 0022; source %s %s %s %s\" | chroot %s /bin/sh", @@ -405,6 +409,8 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha if(strlen(tmpdir) && _alpm_rmrf(tmpdir)) { _alpm_log(PM_LOG_WARNING, "could not remove tmpdir %s", tmpdir); } + + chdir(cwd); return(0); } |