Posted By

freephys on 08/03/10


Tagged

mac refit bless


Versions (?)

rEFItBlesser


 / Published in: Bash
 

  1. !/bin/sh
  2.  
  3. . /etc/rc.common
  4.  
  5.  
  6. # Set this variable if rEFIt is installed on a different volume. You must
  7. # make sure that the volume is mounted when the system shuts down.
  8. MOUNTPOINT=""
  9.  
  10.  
  11. MacOSXBlessed ()
  12. {
  13. if bless --info | grep 'Blessed System File' | grep ' /System/Library/CoreServices/boot.efi' >/dev/null 2>&1 ; then
  14. return 0
  15. fi
  16. return 1
  17. }
  18.  
  19.  
  20. StartService ()
  21. {
  22. if ! MacOSXBlessed ; then
  23. echo "rEFItBlesser blessing Mac OS X on Startup"
  24. bless --folder /System/Library/CoreServices --file /System/Library/CoreServices/boot.efi --setBoot
  25. fi
  26. return 0
  27. }
  28.  
  29. StopService ()
  30. {
  31. if [ -f "$MOUNTPOINT/efi/refit/refit.efi" ]; then
  32. if MacOSXBlessed ; then
  33. echo "rEFItBlesser blessing rEFIt on Shutdown"
  34. if [ -z "$MOUNTPOINT" ]; then
  35. bless --folder /efi/refit --file /efi/refit/refit.efi --labelfile /efi/refit/refit.vollabel --setBoot
  36. else
  37. bless --mount "$MOUNTPOINT" --file "$MOUNTPOINT/efi/refit/refit.efi" --setBoot
  38. fi
  39. fi
  40. fi
  41. return 0
  42. }
  43.  
  44. RestartService ()
  45. {
  46. return 0
  47. }
  48.  
  49. RunService "$1"

Report this snippet  

You need to login to post a comment.