Skip to content

Commit 2758c53

Browse files
author
Marcus Funch
committed
Merge branch 'feature/58020_make_grub_menu_accessible' into 'master'
Add script to toggle whether the GRUB menu is shown See merge request os2borgerpc/os2borgerpc-scripts!260
2 parents dd7e0f9 + 80104d3 commit 2758c53

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#! /usr/bin/env sh
2+
3+
GRUB_MENU_ACCESSIBLE="$1"
4+
WAIT_HOW_LONG="$2" # set to -1 to wait forever
5+
6+
GRUB_CONFIG="/etc/default/grub"
7+
8+
set -x
9+
10+
echo "Show relevant settings before:"
11+
grep "TIMEOUT_STYLE" $GRUB_CONFIG
12+
grep "GRUB_TIMEOUT=" $GRUB_CONFIG
13+
14+
if [ "$GRUB_MENU_ACCESSIBLE" = "True" ]; then
15+
sed --in-place "s/GRUB_TIMEOUT_STYLE=hidden/GRUB_TIMEOUT_STYLE=menu/" $GRUB_CONFIG
16+
sed --in-place "s/GRUB_TIMEOUT=.*/GRUB_TIMEOUT=$WAIT_HOW_LONG/" $GRUB_CONFIG
17+
else
18+
sed --in-place "s/GRUB_TIMEOUT_STYLE=menu/GRUB_TIMEOUT_STYLE=hidden/" $GRUB_CONFIG
19+
sed --in-place "s/GRUB_TIMEOUT=.*/GRUB_TIMEOUT=0/" $GRUB_CONFIG
20+
fi
21+
22+
echo "Show full GRUB config after:"
23+
cat $GRUB_CONFIG
24+
25+
# Now update GRUB's actual configuration with the new settings
26+
update-grub

0 commit comments

Comments
 (0)