improve compatibility

pull/410/head
vapao 2021-09-30 18:11:36 +08:00
parent 9998ae47ad
commit ee3e6430ed
2 changed files with 3 additions and 1 deletions

View File

@ -194,6 +194,8 @@ def fetch_host_extend(ssh):
response['cpu'] = int(out.strip())
code, out = ssh.exec_command_raw("cat /etc/os-release | grep PRETTY_NAME | awk -F \\\" '{print $2}'")
if '/etc/os-release' in out:
code, out = ssh.exec_command_raw("cat /etc/issue | head -1 | awk '{print $1,$2,$3}'")
if code == 0:
response['os_name'] = out.strip()

View File

@ -188,7 +188,7 @@ class SSH:
b64_command = base64.standard_b64encode(new_command.encode())
commands = 'export SPUG_EXEC_FILE=$(mktemp)\n'
commands += f'echo {b64_command.decode()} | base64 -d > $SPUG_EXEC_FILE\n'
commands += f'echo {b64_command.decode()} | base64 -di > $SPUG_EXEC_FILE\n'
commands += 'bash $SPUG_EXEC_FILE\n'
return commands