Refine clean up procedure
This commit is contained in:
@@ -31,7 +31,7 @@ class SettingsFragment : PreferenceFragmentCompatDividers(), ServiceConnection {
|
|||||||
"while iptables -D FORWARD -j vpnhotspot_fwd; do done",
|
"while iptables -D FORWARD -j vpnhotspot_fwd; do done",
|
||||||
"iptables -F vpnhotspot_fwd",
|
"iptables -F vpnhotspot_fwd",
|
||||||
"iptables -X vpnhotspot_fwd",
|
"iptables -X vpnhotspot_fwd",
|
||||||
"ip rule del lookup 62",
|
"while ip rule del lookup 62; do done",
|
||||||
"ip route flush table 62")
|
"ip route flush table 62")
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const val NOISYSU_TAG = "NoisySU"
|
|||||||
const val NOISYSU_SUFFIX = "SUCCESS\n"
|
const val NOISYSU_SUFFIX = "SUCCESS\n"
|
||||||
fun noisySu(vararg commands: String): Boolean {
|
fun noisySu(vararg commands: String): Boolean {
|
||||||
val process = ProcessBuilder("su", "-c", """function noisy() { "$@" || echo "$@" exited with $?; }
|
val process = ProcessBuilder("su", "-c", """function noisy() { "$@" || echo "$@" exited with $?; }
|
||||||
${commands.joinToString("\n") { "noisy $it" }}
|
${commands.joinToString("\n") { if (it.startsWith("while ")) it else "noisy $it" }}
|
||||||
echo $NOISYSU_SUFFIX""")
|
echo $NOISYSU_SUFFIX""")
|
||||||
.redirectErrorStream(true)
|
.redirectErrorStream(true)
|
||||||
.start()
|
.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user