blob: edd1d5f12178fc73a58721893bd141b877a404ec [file] [log] [blame]
bigbiff32cbabe2020-04-12 19:16:19 -04001
2#ifndef TWRPAPEX_HPP
3#define TWRPAPEX_HPP
4
5#include <string>
6#include <vector>
7#include <filesystem>
bigbiff79924302021-05-02 20:06:09 -04008#include <sstream>
bigbiff32cbabe2020-04-12 19:16:19 -04009
10#include <sys/types.h>
11#include <sys/stat.h>
12#include <sys/ioctl.h>
13#include <linux/loop.h>
14#include <sys/mount.h>
15#include <sys/sysmacros.h>
16#include <fcntl.h>
17#include <unistd.h>
18
19#include <ziparchive/zip_archive.h>
20#include "twcommon.h"
21
bigbiff32cbabe2020-04-12 19:16:19 -040022#define APEX_DIR "/system_root/system/apex"
23#define APEX_PAYLOAD "apex_payload.img"
24#define LOOP_BLOCK_DEVICE_DIR "/dev/block/"
bigbiffad58e1b2020-07-06 20:24:34 -040025#define APEX_BASE "/apex/"
bigbiff0e97f7e2021-02-25 10:16:59 -050026#define LOOP_CONTROL "/dev/loop-control"
bigbiff32cbabe2020-04-12 19:16:19 -040027
28class twrpApex {
29public:
30 bool loadApexImages();
31
32private:
33 std::string unzipImage(std::string file);
bigbiff0e97f7e2021-02-25 10:16:59 -050034 bool mountApexOnLoopbackDevices(std::vector<std::string> apexFiles);
bigbiff32cbabe2020-04-12 19:16:19 -040035 bool loadApexImage(std::string fileToMount, size_t loop_device_number);
36};
37#endif