Add debian version detection

This commit is contained in:
Taylor Helsper 2022-08-11 00:06:41 -05:00
parent 41e7e1364b
commit d606d89c28
8 changed files with 63 additions and 14 deletions

View File

@ -79,6 +79,7 @@ def check_in():
"serial": get_device_serial(), "serial": get_device_serial(),
"device_type": get_device_type(), "device_type": get_device_type(),
"device_arch": get_device_arch(), "device_arch": get_device_arch(),
"debian_version": get_debian_version(),
"version": get_current_version(), "version": get_current_version(),
"product_key": product_key, "product_key": product_key,
"drive_size": get_mynode_drive_size(), "drive_size": get_mynode_drive_size(),

View File

@ -31,6 +31,7 @@ def get_premium_plus_device_info():
info["serial"] = get_device_serial() info["serial"] = get_device_serial()
info["device_type"] = get_device_type() info["device_type"] = get_device_type()
info["device_arch"] = get_device_arch() info["device_arch"] = get_device_arch()
info["debian_version"] = get_debian_version()
info["drive_size"] = get_mynode_drive_size() info["drive_size"] = get_mynode_drive_size()
info["data_drive_usage"] = get_data_drive_usage() info["data_drive_usage"] = get_data_drive_usage()
info["os_drive_usage"] = get_os_drive_usage() info["os_drive_usage"] = get_os_drive_usage()

View File

@ -14,6 +14,7 @@ IS_32_BIT=0
IS_64_BIT=0 IS_64_BIT=0
DEVICE_TYPE="unknown" DEVICE_TYPE="unknown"
MODEL=$(tr -d '\0' < /proc/device-tree/model) || MODEL="unknown" MODEL=$(tr -d '\0' < /proc/device-tree/model) || MODEL="unknown"
DEBIAN_VERSION=$(lsb_release -c -s) || DEBIAN_VERSION="unknown"
uname -a | grep amd64 && IS_X86=1 && IS_64_BIT=1 || true uname -a | grep amd64 && IS_X86=1 && IS_64_BIT=1 || true
if [[ $MODEL == *"Rock64"* ]]; then if [[ $MODEL == *"Rock64"* ]]; then
IS_ARMBIAN=1 IS_ARMBIAN=1

View File

@ -313,6 +313,15 @@ def get_device_arch():
cached_data["device_arch"] = arch cached_data["device_arch"] = arch
return arch return arch
def get_debian_version():
global cached_data
if "debian_version" in cached_data:
return cached_data["debian_version"]
debian_version = to_string(subprocess.check_output("lsb_release -c -s", shell=True).decode("utf-8").strip())
cached_data["debian_version"] = debian_version
return debian_version
def get_device_ram(): def get_device_ram():
global cached_data global cached_data
if "ram" in cached_data: if "ram" in cached_data:

View File

@ -31,9 +31,6 @@ def page_settings():
latest_beta_version = get_latest_beta_version() latest_beta_version = get_latest_beta_version()
changelog = get_device_changelog() changelog = get_device_changelog()
serial_number = get_device_serial()
device_type = get_device_type()
device_arch = get_device_arch()
device_ram = get_device_ram() device_ram = get_device_ram()
product_key = get_product_key() product_key = get_product_key()
product_key_skipped = skipped_product_key() product_key_skipped = skipped_product_key()
@ -66,9 +63,10 @@ def page_settings():
"upgrade_error": did_upgrade_fail(), "upgrade_error": did_upgrade_fail(),
"upgrade_log": get_recent_upgrade_log(), "upgrade_log": get_recent_upgrade_log(),
"upgrade_logs": get_all_upgrade_logs(), "upgrade_logs": get_all_upgrade_logs(),
"serial_number": serial_number, "serial_number": get_device_serial(),
"device_type": device_type, "device_type": get_device_type(),
"device_arch": device_arch, "device_arch": get_device_arch(),
"debian_version": get_debian_version(),
"device_ram": device_ram, "device_ram": device_ram,
"swap_size": get_swap_size(), "swap_size": get_swap_size(),
"check_in_data": get_check_in_data(), "check_in_data": get_check_in_data(),
@ -130,9 +128,6 @@ def page_status():
latest_beta_version = get_latest_beta_version() latest_beta_version = get_latest_beta_version()
changelog = get_device_changelog() changelog = get_device_changelog()
serial_number = get_device_serial()
device_type = get_device_type()
device_arch = get_device_arch()
device_ram = get_device_ram() device_ram = get_device_ram()
product_key = get_product_key() product_key = get_product_key()
product_key_skipped = skipped_product_key() product_key_skipped = skipped_product_key()
@ -141,7 +136,6 @@ def page_status():
date = get_system_date() date = get_system_date()
local_ip = get_local_ip() local_ip = get_local_ip()
# Get Startup Status # Get Startup Status
#startup_status_log = get_journalctl_log("mynode") #startup_status_log = get_journalctl_log("mynode")
@ -190,9 +184,10 @@ def page_status():
"has_checkin_error": has_checkin_error(), "has_checkin_error": has_checkin_error(),
"upgrade_error": did_upgrade_fail(), "upgrade_error": did_upgrade_fail(),
"upgrade_logs": get_recent_upgrade_log(), "upgrade_logs": get_recent_upgrade_log(),
"serial_number": serial_number, "serial_number": get_device_serial(),
"device_type": device_type, "device_type": get_device_type(),
"device_arch": device_arch, "device_arch": get_device_arch(),
"debian_version": get_debian_version(),
"device_ram": device_ram, "device_ram": device_ram,
"check_in_data": get_check_in_data(), "check_in_data": get_check_in_data(),
"product_key": product_key, "product_key": product_key,

View File

@ -1,7 +1,7 @@
<div class="settings_block_subheader"> <div class="settings_block_subheader">
Info Info
</div> </div>
<table border="0" class="info_table"> <table border="0" class="info_table" id="info_table">
<tr> <tr>
<th>Serial Number</th> <th>Serial Number</th>
<td>{{serial_number}}</td> <td>{{serial_number}}</td>
@ -112,6 +112,22 @@
<td style="color: red;"><b>Error contacting mynodebtc.com via Tor!</b><br/>You may have issues checking for new versions or saving product keys.</td> <td style="color: red;"><b>Error contacting mynodebtc.com via Tor!</b><br/>You may have issues checking for new versions or saving product keys.</td>
</tr> </tr>
{% endif %} {% endif %}
<!-- From here down are the "Details" (hidden unless show details is clicked)-->
<tr>
<th>Advanced Info</th>
<td>
<button id="info_table_show_advanced_info" class="ui-button ui-widget ui-corner-all settings_button_small">Show</button>
</td>
</tr>
<tr class="info_table_advanced_row" style="display: none;">
<th>Debian Version</th>
<td>{{debian_version}}</td>
</tr>
<tr class="info_table_advanced_row" style="display: none;">
<th>Architecture</th>
<td>{{device_arch}}</td>
</tr>
</table> </table>
<div class="divider"></div> <div class="divider"></div>

View File

@ -366,6 +366,19 @@
); );
}); });
showing_info_table_advanced_rows=0;
$("#info_table_show_advanced_info").on("click", function() {
if (showing_info_table_advanced_rows) {
$("#info_table_show_advanced_info").html("Show");
$(".info_table_advanced_row").hide();
showing_info_table_advanced_rows = 0;
} else {
$("#info_table_show_advanced_info").html("Hide");
$(".info_table_advanced_row").show();
showing_info_table_advanced_rows = 1;
}
});
$("#glances").on("click", function() { $("#glances").on("click", function() {
port="61208"; port="61208";
if (location.protocol == "https:") { if (location.protocol == "https:") {

View File

@ -45,6 +45,19 @@
} }
}); });
showing_info_table_advanced_rows=0;
$("#info_table_show_advanced_info").on("click", function() {
if (showing_info_table_advanced_rows) {
$("#info_table_show_advanced_info").html("Show");
$(".info_table_advanced_row").hide();
showing_info_table_advanced_rows = 0;
} else {
$("#info_table_show_advanced_info").html("Hide");
$(".info_table_advanced_row").show();
showing_info_table_advanced_rows = 1;
}
});
$("#glances").on("click", function() { $("#glances").on("click", function() {
port="61208"; port="61208";
if (location.protocol == "https:") { if (location.protocol == "https:") {