Skip to content

Commit 3a1bce3

Browse files
committed
fix: Correct box alignment, three-way merge, battery service, and reboot check (v4)
1 parent d4c3bd0 commit 3a1bce3

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3
1+
4

install.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff 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]
746747
Description=Set battery charge limit
747748
After=multi-user.target
748749
@@ -752,8 +753,8 @@ ExecStart=/bin/bash -c 'echo 80 > $battery_path'
752753
RemainAfterExit=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%"

update.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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}"

0 commit comments

Comments
 (0)