Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions usr/lib/tik/modules/pre/10-welcome
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,15 @@ displayACWarningMsg() {
}

checkLaptop() {
chassis=`cat /sys/class/dmi/id/chassis_type`
#Test for respectively Handheld, Notebook, Laptop, and Portable
chassis=`cat /sys/class/dmi/id/chassis_type`
#if chassis variable matches 8 9 10 or 11 function continues else it proceeds to test AC power and Battery
[[ "$chassis" =~ ^(8|9|10|11)$ ]] || return
#Tested machine is confirmed mobile
givePowerRecommendation=false
#Only check for AC and Battery power connections with upower
updevices=`/usr/bin/upower -e|grep -E 'AC|BAT'`
for pdev in $updevices; do
#Get detailed info for each AC and BAT device in upower
upinfo=`/usr/bin/upower -i $pdev|grep -E 'online|state'`
#Check for discharging state or AC power offline which is equal to no state
if [[ "$upinfo" =~ (discharging|no) ]]; then
#Give power recommendation only once, so set this to true
givePowerRecommendation=true
fi
done
if [ "$givePowerRecommendation" = true ]; then
[[ $chassis =~ ^(8|9|10|11)$ ]] || return
if [[ `systemd-ac-power -v` == "no" ]]; then
#if we are discharging show AC warning
log "AC Power disconnected and Battery is not charging"
displayACWarningMsg
fi
fi
}

verify_efi() {
Expand Down