Skip to content

Commit

Permalink
add Auto keep next boot
Browse files Browse the repository at this point in the history
  • Loading branch information
honjow committed Sep 6, 2023
1 parent ab32f3d commit 0c7f063
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions manifest
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ export SERVICES="\
ryzenadj-controller \
sshd \
systemd-timesyncd \
sk-auto-keep-boot-entry \
"

export USER_SERVICES="\
Expand Down
10 changes: 10 additions & 0 deletions rootfs/etc/systemd/system/sk-auto-keep-boot-entry.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Auto keep next boot entry
After=network.target

[Service]
Type=oneshot
ExecStart=/usr/bin/sk-set-next-boot-entry

[Install]
WantedBy=multi-user.target
15 changes: 15 additions & 0 deletions rootfs/usr/bin/sk-set-next-boot-entry
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# 使用efibootmgr获取当前的启动项编号
boot_current=$(efibootmgr | grep "BootCurrent" | awk -F' ' '{print $2}')

# 如果没有找到启动项编号,则输出错误信息并退出
if [ -z "$boot_current" ]; then
echo "无法获取当前的启动项编号"
exit 1
fi

# 使用efibootmgr -n设置新的启动项编号
efibootmgr -n "$boot_current"

echo "已将启动项设置为: $boot_current"

0 comments on commit 0c7f063

Please sign in to comment.