fix: bsd status (#284)

This commit is contained in:
lollipopkit
2024-03-12 20:47:18 -06:00
parent 0ad7b4f8b8
commit e361e509af
2 changed files with 8 additions and 13 deletions

View File

@@ -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',

View File

@@ -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.linux;
case bsdSign:
return SystemType.bsd; 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';