File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- 3
1+ 4
Original file line number Diff line number Diff line change @@ -741,8 +741,9 @@ configure_battery_limit() {
741741 echo 80 | sudo tee " $battery_path " > /dev/null 2>&1
742742
743743 # Make persistent via systemd
744- # Note: We expand battery_path here intentionally, then write it literally to the service
745- local service_content=" [Unit]
744+ # Use heredoc with variable expansion for battery_path
745+ sudo tee /etc/systemd/system/battery-charge-limit.service > /dev/null 2>&1 << EOF
746+ [Unit]
746747Description=Set battery charge limit
747748After=multi-user.target
748749
@@ -752,8 +753,8 @@ ExecStart=/bin/bash -c 'echo 80 > $battery_path'
752753RemainAfterExit=yes
753754
754755[Install]
755- WantedBy=multi-user.target"
756- printf ' %s\n ' " $service_content " | sudo tee /etc/systemd/system/battery-charge-limit.service > /dev/null 2>&1
756+ WantedBy=multi-user.target
757+ EOF
757758 sudo systemctl daemon-reload 2> /dev/null || true
758759 sudo systemctl enable battery-charge-limit.service 2> /dev/null || true
759760 print_success " Battery limit set to 80%"
Original file line number Diff line number Diff line change @@ -675,7 +675,8 @@ check_reboot_needed() {
675675 print_step " Checking if reboot is required..."
676676
677677 # Check for kernel updates or other reboot-requiring changes
678- if ! dnf needs-restarting -r > /dev/null 2>&1 ; then
678+ # dnf needs-restarting -r returns 1 if reboot needed, 0 if not
679+ if dnf needs-restarting -r > /dev/null 2>&1 ; then
679680 echo " "
680681 echo -e " ${YELLOW} ╔═══════════════════════════════════════════════════════════╗${NC} "
681682 echo -e " ${YELLOW} ║ ${BOLD} Reboot Required${NC} ${YELLOW} ║${NC} "
You can’t perform that action at this time.
0 commit comments