Skip to content

Instantly share code, notes, and snippets.

@LazyDay
Last active April 20, 2022 04:33
Show Gist options
  • Save LazyDay/f8f9ca9a8ce9ab8d4061573edabe5ec8 to your computer and use it in GitHub Desktop.
Save LazyDay/f8f9ca9a8ce9ab8d4061573edabe5ec8 to your computer and use it in GitHub Desktop.
OS X 86 Reboot to windows, change default boot volume in clover, Siri shortcuts

Hi! I created some files to reboot from hackintosh to windows using clover.

Firstly you should create 3 config in /EFI/Clover:

  • config.plist
  • config_mac.plist // Config with mac Default boot volume
  • config_win.plist // Config with Windows as Default boot volume

The main idea is mac is default boot volume when you are using reboot to windows from mac, default config changed. After booting Windows default config changed again from win to mac.

There are 5 files

  • winboot.sh - This script using to reboot from mac to windows. Make symlink ln -s ./winboot.sh /usr/bin/winboot.sh

  • bootmac.sh - This script used as Launch deamon at mac os. When you boot os x, default boot volume change to mac. You alsa can copy it to /usr/bin, and use it in console.

  • com.bootmac.plist - Here we are created a launch deamon in os x. ls -s ./com.bootmac.olist /Library/LaunchDaemons/com.bootmac.plist After booting os x, script changed to mac default volume. It is created to fix, if we changed boot volume to windows, but we didn't boot it. And boot mac manually choosing OS X option in clover. And Windows stayed as default boot volume.

  • bootmac.ps1

  • bootmac.cmd

And what about windows??? We use a PowerShell script to change default boot volume from windows to mac, after booting Windows. We should created Powershell script, and create cmd script to launch Powershell as Admin. Change priveleges in cmd script to Run as administrator. Add to startup folder cmd script (To open wtartup folder press win+R), or add to Task scheduler (Dont forget to check run with Admin privilegios) Files are bootmac.ps1 and bootmac.cmd

What else? I created some shortcuts on my iphone, and reboot it from my phone. Also I can startup my computer by Wake On Lan. I have a NAS at home, and by ssh command I connected to NAS and send WOL packet. After booting I can connect to cumputer by SSH or VNC. And reboot it to windows, or to mac.

If you have some suggestion or questions write me [email protected]

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File "C:\Users\ld\bootmac.ps1"
mountvol g: /S
g:
cd g:\efi\clover
ls
cp config_mac.plist config.plist
Start-Sleep -Seconds 15
#!/bin/bash
EFI_FOLDER=/Volumes/EFI
if [ ! -d "$EFI_FOLDER" ]
then
sudo mkdir $EFI_FOLDER
sudo mount -t msdos /dev/disk0s1 $EFI_FOLDER
echo "EFI partition mounted"
fi
cd /Volumes/EFI/EFI/CLOVER
cp config_mac.plist config.plist
echo "OS X set as default in bootloader"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:</string>
</dict>
<key>Label</key>
<string>com.macboot</string>
<key>Program</key>
<string>/Users/ld/scripts/bootmac</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>LaunchOnlyOnce</key>
<true/>
<key>StandardOutPath</key>
<string>/tmp/bootmac.stdout</string>
<key>StandardErrorPath</key>
<string>/tmp/bootmac.stderr</string>
<key>UserName</key>
<string>ld</string>
<key>GroupName</key>
<string>staff</string>
<key>InitGroups</key>
<true/>
</dict>
</plist>
#!/bin/bash
EFI_FOLDER=/Volumes/EFI
if [ ! -d "$EFI_FOLDER" ]
then
sudo mkdir $EFI_FOLDER
sudo mount -t msdos /dev/disk0s1 $EFI_FOLDER
echo "EFI partition mounted"
fi
cd /Volumes/EFI/EFI/CLOVER
cp config_win.plist config.plist
echo "Windows set as default in bootloader"
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment