2

Is there a way in 16.04 LTS to add a custom button to the login screen that runs a bash script?

The reason I need this is for dual-booting, so I can add a button on the login screen that will switch the OS to Windows and reboot. I'm looking to add the same button on the reverse in Windows as well.

Jamesking56
  • 205
  • 4
  • 13
  • This doesn't answer your question but ... is there any reason why you can't just make this selection from grub ? – hatterman Apr 24 '18 at 13:59
  • Because I want to do it over WOL / VPN / RDP – Jamesking56 Apr 24 '18 at 14:01
  • I can tell you a workaround that I have used before. Edit '/boot/grub/grub.cfg' and set the GRUB_DEFAULT entry to the desired OS. I made a bash script called OS1 and a scipt called OS2 that would edit the file and reboot. Not at all elegent and can't be triggered from the login screen but it worked like a charm for me and might give you food for thought in the meanwhile ? – hatterman Apr 24 '18 at 14:14
  • Would that mean I'd have to WOL, login to VPN, login to Ubuntu and then click that script just to get into Windows (and vice-versa)? – Jamesking56 Apr 24 '18 at 14:18
  • 1
    Yes, exactly that. However, its even easier using grub-reboot. Let me add an answer.... – hatterman Apr 24 '18 at 14:27

1 Answers1

0

Don't think your going to be able to add login screen buttons, so here is my answer.

If you follow the answer here :

How can I get grub2 to boot a different option only on the next boot?

You should be able to set it up so that it always boots into Ubuntu by default, then from the Ubuntu command line (once logged in) you will be able to perform a 1 time reboot into Windows using ;

grub-reboot <windows entry>

So if Windows is the 3rd entry in the grub entry (starts at 0);

grub-reboot 2

Once booted into Windows, you simply reboot as normal to boot back into Ubuntu.

Repeat as needed.

hatterman
  • 2,280
  • 2
  • 22
  • 33