Skip to content

Commit 80104d3

Browse files
mf-fxMarcus Funch
authored and
Marcus Funch
committed
GRUB menu script: Make the time to wait configurable
1 parent 7ca1a92 commit 80104d3

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed
+13-12
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
#! /usr/bin/env sh
22

33
GRUB_MENU_ACCESSIBLE="$1"
4-
5-
set -x
4+
WAIT_HOW_LONG="$2" # set to -1 to wait forever
65

76
GRUB_CONFIG="/etc/default/grub"
87

9-
echo "Show full GRUB config before"
10-
cat $GRUB_CONFIG
8+
set -x
9+
10+
echo "Show relevant settings before:"
11+
grep "TIMEOUT_STYLE" $GRUB_CONFIG
12+
grep "GRUB_TIMEOUT=" $GRUB_CONFIG
1113

1214
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+
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
1517
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+
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
1820
fi
1921

20-
echo "Show relevant settings after:"
21-
grep "TIMEOUT_STYLE" $GRUB_CONFIG
22-
grep "GRUB_TIMEOUT=" $GRUB_CONFIG
22+
echo "Show full GRUB config after:"
23+
cat $GRUB_CONFIG
2324

24-
# Now update GRUB with the new settings
25+
# Now update GRUB's actual configuration with the new settings
2526
update-grub

0 commit comments

Comments
 (0)