···1111}
12121313timeout= # Timeout in centiseconds
1414+menu=1 # Enable menu by default
1415default= # Default configuration
1516target=/boot # Target directory
1617numGenerations=0 # Number of other generations to include in the menu
17181819while getopts "t:c:d:g:n:r" opt; do
1920 case "$opt" in
2020- t) # U-Boot interprets '0' as infinite and negative as instant boot
2121+ t) # U-Boot interprets '0' as infinite
2122 if [ "$OPTARG" -lt 0 ]; then
2323+ # When negative (or null coerced to -1), disable timeout which means that we wait forever for input
2224 timeout=0
2325 elif [ "$OPTARG" = 0 ]; then
2424- timeout=-10
2626+ # When zero, which means disabled in Nix module, disable menu which results in instant boot of the default item
2727+ # .. timeout is actually ignored by u-Boot but set here for the rest of the script
2828+ timeout=1
2929+ menu=0
2530 else
3131+ # Positive results in centi-seconds of timeout, which when passed with no input results in boot of the default item
2632 timeout=$((OPTARG * 10))
2733 fi
2834 ;;
···126132# Change this to e.g. nixos-42 to temporarily boot to an older configuration.
127133DEFAULT nixos-default
128134129129-MENU TITLE ------------------------------------------------------------
130135TIMEOUT $timeout
131136EOF
137137+138138+[ "$menu" == "1" ] \
139139+ && echo "MENU TITLE ------------------------------------------------------------" >> $tmpFile
132140133141addEntry $default default >> $tmpFile
134142