fix: Prefer /data/local/tmp over /data/adb for simplicity and easy access

This commit is contained in:
Alberto Ponces 2022-09-14 10:34:16 +01:00
parent 6ef716b0e4
commit 698f1ac383

View File

@ -1,8 +1,7 @@
import 'package:root/root.dart'; import 'package:root/root.dart';
class RootAPI { class RootAPI {
final String _managerDirPath = '/data/adb/revanced-manager'; final String _managerDirPath = '/data/local/tmp/revanced-manager';
final String _managerTmpDirPath = '/data/local/tmp/revanced-manager';
final String _postFsDataDirPath = '/data/adb/post-fs-data.d'; final String _postFsDataDirPath = '/data/adb/post-fs-data.d';
final String _serviceDDirPath = '/data/adb/service.d'; final String _serviceDDirPath = '/data/adb/service.d';
@ -100,7 +99,12 @@ class RootAPI {
await Root.exec( await Root.exec(
cmd: 'mkdir -p "$_managerDirPath/$packageName"', cmd: 'mkdir -p "$_managerDirPath/$packageName"',
); );
await setPermissions('0755', '', '', "$_managerDirPath/$packageName"); await setPermissions(
'0755',
'shell:shell',
'',
'$_managerDirPath/$packageName',
);
await saveOriginalFilePath(packageName, originalFilePath); await saveOriginalFilePath(packageName, originalFilePath);
await installServiceDScript(packageName); await installServiceDScript(packageName);
await installPostFsDataScript(packageName); await installPostFsDataScript(packageName);
@ -175,7 +179,7 @@ class RootAPI {
) async { ) async {
bool isInstalled = await isAppInstalled(packageName); bool isInstalled = await isAppInstalled(packageName);
if (isInstalled && await isMounted(packageName)) { if (isInstalled && await isMounted(packageName)) {
originalFilePath = '$_managerTmpDirPath/$packageName/original.apk'; originalFilePath = '$_managerDirPath/$packageName/original.apk';
await setPermissions( await setPermissions(
'0644', '0644',
'shell:shell', 'shell:shell',
@ -190,15 +194,15 @@ class RootAPI {
String packageName, String packageName,
String originalFilePath, String originalFilePath,
) async { ) async {
String originalRootPath = '$_managerTmpDirPath/$packageName/original.apk'; String originalRootPath = '$_managerDirPath/$packageName/original.apk';
await Root.exec( await Root.exec(
cmd: 'mkdir -p "$_managerTmpDirPath/$packageName"', cmd: 'mkdir -p "$_managerDirPath/$packageName"',
); );
await setPermissions( await setPermissions(
'0755', '0755',
'shell:shell', 'shell:shell',
'', '',
'$_managerTmpDirPath/$packageName', '$_managerDirPath/$packageName',
); );
await Root.exec( await Root.exec(
cmd: 'cp "$originalFilePath" "$originalRootPath"', cmd: 'cp "$originalFilePath" "$originalRootPath"',