Compare commits

..

1 Commits

Author SHA1 Message Date
brosssh
7db4942bba fix: Make ShellCommandRunner run without root
Currently, every command run by a ShellCommandRunner will be run with su (root required). With this PR, root will only be required from a RootInstaller.
Also remove latest \n from shell output
2025-05-29 10:19:16 +02:00
6 changed files with 12 additions and 18 deletions

View File

@@ -109,9 +109,9 @@ You can find the contribution guidelines [here](CONTRIBUTING.md).
To build ReVanced Library,
you can follow the [ReVanced documentation](https://github.com/ReVanced/revanced-documentation).
## 📜 License
## 📜 Licence
ReVanced Library is licensed under the GPLv3 license. Please see the [license file](LICENSE) for more information.
ReVanced Library is licensed under the GPLv3 license. Please see the [licence file](LICENSE) for more information.
[tl;dr](https://www.tldrlegal.com/license/gnu-general-public-license-v3-gpl-3) you may copy, distribute and modify ReVanced Library as long as you track changes/dates in source files.
Any modifications to ReVanced Library must also be made available under the GPL,
along with build & install instructions.

16
package-lock.json generated
View File

@@ -8,7 +8,7 @@
"@saithodev/semantic-release-backmerge": "^4.0.1",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"gradle-semantic-release-plugin": "^1.10.3",
"gradle-semantic-release-plugin": "^1.10.1",
"semantic-release": "^24.1.2"
}
},
@@ -185,7 +185,6 @@
"integrity": "sha512-hEb7Ma4cGJGEUNOAVmyfdB/3WirWMg5hDuNFVejGEDFqupeOysLc2sG6HJxY2etBp5YQu5Wtxwi020jS9xlUwg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@octokit/auth-token": "^5.0.0",
"@octokit/graphql": "^8.0.0",
@@ -401,7 +400,6 @@
"integrity": "sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@octokit/auth-token": "^4.0.0",
"@octokit/graphql": "^7.1.0",
@@ -1051,7 +1049,6 @@
"integrity": "sha512-jcByLnIFkd5gSXZmjNvS1TlmRhCXZjIzHYlaGkPlLIekG55JDR2Z4va9tZwCiP+/RDERiNhMOFu01xd6O5ct1Q==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"marked": "bin/marked.js"
},
@@ -1170,7 +1167,6 @@
"integrity": "sha512-0mhiCR/4sZb00RVFJIUlMuiBkW3NMpVIW2Gse7noqEMoFGkvfPPAImEQbkBV8xga4KOPP4FdTRYuLLy32R1fPw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@semantic-release/commit-analyzer": "^11.0.0",
"@semantic-release/error": "^4.0.0",
@@ -2878,9 +2874,9 @@
"license": "ISC"
},
"node_modules/gradle-semantic-release-plugin": {
"version": "1.10.3",
"resolved": "https://registry.npmjs.org/gradle-semantic-release-plugin/-/gradle-semantic-release-plugin-1.10.3.tgz",
"integrity": "sha512-ik1qPcHvzl9AI0NzZpmKv89SAOpamuAQrbynWy0RjMBskpvHh97vPw0ywtfw5+u2O7oqxtG88xLJOFY0YaZCpg==",
"version": "1.10.1",
"resolved": "https://registry.npmjs.org/gradle-semantic-release-plugin/-/gradle-semantic-release-plugin-1.10.1.tgz",
"integrity": "sha512-Q4dLAFICjPouUyRRHEKK8cXNB75nraXoioYZDZlVQOg4sYKudnTDZ3ohLmV3k4cPGiiMCh1ckXETkx9JnuyKmA==",
"dev": true,
"funding": [
{
@@ -2897,7 +2893,7 @@
"node": ">=18"
},
"peerDependencies": {
"semantic-release": "^24.0.0 || ^25.0.0"
"semantic-release": "^24.0.0"
}
},
"node_modules/handlebars": {
@@ -3469,7 +3465,6 @@
"integrity": "sha512-qXUm7e/YKFoqFPYPa3Ukg9xlI5cyAtGmyEIzMfW//m6kXwCy2Ps9DYf5ioijFKQ8qyuscrHoY04iJGctu2Kg0Q==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"marked": "bin/marked.js"
},
@@ -6770,7 +6765,6 @@
"integrity": "sha512-hvEJ7yI97pzJuLsDZCYzJgmRxF8kiEJvNZhf0oiZQcexw+Ycjy4wbdsn/sVMURgNCu8rwbAXJdBRyIxM4pe32g==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@semantic-release/commit-analyzer": "^13.0.0-beta.1",
"@semantic-release/error": "^4.0.0",

View File

@@ -3,7 +3,7 @@
"@saithodev/semantic-release-backmerge": "^4.0.1",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"gradle-semantic-release-plugin": "^1.10.3",
"gradle-semantic-release-plugin": "^1.10.1",
"semantic-release": "^24.1.2"
}
}

View File

@@ -35,7 +35,7 @@ class AdbShellCommandRunner : ShellCommandRunner {
override fun runCommand(command: String) = device.shellProcessBuilder(command).start().let { process ->
object : RunResult {
override val exitCode by lazy { process.waitFor() }
override val output by lazy { process.inputStream.bufferedReader().readText() }
override val output by lazy { process.inputStream.bufferedReader().readText().removeSuffix("\n") }
override val error by lazy { process.errorStream.bufferedReader().readText() }
override fun waitFor() {
@@ -44,7 +44,7 @@ class AdbShellCommandRunner : ShellCommandRunner {
}
}
override fun hasRootPermission(): Boolean = invoke("whoami").exitCode == 0
override fun hasRootPermission(): Boolean = invoke("su -c whoami").exitCode == 0
override fun write(content: InputStream, targetFilePath: String) =
device.push(content, System.currentTimeMillis(), 644, RemoteFile(targetFilePath))

View File

@@ -55,5 +55,5 @@ abstract class ShellCommandRunner internal constructor() {
*/
internal operator fun invoke(
command: String,
) = runCommand("su -c \'$command\'")
) = runCommand(command)
}

View File

@@ -100,7 +100,7 @@ abstract class RootInstaller internal constructor(
/**
* Runs a command on the device.
*/
protected operator fun String.invoke() = shellCommandRunner(this)
protected operator fun String.invoke() = shellCommandRunner("su -c \'$this\'")
/**
* Moves the given file to the given [targetFilePath].