]>
Commit | Line | Data |
---|---|---|
bc78a6d5 RC |
1 | /* |
2 | * Copyright (c) 2001, Jan Nieuwenhuizen. | |
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 Jan Nieuwenhuizen <janneke@gnu.org> | |
13 | * | |
14 | */ | |
c93bc6d0 MB |
15 | #ifndef SETUP_SCRIPT_H |
16 | #define SETUP_SCRIPT_H | |
bc78a6d5 | 17 | |
bc78a6d5 RC |
18 | /* Initialisation stuff for run_script: sh, cmd, CYGWINROOT and PATH */ |
19 | void init_run_script (); | |
20 | ||
534c25cc BD |
21 | /* Run the script named dir/fname.ext |
22 | Returns the script exit status or negative error if any. */ | |
2bba98e8 MB |
23 | int try_run_script (const std::string& dir, |
24 | const std::string& fname, | |
25 | const std::string& ext); | |
bc78a6d5 | 26 | |
ad646f43 | 27 | class Script { |
39ba3555 | 28 | public: |
2bba98e8 MB |
29 | static bool isAScript (const std::string& file); |
30 | Script (const std::string& fileName); | |
470f4928 | 31 | std::string baseName() const; |
2bba98e8 | 32 | std::string fullName() const; |
534c25cc BD |
33 | /* Run the script. If its suffix is .sh, and we have a Bourne shell, execute |
34 | it using sh. Otherwise, if the suffix is .bat, execute using cmd.exe (NT) | |
35 | or command.com (9x). Returns the exit status of the process, or | |
36 | negative error if any. */ | |
37 | int run() const; | |
39ba3555 | 38 | private: |
2bba98e8 | 39 | std::string scriptName; |
39ba3555 | 40 | static char const ETCPostinstall[]; |
1e3b2ad4 | 41 | char const * extension() const; |
ad646f43 RC |
42 | }; |
43 | ||
c93bc6d0 | 44 | #endif /* SETUP_SCRIPT_H */ |