Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 KB | None | 0 0
  1. #!/bin/bash
  2. #https://apple.stackexchange.com/questions/107307/how-can-i-install-the-command-line-tools-completely-from-the-command-line
  3. #https://clover-wiki.zetam.org/Development
  4. echo Starting $(date +"%H:%M:%S")
  5. touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
  6. cltools=$(softwareupdate -l | grep "\*.*Command Line" | head -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | tr -d '\n')
  7. sudo -S <<< "password" softwareupdate -i "$cltools"
  8. cd ~
  9. mkdir src
  10. cd src
  11. svn co -r 20495 svn://svn.code.sf.net/p/edk2/code/trunk/edk2 edk2 --non-interactive --trust-server-cert --quiet
  12. cd edk2
  13. make -C BaseTools/Source/C 2> /dev/null | grep "Finished"
  14. svn co -r 3423 svn://svn.code.sf.net/p/cloverefiboot/code Clover --non-interactive --trust-server-cert --quiet
  15. cd Clover
  16. ./buildgettext.sh
  17. ./buildgcc-4.9.sh
  18. ./buildnasm.sh
  19. cd ..
  20. ./edksetup.sh
  21. cp -R Clover/Patches_for_EDK2/* ./
  22. cd Clover
  23. mbrdecl="
  24. EFI_HANDLE MyImageHandle;
  25. EFI_LOADED_IMAGE* MyLoadedImage;
  26. EFI_HANDLE MyDeviceHandle;
  27. EFI_DEVICE_PATH* MyDiskDevicePath;
  28. UINTN MyDevicePathSize;
  29. EFI_DEVICE_PATH* MyRemainingDevicePath = NULL;
  30. EFI_DEVICE_PATH* MyVolDevicePath;
  31. EFI_DEVICE_PATH* MyDevicePath;
  32. HARDDRIVE_DEVICE_PATH* MyHdPath = NULL;
  33. UINTN MyPartialLength = 0;
  34. EFI_HANDLE MyDiskHandle;
  35. EFI_BLOCK_IO* MyBlockIO;
  36. UINT8 MyMBR[512];
  37. "
  38. mbrpatch="
  39. MyImageHandle = gImageHandle;
  40. Status = gBS->HandleProtocol(MyImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &MyLoadedImage);
  41. MyDeviceHandle = MyLoadedImage->DeviceHandle;
  42. MyDiskDevicePath = DevicePathFromHandle(MyDeviceHandle);
  43. MyDevicePathSize = GetDevicePathSize(MyDiskDevicePath);
  44. MyVolDevicePath = AllocateAlignedPages(EFI_SIZE_TO_PAGES(MyDevicePathSize), 64);
  45. CopyMem(MyVolDevicePath, MyDiskDevicePath, MyDevicePathSize);
  46. MyDevicePath = DuplicateDevicePath(MyVolDevicePath);
  47. MyRemainingDevicePath = MyDevicePath;
  48. while (MyDevicePath && !IsDevicePathEnd(MyDevicePath)) {
  49. if ((DevicePathType(MyDevicePath) == MEDIA_DEVICE_PATH) &&
  50. (DevicePathSubType(MyDevicePath) == MEDIA_HARDDRIVE_DP)) {
  51. MyHdPath = (HARDDRIVE_DEVICE_PATH*)MyDevicePath;
  52. }
  53. MyDevicePath = NextDevicePathNode(MyDevicePath);
  54. }
  55. if (MyHdPath) {
  56. MyPartialLength = (UINTN)((UINT8*)MyHdPath - (UINT8*)MyRemainingDevicePath);
  57. if (MyPartialLength > 0x1000) {
  58. MyPartialLength = sizeof(EFI_DEVICE_PATH);
  59. }
  60. MyDiskDevicePath = (EFI_DEVICE_PATH*)AllocatePool(MyPartialLength + sizeof(EFI_DEVICE_PATH));
  61. CopyMem(MyDiskDevicePath, MyVolDevicePath, MyPartialLength);
  62. CopyMem((UINT8*)MyDiskDevicePath + MyPartialLength, MyDevicePath, sizeof(EFI_DEVICE_PATH));
  63. MyRemainingDevicePath = MyDiskDevicePath;
  64. Status = gBS->LocateDevicePath(&gEfiDevicePathProtocolGuid, &MyRemainingDevicePath, &MyDiskHandle);
  65. if (!EFI_ERROR(Status)) {
  66. Status = gBS->HandleProtocol(MyDiskHandle, &gEfiBlockIoProtocolGuid, (VOID **) &MyBlockIO);
  67. if (!EFI_ERROR(Status)) {
  68. if (MyBlockIO->Media->BlockSize == 512) {
  69. Status = MyBlockIO->ReadBlocks(MyBlockIO, MyBlockIO->Media->MediaId, 0, 512, MyMBR);
  70. if (!EFI_ERROR(Status)) {
  71. MyMBR[0x1C2] = (UINT8)0x07;
  72. Status = MyBlockIO->WriteBlocks(MyBlockIO, MyBlockIO->Media->MediaId, 0, 512, MyMBR);
  73. }
  74. } else
  75. MyBlockIO = NULL;
  76. } else
  77. MyBlockIO = NULL;
  78. }
  79. FreePool(MyDiskDevicePath);
  80. }
  81. "
  82. perl -i -pe 'BEGIN { undef $/; } s/(RefitMain.+?{)/$1'"$mbrdecl"'/s' rEFIt_UEFI/refit/main.c
  83. perl -i -pe 'BEGIN { undef $/; } s/(EfiGetSystemConfigurationTable.+?;)/$1'"$mbrpatch"'/s' rEFIt_UEFI/refit/main.c
  84. cp rEFIt_UEFI/refit/main.c ~/Desktop/
  85. ./ebuild.sh -mc | grep -v "^\["
  86. echo Finished $(date +"%H:%M:%S")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement