fix: termux compatibility (#472)

This commit is contained in:
lollipopkit🏳️‍⚧️
2024-07-20 20:35:30 +08:00
committed by GitHub
parent 2907ac74d4
commit b0936c5e6e
7 changed files with 53 additions and 82 deletions

View File

@@ -19,11 +19,24 @@ enum ShellFunc {
/// srvboxm -> ServerBox Mobile
static const scriptFile = 'srvboxm_v${BuildData.script}.sh';
static const scriptPath = '/dev/shm/$scriptFile';
static const installShellCmd = """
cat > $scriptPath
chmod 744 $scriptPath
static const scriptPathShm = '/dev/shm/$scriptFile';
static const scriptPathHome = '~/.config/server_box/$scriptFile';
static final _scriptPathMap = <String, String>{};
static String getScriptPath(String id) {
return _scriptPathMap.putIfAbsent(id, () => scriptPathShm);
}
static String setScriptPath(String id, String path) {
return _scriptPathMap[id] = path;
}
static String installShellCmd(String id) {
final path = getScriptPath(id);
return """
cat > $path
chmod 744 $path
""";
}
String get flag {
switch (this) {
@@ -42,7 +55,7 @@ chmod 744 $scriptPath
}
}
String get exec => 'sh $scriptPath -$flag';
String exec(String id) => 'sh ${getScriptPath(id)} -$flag';
String get name {
switch (this) {