mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
fix: bsd status (#284)
This commit is contained in:
@@ -206,7 +206,7 @@ enum StatusCmdType {
|
|||||||
|
|
||||||
/// Cmds for linux server
|
/// Cmds for linux server
|
||||||
const _statusCmds = [
|
const _statusCmds = [
|
||||||
'echo $linuxSign',
|
'echo ${SystemType.linuxSign}',
|
||||||
'date +%s',
|
'date +%s',
|
||||||
'cat /proc/net/dev',
|
'cat /proc/net/dev',
|
||||||
'cat /etc/*-release | grep PRETTY_NAME',
|
'cat /etc/*-release | grep PRETTY_NAME',
|
||||||
@@ -240,7 +240,7 @@ enum BSDStatusCmdType {
|
|||||||
|
|
||||||
/// Cmds for BSD server
|
/// Cmds for BSD server
|
||||||
const _bsdStatusCmd = [
|
const _bsdStatusCmd = [
|
||||||
'echo $bsdSign',
|
'echo ${SystemType.bsdSign}',
|
||||||
'date +%s',
|
'date +%s',
|
||||||
'netstat -ibn',
|
'netstat -ibn',
|
||||||
'uname -or',
|
'uname -or',
|
||||||
|
|||||||
@@ -9,16 +9,14 @@ enum SystemType {
|
|||||||
|
|
||||||
const SystemType._(this.value);
|
const SystemType._(this.value);
|
||||||
|
|
||||||
|
static const linuxSign = '__linux';
|
||||||
|
static const bsdSign = '__bsd';
|
||||||
|
|
||||||
static SystemType parse(String value) {
|
static SystemType parse(String value) {
|
||||||
switch (value.trim()) {
|
if (value.contains(bsdSign)) {
|
||||||
case linuxSign:
|
return SystemType.bsd;
|
||||||
return SystemType.linux;
|
|
||||||
case bsdSign:
|
|
||||||
return SystemType.bsd;
|
|
||||||
default:
|
|
||||||
// Fallback to linux
|
|
||||||
return SystemType.linux;
|
|
||||||
}
|
}
|
||||||
|
return SystemType.linux;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSegmentsLenMatch(int len) => len == segmentsLen;
|
bool isSegmentsLenMatch(int len) => len == segmentsLen;
|
||||||
@@ -32,6 +30,3 @@ enum SystemType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const linuxSign = 'linux';
|
|
||||||
const bsdSign = 'bsd';
|
|
||||||
|
|||||||
Reference in New Issue
Block a user