]>
Commit | Line | Data |
---|---|---|
f57c332f | 1 | /* |
31324d15 | 2 | * Copyright (c) 2000, 2001 Red Hat, Inc. |
f57c332f DD |
3 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * A copy of the GNU General Public License can be found at | |
10 | * http://www.gnu.org/ | |
11 | * | |
12 | * Written by DJ Delorie <dj@cygnus.com> | |
13 | * | |
14 | */ | |
15 | ||
16 | /* The purpose of this file is to run all the post-install scripts | |
17 | in their various forms. */ | |
18 | ||
b24c88b3 RC |
19 | #if 0 |
20 | static const char *cvsid = | |
21 | "\n%%% $Id$\n"; | |
22 | #endif | |
8507f105 | 23 | |
f57c332f DD |
24 | #include "dialog.h" |
25 | #include "find.h" | |
a351e48c | 26 | #include "mount.h" |
8e9aa511 | 27 | #include "script.h" |
b401ef47 | 28 | #include "FindVisitor.h" |
ad646f43 RC |
29 | #include "package_db.h" |
30 | #include "package_meta.h" | |
f57c332f | 31 | |
b401ef47 | 32 | class RunFindVisitor : public FindVisitor |
f57c332f | 33 | { |
b401ef47 RC |
34 | public: |
35 | RunFindVisitor (){} | |
36 | virtual void visitFile(String const &basePath, const WIN32_FIND_DATA *theFile) | |
37 | { | |
38 | run_script ("/etc/postinstall/", theFile->cFileName); | |
39 | } | |
40 | virtual ~ RunFindVisitor () {} | |
41 | protected: | |
42 | RunFindVisitor (RunFindVisitor const &); | |
43 | RunFindVisitor & operator= (RunFindVisitor const &); | |
44 | }; | |
45 | ||
f57c332f | 46 | void |
ab57ceaa | 47 | do_postinstall (HINSTANCE h, HWND owner) |
f57c332f DD |
48 | { |
49 | next_dialog = 0; | |
8e9aa511 | 50 | init_run_script (); |
3c054baf | 51 | SetCurrentDirectory (get_root_dir ().cstr_oneuse()); |
ad646f43 RC |
52 | packagedb db; |
53 | PackageDBConnectedIterator i = db.connectedBegin (); | |
54 | while (i != db.connectedEnd ()) | |
55 | { | |
56 | packagemeta & pkg = **i; | |
57 | if (pkg.installed) | |
58 | for (std::vector<Script>::iterator script=pkg.installed.scripts().begin(); script != pkg.installed.scripts().end(); ++script) | |
59 | run_script ("/etc/postinstall/", script->baseName()); | |
60 | ++i; | |
61 | } | |
b401ef47 RC |
62 | RunFindVisitor myVisitor; |
63 | String postinst = cygpath ("/etc/postinstall"); | |
64 | Find (postinst).accept (myVisitor); | |
ad646f43 | 65 | |
f57c332f | 66 | } |