bigbiff bigbiff | a0f8a59 | 2012-10-09 21:01:03 -0400 | [diff] [blame] | 1 | #include <iostream> |
| 2 | #include <fstream> |
| 3 | #include <sstream> |
| 4 | #include <string> |
| 5 | #include <vector> |
| 6 | #include <string.h> |
| 7 | #include <libgen.h> |
| 8 | #include <unistd.h> |
| 9 | #include <sys/stat.h> |
| 10 | #include <dirent.h> |
bigbiff bigbiff | 84a3f1a | 2013-12-28 18:32:15 -0500 | [diff] [blame] | 11 | #include <errno.h> |
bigbiff bigbiff | a0f8a59 | 2012-10-09 21:01:03 -0400 | [diff] [blame] | 12 | #include "gui/rapidxml.hpp" |
| 13 | #include "twrp-functions.hpp" |
| 14 | |
| 15 | using namespace std; |
| 16 | |
| 17 | class fixPermissions { |
| 18 | public: |
| 19 | int fixPerms(bool enable_debug, bool remove_data_for_missing_apps); |
| 20 | |
| 21 | private: |
| 22 | int pchown(std::string fn, int puid, int pgid); |
| 23 | int pchmod(std::string fn, string mode); |
| 24 | vector <string> listAllDirectories(std::string path); |
| 25 | vector <string> listAllFiles(std::string path); |
bigbiff bigbiff | a0f8a59 | 2012-10-09 21:01:03 -0400 | [diff] [blame] | 26 | int getPackages(); |
| 27 | int fixSystemApps(); |
| 28 | int fixDataApps(); |
| 29 | int fixAllFiles(string directory, int gid, int uid, string file_perms); |
Dees_Troy | 201d76b | 2012-11-16 17:12:02 +0000 | [diff] [blame] | 30 | int fixDataData(string dataDir); |
bigbiff bigbiff | 872a3b9 | 2013-10-18 20:50:25 -0400 | [diff] [blame] | 31 | int fixDataDataContexts(void); |
| 32 | int restorecon(std::string entry, struct stat *sb); |
| 33 | |
bigbiff bigbiff | a0f8a59 | 2012-10-09 21:01:03 -0400 | [diff] [blame] | 34 | struct package { |
| 35 | string pkgName; |
| 36 | string codePath; |
| 37 | string appDir; |
| 38 | string app; |
| 39 | string dDir; |
| 40 | int gid; |
| 41 | int uid; |
| 42 | package *next; |
| 43 | }; |
| 44 | bool debug; |
| 45 | bool remove_data; |
Dees_Troy | 201d76b | 2012-11-16 17:12:02 +0000 | [diff] [blame] | 46 | bool multi_user; |
bigbiff bigbiff | a0f8a59 | 2012-10-09 21:01:03 -0400 | [diff] [blame] | 47 | package* head; |
| 48 | package* temp; |
| 49 | string packageFile; |
| 50 | }; |