]> code.delx.au - refind/blob - mkrlconf.sh
Added support for "-1" value to "screensaver" token. Modified
[refind] / mkrlconf.sh
1 #!/bin/bash
2
3 # Script to create a refind_linux.conf file for the current Linux
4 # installation.
5
6 # copyright (c) 2012 by Roderick W. Smith
7 #
8 # This program is licensed under the terms of the GNU GPL, version 3,
9 # a copy of which should be distributed with this program.
10
11 # Usage:
12 #
13 # ./mkrlconf.sh [--force]
14 #
15 # Options:
16 #
17 # --force -- Overwrite an existing file (default is to not replace existing file)
18
19 # Revision history:
20 #
21 # 0.5.1 -- Initial release
22 #
23 # Note: mkrlconf.sh version numbers match those of the rEFInd package
24 # with which they first appeared.
25
26 RLConfFile="/boot/refind_linux.conf"
27
28 if [[ ! -f $RLConfFile || $1 == "--force" ]] ; then
29 if [[ -f /etc/default/grub ]] ; then
30 # We want the default options used by the distribution, stored here....
31 source /etc/default/grub
32 fi
33 RootFS=`df / | grep dev | cut -f 1 -d " "`
34 StartOfDevname=`echo $RootFS | cut -b 1-7`
35 if [[ $StartOfDevname == "/dev/sd" || $StartOfDevName == "/dev/hd" ]] ; then
36 # Identify root filesystem by UUID rather than by device node, if possible
37 Uuid=`blkid -o export $RootFS 2> /dev/null | grep UUID=`
38 if [[ -n $Uuid ]] ; then
39 RootFS=$Uuid
40 fi
41 fi
42 DefaultOptions="$GRUB_CMDLINE_LINUX $GRUB_CMDLINE_LINUX_DEFAULT"
43 echo "\"Boot with standard options\" \"ro root=$RootFS $DefaultOptions \"" > $RLConfFile
44 echo "\"Boot to single-user mode\" \"ro root=$RootFS $DefaultOptions single\"" >> $RLConfFile
45 echo "\"Boot without EFI storage paranoia\" \"ro root=$RootFS $DefaultOptions efi_no_storage_paranoia\"" >> $RLConfFile
46 echo "\"Boot with minimal options\" \"ro root=$RootFS\"" >> $RLConfFile
47 else
48 echo "Existing $RLConfFile found! Not overwriting!"
49 echo "To force overwriting, pass the --force option."
50 echo ""
51 fi