Skip to content

Simple grub script that sets the default boot entry based on a thumbdrive being connected

Notifications You must be signed in to change notification settings

sheepster1/thumbdrive_grub_boot_selector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Thumbdrive grub boot selector

A simple grub script, that sets the default boot entry based on a thumbdribe being connected or not

Installation

  1. Create a file in /etc/grub.d/01_thumbdrive_selector
  2. Write the following content to it:
#! /bin/sh

cat << 'EOF'
search --no-floppy --fs-uuid --set thumbdrive <fs-uuid>
if [ "${thumbdrive}" ] ; then
  set default="2" # Set boot entry 2 as default (Windows)
else
  set default="0" # Set boot entry 0 as default (Linux)
fi

EOF
  1. Find an fs uuid to use for detecting the thumbdrive with blkid. It should look something like this: xxxx-xxxx
  2. Replace <fs-uuid> with the id you got from step 3
  3. Make the script executable with chmod +x /etc/grub.d/01_thumbdrive_selector
  4. Run update-grub

About

Simple grub script that sets the default boot entry based on a thumbdrive being connected

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages