Don't panic if no batteries are found on Linux.
This commit is contained in:
+9
-4
@@ -2,10 +2,15 @@ _debug "Sourcing tcshrc.system.Linux..."
|
||||
|
||||
unsetenv CSHENV_BATTERY_DEVICE
|
||||
unsetenv CSHENV_SHOW_BATTERY_LEVEL
|
||||
foreach location ( /sys/class/power_supply/BAT* )
|
||||
setenv CSHENV_BATTERY_DEVICE ${location}/capacity
|
||||
setenv CSHENV_SHOW_BATTERY_LEVEL
|
||||
end
|
||||
|
||||
set battery_locations=( `ls /sys/class/power_supply/ | grep 'BAT'` )
|
||||
|
||||
if ( $#battery_locations > 0 ) then
|
||||
foreach location ( /sys/class/power_supply/BAT* )
|
||||
setenv CSHENV_BATTERY_DEVICE ${location}/capacity
|
||||
setenv CSHENV_SHOW_BATTERY_LEVEL
|
||||
end
|
||||
endif
|
||||
|
||||
# Set the acknowledgement bit, essentially
|
||||
setenv CSHENV_SYSTEM_CONFIGURED Linux
|
||||
|
||||
Reference in New Issue
Block a user