- DefaultOptions="$GRUB_CMDLINE_LINUX $GRUB_CMDLINE_LINUX_DEFAULT"
- echo "\"Boot with standard options\" \"ro root=$RootFS $DefaultOptions \"" > $RLConfFile
- echo "\"Boot to single-user mode\" \"ro root=$RootFS $DefaultOptions single\"" >> $RLConfFile
- echo "\"Boot with minimal options\" \"ro root=$RootFS\"" >> $RLConfFile
+ if [[ $RootDir == "/" ]] ; then
+ DefaultOptions=`cat /proc/cmdline | cut -d ' ' -f 2- | sed 's/$/ /' | sed 's/initrd=.* //g' | sed 's/ *$//'`
+ else
+ if [[ -f "$RootDir/etc/default/grub" ]] ; then
+ # We want the default options used by the distribution, stored here....
+ source "$RootDir/etc/default/grub"
+ echo "Setting default boot options based on $RootDir/etc/default/grub"
+ fi
+ DefaultOptions="ro root=$RootFS $GRUB_CMDLINE_LINUX $GRUB_CMDLINE_LINUX_DEFAULT"
+ fi
+ echo "\"Boot with standard options\" \"$DefaultOptions\"" > $RLConfFile
+ echo "\"Boot to single-user mode\" \"$DefaultOptions single\"" >> $RLConfFile
+ echo "\"Boot with minimal options\" \"ro root=$RootFS\"" >> $RLConfFile