Code Monkey home page Code Monkey logo

reboot-to-different-os-refind's Introduction

Reboot-to-different-os-rEFInd

Filler

So, after looking at Darkhogg's "Reboot to {OS}" scripts for rEFInd Next Boot selection scripts I realised that that method doesn't work for me.

I could not find the PreviousBoot file at /sys/firmware/efi/efivars.

So, I started looking around the rEFInd efi directory and voila Its in the /boot/efi/EFI/refind/vars directory.

How to do it

So instead of modifying the contents of the file

I decided to take the easy route and just replace the file with the one that makes rEFInd think that a different os was running before.

Retrieving the files

Getting the PreviousBoot file in linux (that will reboot to linux) is simple

Just copy /boot/efi/EFI/refind/vars/PreviousBoot file to somewhere safe and readable by Windows(ntfs partition prefered)

For Windows it gets a bit trickier

First you will have to mount the EFI partition with the command

mountvol P: /S

but even if its mounted its not visible in the file explorer ,only available from command line, but it was visible when i opened the task manager's new task's browse option.

Well, its good enough to do basic file managing.

Copy the same refind/vars/PreviousBoot file to somewhere safe and readable by linux

Also, The data in files is stored in UTF-16 character encoding

Replacing the files

well, to replace these files, just get the PreviousBoot file taken out from linux boot and copy it to rEFInd's vars directory.

To do this I made a few short scripts that gets the job done. You can add shutdown or reboot command too in the end

Windows

Windows.bat

mountvol P: /S

copy /y D:\location\of\linux\PreviousBoot P:\EFI\refind\vars\PreviousBoot

For windows save these commands in a .bat file and go to properties then advanced then select run as administrator always

Linux

sudo cp -f /home/user/path/to/Windows/PreviousBoot /boot/efi/EFI/refind/vars/PreviousBoot

For linux save it in a .bash file and make it executable in its properties

Thanks

Thanks to @Darkhogg for his Reboot to {OS} scripts https://gist.github.com/Darkhogg/82a651f40f835196df3b1bd1362f5b8c to give me the idea and the file's character encoding

Thanks to Superuser.com's user patkim for the tip of accessing efi directory from task manager's run browse option

this is copy of this gist made by me https://gist.github.com/NTB45/49576c74b557e3c2da90238c1ae5564f putting it in a repo would

reboot-to-different-os-refind's People

Contributors

ntb45 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.