mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-10-11 04:16:17 +00:00
Update AppImage
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
APPDIR="$(dirname "$(readlink -f "${0}")")"
|
APPDIR="$(dirname "$(readlink -f "${0}")")"
|
||||||
|
|
||||||
export PATH="${APPDIR}/usr/bin:${PATH}"
|
export PATH="${APPDIR}/usr/bin:${PATH}"
|
||||||
export LD_LIBRARY_PATH="${APPDIR}/usr/lib/x86_64-linux-gnu:${APPDIR}/usr/lib:${LD_LIBRARY_PATH}"
|
export LD_LIBRARY_PATH="${APPDIR}/usr/lib/x86_64-linux-gnu:${APPDIR}/usr/lib:${APPDIR}/lib/x86_64-linux-gnu:${APPDIR}/lib:${LD_LIBRARY_PATH}"
|
||||||
export PYTHONPATH="${APPDIR}/usr/lib/python3/dist-packages:${APPDIR}/usr/lib/python3/site-packages:${PYTHONPATH}"
|
export PYTHONPATH="${APPDIR}/usr/lib/python3/dist-packages:${APPDIR}/usr/lib/python3/site-packages:${PYTHONPATH}"
|
||||||
|
|
||||||
# Change to the AppImage directory
|
# Change to the AppImage directory
|
||||||
@@ -27,8 +27,16 @@ else
|
|||||||
[ -x "${APPDIR}/usr/bin/ipmitool" ] && echo " ✅ ipmitool available" || echo " ⚠️ ipmitool not available"
|
[ -x "${APPDIR}/usr/bin/ipmitool" ] && echo " ✅ ipmitool available" || echo " ⚠️ ipmitool not available"
|
||||||
[ -x "${APPDIR}/usr/bin/sensors" ] && echo " ✅ sensors available" || echo " ⚠️ sensors not available"
|
[ -x "${APPDIR}/usr/bin/sensors" ] && echo " ✅ sensors available" || echo " ⚠️ sensors not available"
|
||||||
[ -x "${APPDIR}/usr/bin/upsc" ] && echo " ✅ upsc available" || echo " ⚠️ upsc not available"
|
[ -x "${APPDIR}/usr/bin/upsc" ] && echo " ✅ upsc available" || echo " ⚠️ upsc not available"
|
||||||
echo ""
|
|
||||||
|
|
||||||
|
if [ -x "${APPDIR}/usr/bin/ipmitool" ]; then
|
||||||
|
if ldd "${APPDIR}/usr/bin/ipmitool" 2>/dev/null | grep -q "libfreeipmi.so.17 => not found"; then
|
||||||
|
echo " ⚠️ libfreeipmi.so.17 not found - ipmitool may not work"
|
||||||
|
elif ldd "${APPDIR}/usr/bin/ipmitool" 2>/dev/null | grep -q "libfreeipmi.so.17"; then
|
||||||
|
echo " ✅ libfreeipmi.so.17 loaded successfully"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
echo "Press Ctrl+C to stop the server"
|
echo "Press Ctrl+C to stop the server"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
@@ -401,13 +401,33 @@ else
|
|||||||
|
|
||||||
if [ -d "$APP_DIR/usr/lib/x86_64-linux-gnu" ]; then
|
if [ -d "$APP_DIR/usr/lib/x86_64-linux-gnu" ]; then
|
||||||
echo " Creating library symlinks..."
|
echo " Creating library symlinks..."
|
||||||
|
|
||||||
# Link libupsclient
|
# Link libupsclient
|
||||||
if [ -f "$APP_DIR/usr/lib/x86_64-linux-gnu/libupsclient.so.6" ]; then
|
if [ -f "$APP_DIR/usr/lib/x86_64-linux-gnu/libupsclient.so.6" ]; then
|
||||||
ln -sf "$APP_DIR/usr/lib/x86_64-linux-gnu/libupsclient.so.6" "$APP_DIR/usr/lib/libupsclient.so.6" 2>/dev/null || true
|
ln -sf "$APP_DIR/usr/lib/x86_64-linux-gnu/libupsclient.so.6" "$APP_DIR/usr/lib/libupsclient.so.6" 2>/dev/null || true
|
||||||
|
ln -sf "x86_64-linux-gnu/libupsclient.so.6" "$APP_DIR/usr/lib/x86_64-linux-gnu/libupsclient.so" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
# Link libfreeipmi
|
|
||||||
|
# Link libfreeipmi - create multiple symlinks to ensure it's found
|
||||||
if [ -f "$APP_DIR/usr/lib/x86_64-linux-gnu/libfreeipmi.so.17" ]; then
|
if [ -f "$APP_DIR/usr/lib/x86_64-linux-gnu/libfreeipmi.so.17" ]; then
|
||||||
|
echo " ✅ Found libfreeipmi.so.17, creating symlinks..."
|
||||||
ln -sf "$APP_DIR/usr/lib/x86_64-linux-gnu/libfreeipmi.so.17" "$APP_DIR/usr/lib/libfreeipmi.so.17" 2>/dev/null || true
|
ln -sf "$APP_DIR/usr/lib/x86_64-linux-gnu/libfreeipmi.so.17" "$APP_DIR/usr/lib/libfreeipmi.so.17" 2>/dev/null || true
|
||||||
|
ln -sf "x86_64-linux-gnu/libfreeipmi.so.17" "$APP_DIR/usr/lib/x86_64-linux-gnu/libfreeipmi.so" 2>/dev/null || true
|
||||||
|
|
||||||
|
# Also copy to root lib directory as fallback
|
||||||
|
mkdir -p "$APP_DIR/lib/x86_64-linux-gnu"
|
||||||
|
cp "$APP_DIR/usr/lib/x86_64-linux-gnu/libfreeipmi.so.17"* "$APP_DIR/lib/x86_64-linux-gnu/" 2>/dev/null || true
|
||||||
|
else
|
||||||
|
echo " ⚠️ libfreeipmi.so.17 not found after extraction"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy all libfreeipmi dependencies
|
||||||
|
if ls "$APP_DIR/usr/lib/x86_64-linux-gnu"/libfreeipmi* 1> /dev/null 2>&1; then
|
||||||
|
echo " Copying all libfreeipmi libraries..."
|
||||||
|
for lib in "$APP_DIR/usr/lib/x86_64-linux-gnu"/libfreeipmi*; do
|
||||||
|
libname=$(basename "$lib")
|
||||||
|
ln -sf "$APP_DIR/usr/lib/x86_64-linux-gnu/$libname" "$APP_DIR/usr/lib/$libname" 2>/dev/null || true
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -416,6 +436,13 @@ else
|
|||||||
[ -f "$APP_DIR/usr/bin/ipmitool" ] && echo " ✅ ipmitool" || echo " ⚠️ ipmitool not found"
|
[ -f "$APP_DIR/usr/bin/ipmitool" ] && echo " ✅ ipmitool" || echo " ⚠️ ipmitool not found"
|
||||||
[ -f "$APP_DIR/usr/bin/sensors" ] && echo " ✅ sensors (lm-sensors)" || echo " ⚠️ sensors not found"
|
[ -f "$APP_DIR/usr/bin/sensors" ] && echo " ✅ sensors (lm-sensors)" || echo " ⚠️ sensors not found"
|
||||||
[ -f "$APP_DIR/usr/bin/upsc" ] && echo " ✅ upsc (nut-client)" || echo " ⚠️ upsc not found"
|
[ -f "$APP_DIR/usr/bin/upsc" ] && echo " ✅ upsc (nut-client)" || echo " ⚠️ upsc not found"
|
||||||
|
|
||||||
|
echo "📋 Verifying libraries:"
|
||||||
|
if [ -f "$APP_DIR/usr/lib/x86_64-linux-gnu/libfreeipmi.so.17" ]; then
|
||||||
|
echo " ✅ libfreeipmi.so.17 found"
|
||||||
|
else
|
||||||
|
echo " ⚠️ libfreeipmi.so.17 NOT found - ipmitool may not work"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build AppImage
|
# Build AppImage
|
||||||
|
@@ -1430,27 +1430,110 @@ def get_ups_info():
|
|||||||
|
|
||||||
return ups_data
|
return ups_data
|
||||||
|
|
||||||
def get_hardware_info():
|
def get_temperature_info():
|
||||||
"""Get comprehensive hardware information"""
|
"""Get detailed temperature information from sensors command"""
|
||||||
hardware_data = {
|
temperatures = []
|
||||||
'cpu': {},
|
power_meter = None
|
||||||
'motherboard': {},
|
|
||||||
'memory_modules': [],
|
|
||||||
'storage_devices': [],
|
|
||||||
'network_cards': [],
|
|
||||||
'graphics_cards': [],
|
|
||||||
'pci_devices': [],
|
|
||||||
'sensors': {
|
|
||||||
'temperatures': [],
|
|
||||||
'fans': []
|
|
||||||
},
|
|
||||||
'power': {},
|
|
||||||
'ipmi_fans': [], # Added IPMI fans
|
|
||||||
'ipmi_power': {}, # Added IPMI power
|
|
||||||
'ups': {} # Added UPS info
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
result = subprocess.run(['sensors'], capture_output=True, text=True, timeout=5)
|
||||||
|
if result.returncode == 0:
|
||||||
|
current_adapter = None
|
||||||
|
current_sensor = None
|
||||||
|
|
||||||
|
for line in result.stdout.split('\n'):
|
||||||
|
line = line.strip()
|
||||||
|
if not line:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Detect adapter line
|
||||||
|
if line.startswith('Adapter:'):
|
||||||
|
current_adapter = line.replace('Adapter:', '').strip()
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Detect sensor name (lines without ':' at the start are sensor names)
|
||||||
|
if ':' in line and not line.startswith(' '):
|
||||||
|
parts = line.split(':', 1)
|
||||||
|
sensor_name = parts[0].strip()
|
||||||
|
value_part = parts[1].strip()
|
||||||
|
|
||||||
|
if 'power' in sensor_name.lower() and 'W' in value_part:
|
||||||
|
try:
|
||||||
|
# Extract power value (e.g., "182.00 W" -> 182.00)
|
||||||
|
power_match = re.search(r'([\d.]+)\s*W', value_part)
|
||||||
|
if power_match:
|
||||||
|
power_value = float(power_match.group(1))
|
||||||
|
power_meter = {
|
||||||
|
'name': sensor_name,
|
||||||
|
'watts': power_value,
|
||||||
|
'adapter': current_adapter
|
||||||
|
}
|
||||||
|
print(f"[v0] Power meter sensor: {sensor_name} = {power_value}W")
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Parse temperature sensors
|
||||||
|
elif '°C' in value_part or 'C' in value_part:
|
||||||
|
try:
|
||||||
|
# Extract temperature value
|
||||||
|
temp_match = re.search(r'([+-]?[\d.]+)\s*°?C', value_part)
|
||||||
|
if temp_match:
|
||||||
|
temp_value = float(temp_match.group(1))
|
||||||
|
|
||||||
|
# Extract high and critical values if present
|
||||||
|
high_match = re.search(r'high\s*=\s*([+-]?[\d.]+)', value_part)
|
||||||
|
crit_match = re.search(r'crit\s*=\s*([+-]?[\d.]+)', value_part)
|
||||||
|
|
||||||
|
high_value = float(high_match.group(1)) if high_match else 0
|
||||||
|
crit_value = float(crit_match.group(1)) if crit_match else 0
|
||||||
|
|
||||||
|
temperatures.append({
|
||||||
|
'name': sensor_name,
|
||||||
|
'current': temp_value,
|
||||||
|
'high': high_value,
|
||||||
|
'critical': crit_value,
|
||||||
|
'adapter': current_adapter
|
||||||
|
})
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
print(f"[v0] Found {len(temperatures)} temperature sensors")
|
||||||
|
if power_meter:
|
||||||
|
print(f"[v0] Found power meter: {power_meter['watts']}W")
|
||||||
|
|
||||||
|
except FileNotFoundError:
|
||||||
|
print("[v0] sensors command not found")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[v0] Error getting temperature info: {e}")
|
||||||
|
|
||||||
|
return {
|
||||||
|
'temperatures': temperatures,
|
||||||
|
'power_meter': power_meter
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_hardware_info():
|
||||||
|
"""Get comprehensive hardware information"""
|
||||||
|
try:
|
||||||
|
# Initialize with default structure, including the new power_meter field
|
||||||
|
hardware_data = {
|
||||||
|
'cpu': {},
|
||||||
|
'motherboard': {},
|
||||||
|
'memory_modules': [],
|
||||||
|
'storage_devices': [],
|
||||||
|
'network_cards': [],
|
||||||
|
'graphics_cards': [],
|
||||||
|
'pci_devices': [],
|
||||||
|
'sensors': {
|
||||||
|
'temperatures': [],
|
||||||
|
'fans': []
|
||||||
|
},
|
||||||
|
'power': {}, # This might be overwritten by ipmi_power or ups
|
||||||
|
'ipmi_fans': [], # Added IPMI fans
|
||||||
|
'ipmi_power': {}, # Added IPMI power
|
||||||
|
'ups': {}, # Added UPS info
|
||||||
|
'power_meter': None # Added placeholder for sensors power meter
|
||||||
|
}
|
||||||
|
|
||||||
# CPU Information
|
# CPU Information
|
||||||
try:
|
try:
|
||||||
result = subprocess.run(['lscpu'], capture_output=True, text=True, timeout=5)
|
result = subprocess.run(['lscpu'], capture_output=True, text=True, timeout=5)
|
||||||
@@ -1794,6 +1877,12 @@ def get_hardware_info():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[v0] Error getting UPS info: {e}")
|
print(f"[v0] Error getting UPS info: {e}")
|
||||||
|
|
||||||
|
temp_info = get_temperature_info()
|
||||||
|
if temp_info['temperatures']:
|
||||||
|
hardware_data['sensors']['temperatures'] = temp_info['temperatures']
|
||||||
|
if temp_info['power_meter']:
|
||||||
|
hardware_data['power_meter'] = temp_info['power_meter']
|
||||||
|
|
||||||
ipmi_fans = get_ipmi_fans()
|
ipmi_fans = get_ipmi_fans()
|
||||||
if ipmi_fans:
|
if ipmi_fans:
|
||||||
hardware_data['ipmi_fans'] = ipmi_fans
|
hardware_data['ipmi_fans'] = ipmi_fans
|
||||||
|
Reference in New Issue
Block a user