Skip to content

Commit 7ca1a92

Browse files
mf-fxMarcus Funch
authored and
Marcus Funch
committed
Add script to toggle whether the GRUB menu is shown
1 parent dd7e0f9 commit 7ca1a92

File tree

1 file changed

+25
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)