├── LICENSE ├── OC-Update.command └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 CorpNewt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /OC-Update.command: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | clear 4 | 5 | ARCHS=X64 6 | TARGETS=RELEASE 7 | RTARGETS=RELEASE 8 | 9 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 10 | 11 | oc_url="https://github.com/acidanthera/OpenCorePkg" 12 | oc_binary_data_url="https://github.com/acidanthera/OcBinaryData/archive/refs/heads/master.zip" 13 | oc_json_url="https://api.github.com/repos/acidanthera/OpenCorePkg/releases/latest" 14 | oc_html_url="https://github.com/acidanthera/OpenCorePkg/releases" 15 | oc_dortania_url="https://dortania.github.io/build-repo/latest.json" 16 | to_copy="TRUE" 17 | to_build="TRUE" 18 | skip_contentVisibility="FALSE" 19 | to_opencanopy="TRUE" 20 | to_force="FALSE" 21 | to_reveal="FALSE" 22 | copy_zip="TRUE" 23 | in_source="build" 24 | use_json="FALSE" 25 | FORCE_INSTALL=0 26 | 27 | exclusions=() 28 | target_disk="$(nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:boot-path | sed 's/.*GPT,\([^,]*\),.*/\1/')" 29 | 30 | function print_help () { 31 | echo "usage: OC-Update.command [-h] [-c] [-b] [-v] [-o] [-f] [-l] [-r] [-g]" 32 | echo " [-d DISK] [-e NAME] [-e NAME] [-e...]" 33 | echo "" 34 | echo "OC-Update - a bash script to update OpenCore and efi drivers" 35 | echo "" 36 | echo "optional arguments:" 37 | echo " -h, --help show this help message and exit" 38 | echo " -c, --no-copy don't copy results to target disk" 39 | echo " -b, --no-build don't clone and build repos, use what's in the OC" 40 | echo " folder already" 41 | echo " -v, --skip-cv-files skip checking for and writing \"Disabled\" to" 42 | echo " .contentVisibility files in OC and BOOT folders" 43 | echo " BOOT is only checked if BOOTx64.efi belongs to OC" 44 | echo " -o, --no-opencanopy skip checking OpenCanopy Resources for changes" 45 | echo " -f, --force force update OpenCanopy Resources - overrides -l" 46 | echo " -l, --list-changes only list OpenCanopy changes, don't update files" 47 | echo " -n, --no-bin-prompt force install any missing required binaries," 48 | echo " exports FORCE_INSTALL=1 for efibuild.sh" 49 | echo " -r, --reveal reveal the temp folder after building" 50 | echo " -i, --ia32 build IA32 (32-bit) instead of X64 (64-bit)" 51 | echo " -g, --debug build the debug version of OC and .efi drivers" 52 | echo " -z, --no-zip don't copy the OpenCore-[version]-[target].zip to" 53 | echo " the OC folder" 54 | echo " -d DISK, --disk DISK the mount point/identifier to target" 55 | echo " -p PATH, --path PATH an explicit path to use for the EFI - overrides -d" 56 | echo " -e NAME, --exclude NAME regex to exclude matching file/folder names from" 57 | echo " OpenCanopy Resources to update - can be used" 58 | echo " more than once, case-insensitive" 59 | echo " -s SRC, --source SRC uses the passed SRC location. SRC can be build," 60 | echo " github, or dortania. Default is build. Both github" 61 | echo " and dortania will download prebuilt zip files." 62 | echo " -j --use-json-api forces the use of the github json api for downloading" 63 | echo " instead of scraping HTML directly - may rate limit" 64 | echo " Requires '-s github'" 65 | } 66 | 67 | while [[ "$#" -gt 0 ]]; do 68 | case $1 in 69 | -h|--help) print_help; exit 0 ;; 70 | -c|--no-copy) to_copy="FALSE" ;; 71 | -b|--no-build) to_build="FALSE" ;; 72 | -v|--skip-cv-files) skip_contentVisibility="TRUE" ;; 73 | -o|--no-opencanopy) to_opencanopy="FALSE" ;; 74 | -f|--force) to_force="TRUE" ;; 75 | -l|--list-changes) to_list="TRUE" ;; 76 | -n|--no-bin-prompt) FORCE_INSTALL=1 ;; 77 | -r|--reveal) to_reveal="TRUE" ;; 78 | -i|--ia32) ARCHS=IA32 ;; 79 | -g|--debug) TARGETS=DEBUG; RTARGETS=DEBUG ;; 80 | -z|--no-zip) copy_zip="FALSE" ;; 81 | -d|--disk) target_disk="$2"; shift ;; 82 | -p|--path) target_path="$2"; shift ;; 83 | -e|--exclude) exclusions+=( "$2" ); shift ;; 84 | -s|--source) in_source="$2"; shift ;; 85 | -j|--use-json-api) use_json="TRUE" ;; 86 | *) echo "Unknown parameter passed: $1"; print_help; exit 1 ;; 87 | esac 88 | shift 89 | done 90 | 91 | function cleanup () { 92 | if [ ! -z "$temp" ] && [ -d "$temp" ]; then 93 | rm -Rf "$temp" 94 | fi 95 | } 96 | 97 | # Ensure we clean up if there are issues 98 | trap cleanup EXIT 99 | 100 | # Verify our source 101 | source="$(echo $in_source | tr '[:upper:]' '[:lower:]' | grep -E '(build|github|dortania)')" 102 | if [ -z "$source" ]; then 103 | echo "'$in_source' is not a valid --source option." 104 | echo "The valid options are: build, github, dortania" 105 | exit 1 106 | fi 107 | 108 | export ARCHS 109 | export TARGETS 110 | export RTARGETS 111 | if [ "$FORCE_INSTALL" == "1" ]; then 112 | export FORCE_INSTALL 113 | fi 114 | 115 | function clone_and_build () { 116 | local name="$1" 117 | local url="$2" 118 | local temp="$3" 119 | local nobuild="$4" 120 | cd "$temp" 121 | echo "Cloning $url..." 122 | git clone "$url" && cd "$name" 123 | if [ -z "$nobuild" ]; then 124 | echo " - Building..." 125 | # First we symlink the UDK dir if it exists in the temp folder 126 | if [ -d "$temp/UDK" ]; then 127 | echo " - Linking UDK..." 128 | ln -s "$temp/UDK" "$temp/$name/UDK" 129 | echo " - Linking $name..." 130 | ln -s "$temp/$name" "$temp/UDK/$name" 131 | fi 132 | if [ -e "build_oc.tool" ]; then 133 | echo " - Running build_oc.tool" 134 | ./build_oc.tool 135 | elif [ -e "macbuild.tool" ]; then 136 | echo " - Running macbuild.tool" 137 | ./macbuild.tool 138 | else 139 | echo " - No known build tool found - skipping." 140 | fi 141 | fi 142 | } 143 | 144 | function compare_path () { 145 | local path="${1%/}"; shift # The path to append to both prefixes to check 146 | local source="$1"; shift # The source path prefix 147 | local dest="$1"; shift # The destination path prefix 148 | local response="$1"; shift # LIST to only list, FORCE to replace even if it exist 149 | local indent="$1"; shift # Prefix to indent with 150 | local exclude=("$@") # An array of names to exclude - will be checked case-insensitively 151 | local to_skip="FALSE" 152 | echo "$indent""+ $(basename "$source/$path")..." 153 | ls "$source/$path" | while read f; do 154 | to_skip="FALSE" 155 | for e in "${exclude[@]}"; do 156 | if [ "$(echo "$f" | grep -Ei "$e")" ]; then 157 | to_skip="TRUE" 158 | break 159 | fi 160 | done 161 | # Skip if we're excluding it 162 | if [ "$to_skip" == "TRUE" ]; then 163 | prefix="-" 164 | if [ -d "$source/$path/$f" ]; then 165 | prefix="+" 166 | fi 167 | echo "$indent"" $prefix $f skipped per exclusions..." 168 | continue 169 | fi 170 | # Check if it already exists - and what type of responses 171 | if [ -d "$source/$path/$f" ]; then 172 | # echo "$indent"" - Found '$f' directory..." 173 | # Ensure the target has it if we need it 174 | if [ ! -d "$dest/$path/$f" ]; then 175 | if [ "$response" == "LIST" ]; then 176 | echo "$indent"" +-> Missing $f..." 177 | else 178 | echo "$indent"" +-> Copying $f to destination..." 179 | cp -R "$source/$path/$f" "$dest/$path/$f" 180 | fi 181 | else 182 | compare_path "$path/$f" "$source" "$dest" "$response" "$indent " "${exclude[@]}" 183 | fi 184 | else 185 | if [ ! -e "$dest/$path/$f" ] && [ "$response" == "LIST" ]; then 186 | echo "$indent"" --> Missing $f..." 187 | elif [ ! -e "$dest/$path/$f" ] || [ "$response" == "FORCE" ]; then 188 | echo "$indent"" --> Copying $f..." 189 | cp "$source/$path/$f" "$dest/$path/$f" 190 | fi 191 | fi 192 | done 193 | } 194 | 195 | function find_and_copy () { 196 | local source="$1" 197 | local dest="$2" 198 | local name="$3" 199 | local args="$4" 200 | local include="$5" 201 | local exclude="$6" 202 | local dir="$PWD" 203 | cd "$source" 204 | find . -name "$name" $(echo $args) | while read f; do 205 | # Make sure that we have a match if we're including something 206 | if [ ! -z "$include" ] && [ -z "$(echo "$f" | grep -Ei "$include")" ]; then 207 | continue 208 | fi 209 | # Make sure we *don't* have a match if we're excluding 210 | if [ ! -z "$exclude" ] && [ ! -z "$(echo "$f" | grep -Ei "$exclude")" ]; then 211 | continue 212 | fi 213 | # We should have a match here - print it out 214 | echo "Copying $(basename "$f") to $(basename "$dest")..." 215 | cp "$f" "$dest" 216 | done 217 | # Restore the original CD 218 | cd "$PWD" 219 | } 220 | 221 | # Time to clone and build - let's clone the UDK repo first, as all others need this - we need to touch the 222 | # Build the .efi drivers and OC 223 | if [ "$to_build" != "FALSE" ]; then 224 | if [ -e "$DIR/OC" ]; then 225 | echo "Removing previously built drivers..." 226 | rm -rf "$DIR/OC" 227 | fi 228 | 229 | # << 'COMMENT' 230 | 231 | # echo "Running caffeinate to prevent idle sleep..." 232 | # echo " - Bound to PID $$" 233 | # caffeinate -i -w $$ & 234 | 235 | temp=$(mktemp -d) 236 | 237 | echo "Creating OC folder..." 238 | mkdir "$DIR/OC" 239 | 240 | # Download using github's json api - or clone and build locally 241 | if [ "$source" != "build" ]; then 242 | echo "Checking $source for latest release..." 243 | if [ "$source" == "github" ]; then 244 | if [ "$use_json" == "TRUE" ]; then 245 | echo " - Using the JSON API" 246 | json="$(curl -s "$oc_json_url")" 247 | if [ -z "$json" ]; then 248 | echo " - No data returned! Aborting..." 249 | exit 1 250 | fi 251 | zip_url="https://github.com/acidanthera/OpenCorePkg$(echo $json | grep -Eo "\/releases\/download[^ ]+$TARGETS\.zip")" 252 | else 253 | # Using html instead - extract the expanded assets URL 254 | echo " - Scraping the HTML directly" 255 | asset_url="$(curl -s "$oc_html_url" | grep -i expanded_assets | head -n 1 | grep -Eo 'https:[^"]+')" 256 | if [ -z "$asset_url" ]; then 257 | echo " - No data returned! Aborting..." 258 | exit 1 259 | fi 260 | zip_url="https://github.com/acidanthera/OpenCorePkg$(curl -s "$asset_url" | grep -Eo "\/releases\/download[^ ]+$TARGETS\.zip")" 261 | fi 262 | else 263 | json="$(curl -s "$oc_dortania_url")" 264 | if [ -z "$json" ]; then 265 | echo " - No data returned! Aborting..." 266 | exit 1 267 | fi 268 | zip_url="https://github.com/dortania/build-repo$(echo $json | grep -Eo "\/releases\/download\/OpenCorePkg-[^ ]+$TARGETS\.zip")" 269 | fi 270 | # Check to make sure we got something 271 | if [ -z "$zip_url" ]; then 272 | echo " - Missing $TARGETS data! Aborting..." 273 | exit 1 274 | fi 275 | # Extract the version number and file name 276 | ver="$(echo $zip_url | grep -Eo "\-(\d+\.?)+\-" | cut -d'-' -f2)" 277 | if [ -z "$ver" ]; then 278 | echo " - Could not extract version! Aborting..." 279 | exit 1 280 | fi 281 | echo " - Got v$ver" 282 | zip_name="$(basename $zip_url)" 283 | if [ -z "$zip_name" ]; then 284 | echo " - Could not extract zip file name! Aborting..." 285 | exit 1 286 | fi 287 | echo "Downloading $zip_name..." 288 | mkdir -p "$temp/OpenCorePkg/Binaries" 289 | curl -L -s $zip_url --output "$temp/OpenCorePkg/Binaries/$zip_name" 290 | if [ ! -f "$temp/OpenCorePkg/Binaries/$zip_name" ]; then 291 | echo " - Download failed! Aborting..." 292 | exit 1 293 | fi 294 | echo "Unzipping $zip_name..." 295 | unzip -o "$temp/OpenCorePkg/Binaries/$zip_name" -d "$temp/OpenCorePkg" > /dev/null 296 | echo "Moving files into place..." 297 | cp "$temp/OpenCorePkg/$ARCHS/EFI/BOOT/BOOTx64.efi" "$temp/OpenCorePkg/$ARCHS/EFI/OC/Bootstrap.efi" 298 | find "$temp/OpenCorePkg/$ARCHS" -name "*.efi" -print0 | xargs -0 -I {} mv {} "$temp/OpenCorePkg/$ARCHS" 299 | build_dir="$temp/OpenCorePkg" 300 | else 301 | clone_and_build "OpenCorePkg" "$oc_url" "$temp" 302 | fi 303 | 304 | # Get the binary data 305 | echo "Downloading OcBinaryData..." 306 | curl -sLo "$temp/OcBinaryData.zip" "$oc_binary_data_url" 307 | echo "Unzipping OcBinaryData..." 308 | # Get the directory name from the zip if possible 309 | ocb_dir="$(zipinfo -1 "$temp/OcBinaryData.zip" "*/" | head -n 1)" 310 | ocb_dir="${ocb_dir%/}" 311 | unzip -o "$temp/OcBinaryData.zip" -d "$temp" > /dev/null 312 | echo "Moving files into place..." 313 | mv "$temp/$ocb_dir" "$temp/OcBinaryData" 314 | 315 | # Reveal the built folder if needed 316 | if [ "$to_reveal" == "TRUE" ]; then 317 | open "$temp" 318 | read -p "Press [enter] to continue..." 319 | fi 320 | 321 | # Copy the final zip over unless told not to 322 | zip_path="$(find "$temp/OpenCorePkg/Binaries" -name "OpenCore*$TARGETS.zip" -type f -maxdepth 1 | sed -n 1p)" 323 | if [ "$copy_zip" == "TRUE" ] && [ -f "$zip_path" ]; then 324 | echo "Copying $(basename "$zip_path") to OC folder..." 325 | cp "$zip_path" "$DIR/OC" 326 | fi 327 | 328 | # Clean out the Utilities folder - if it exists 329 | utils_dir="$temp/OpenCorePkg/Utilities" 330 | if [ -d "$utils_dir" ]; then 331 | echo "Pruning Utilities folder..." 332 | # Clear nested directories 333 | find "$utils_dir" -type d -mindepth 2 -exec rm -rf {} + 2>/dev/null 334 | # Strip source and unneeded files 335 | find "$utils_dir" -type f -maxdepth 2 | grep -E "(?i).*(test.*|\.c|\.h|make(file)?|license)$" | while read line; do rm "$line"; done; 2>/dev/null 336 | # Clear empty directories 337 | find "$utils_dir" -type d -empty -exec rm -rf {} + 2>/dev/null 338 | echo "Copying Utilities to OC folder..." 339 | cp -R "$utils_dir" "$DIR/OC/Utilities" 340 | fi 341 | 342 | # Copy over the Docs folder 343 | docs_dir="$temp/OpenCorePkg/Docs" 344 | if [ -d "$docs_dir" ]; then 345 | echo "Copying Docs to OC folder..." 346 | cp -R "$docs_dir" "$DIR/OC/Docs" 347 | fi 348 | 349 | # Get the build directory - release is typically RELEASE_XCODE5 350 | if [ -z "$build_dir" ]; then 351 | build_dir="$(find "$temp/OpenCorePkg/UDK/Build/OpenCorePkg" -name ""$TARGETS"_XCODE*" -type d -maxdepth 1 | sed -n 1p)" 2>/dev/null 352 | fi 353 | if [ ! -z "$build_dir" ] && [ -d "$build_dir/$ARCHS" ]; then 354 | # Now we find all .efi drivers and copy them over 355 | args="-name "*.efi" -maxdepth 1" 356 | find_and_copy "$build_dir/$ARCHS" "$DIR/OC" "*.efi" "-maxdepth 1" 357 | # Special check for the Shell.efi file - as it gets renamed to OpenShell.efi in build_oc.tool 358 | if [ -e "$DIR/OC/Shell.efi" ]; then 359 | echo "Copying Shell.efi to OpenShell.efi in OC folder..." 360 | cp "$DIR/OC/Shell.efi" "$DIR/OC/OpenShell.efi" 361 | fi 362 | fi 363 | 364 | # Gather any .efi drivers from OcBinaryData 365 | if [ -d "$temp/OcBinaryData/Drivers" ]; then 366 | find_and_copy "$temp/OcBinaryData/Drivers" "$DIR/OC" "*.efi" 367 | fi 368 | 369 | # Let's copy the Resources folder over too 370 | if [ -d "$temp/OcBinaryData/Resources" ]; then 371 | echo "Copying OcBinaryData/Resources to OC folder..." 372 | cp -R "$temp/OcBinaryData/Resources" "$DIR/OC/Resources" 373 | fi 374 | 375 | # Clean up 376 | cleanup 377 | 378 | # COMMENT 379 | fi 380 | 381 | if [ "$to_copy" != "TRUE" ]; then 382 | echo "Done." 383 | exit 0 384 | fi 385 | 386 | mounted="" 387 | vol_name="EFI" 388 | oc_path="" 389 | boot_path="" 390 | efi="" 391 | 392 | # See if we're working with a target folder, or target disk 393 | if [ "$target_path" != "" ]; then 394 | # Check for path/EFI/OC|BOOT 395 | if [ -d "$target_path/EFI/OC" ]; then 396 | oc_path="$target_path/EFI/OC" 397 | fi 398 | if [ -d "$target_path/EFI/BOOT" ]; then 399 | boot_path="$target_path/EFI/BOOT" 400 | fi 401 | # Check for path/OC|BOOT 402 | if [ -d "$target_path/OC" ]; then 403 | oc_path="$target_path/OC" 404 | fi 405 | if [ -d "$target_path/BOOT" ]; then 406 | boot_path="$target_path/BOOT" 407 | fi 408 | # Check for path/OpenCore.efi|BOOTx64.efi 409 | if [ -e "$target_path/OpenCore.efi" ]; then 410 | oc_path="$target_path" 411 | fi 412 | if [ -e "$target_path/BOOTx64.efi" ]; then 413 | boot_path="$target_path" 414 | fi 415 | else 416 | # Did not get a folder path - let's check for a disk 417 | if [ "$target_disk" == "" ]; then 418 | # Check for an existing EFI/ESP 419 | efi="" 420 | if [ -d "/Volumes/EFI" ]; then 421 | efi="/Volumes/EFI" 422 | elif [ -d "/Volumes/ESP" ]; then 423 | efi="/Volumes/ESP" 424 | fi 425 | else 426 | # Got the UUID, see if it's mounted 427 | vol_name="$(diskutil info "$target_disk" | grep -i "Volume Name:" | awk '{ $1=""; $2=""; print }' | sed 's/^[ \t]*//;s/[ \t]*$//')" 428 | efi="$(diskutil info "$target_disk" | grep -i "Mount Point:" | awk '{ $1=""; $2=""; print }' | sed 's/^[ \t]*//;s/[ \t]*$//')" 429 | if [ "$efi" == "" ]; then 430 | # Not mounted 431 | mounted="False" 432 | echo "$vol_name not mounted - mounting..." 433 | sudo diskutil mount "$target_disk" 434 | efi="$(diskutil info "$target_disk" | grep -i "Mount Point:" | awk '{ $1=""; $2=""; print }' | sed 's/^[ \t]*//;s/[ \t]*$//')" 435 | fi 436 | # One last check - if not mounted, we alert the user 437 | if [ "$efi" == "" ]; then 438 | echo "Failed to mount $vol_name." 439 | mounted="" 440 | fi 441 | fi 442 | # Set our target folders if we got a mount point 443 | if [ "$efi" != "" ]; then 444 | oc_path="$efi/EFI/OC" 445 | boot_path="$efi/EFI/BOOT" 446 | fi 447 | fi 448 | # Check if we have an OC path to walk 449 | if [ "$oc_path" != "" ] || [ "$boot_path" != "" ]; then 450 | # Replace // with / in our paths 451 | oc_path="$(echo "$oc_path" | tr -s /)" 452 | boot_path="$(echo "$boot_path" | tr -s /)" 453 | echo "Updating .efi files..." 454 | if [ -d "$boot_path" ]; then 455 | echo "Located BOOT directory at "$boot_path"..." 456 | if [ -e "$DIR/OC/Bootstrap.efi" ] && [ -e "$boot_path/BOOTx64.efi" ]; then 457 | echo "Verifying BOOTx64.efi..." 458 | grep -i OpenCore "$boot_path/BOOTx64.efi" 2>&1 >/dev/null 459 | if [ "$?" == "0" ]; then 460 | echo " - Belongs to OpenCore - updating..." 461 | cp "$DIR/OC/Bootstrap.efi" "$boot_path/BOOTx64.efi" 462 | # Check for .contentVisibility - and create if needed 463 | if [ "$skip_contentVisibility" != "TRUE" ] && [ ! -e "$boot_path/.contentVisibility" ]; then 464 | echo " - Creating disabled .contentVisibility file..." 465 | echo -n "Disabled" > "$boot_path/.contentVisibility" 466 | fi 467 | else 468 | echo " - Does not belong to OpenCore - skipping..." 469 | fi 470 | else 471 | echo "Bootstrap.efi or BOOTx64.efi not found!" 472 | fi 473 | fi 474 | if [ -d "$oc_path" ]; then 475 | echo "Located OC directory at "$oc_path"..." 476 | if [ -e "$DIR/OC/OpenCore.efi" ] && [ -e "$oc_path/OpenCore.efi" ]; then 477 | echo "Updating OpenCore.efi..." 478 | cp "$DIR/OC/OpenCore.efi" "$oc_path/OpenCore.efi" 479 | else 480 | echo "OpenCore.efi not found!" 481 | fi 482 | # Check for .contentVisibility - and create if needed 483 | if [ "$skip_contentVisibility" != "TRUE" ] && [ ! -e "$oc_path/.contentVisibility" ]; then 484 | echo "Creating disabled .contentVisibility file..." 485 | echo -n "Disabled" > "$oc_path/.contentVisibility" 486 | fi 487 | if [ -e "$DIR/OC/Bootstrap.efi" ] && [ -e "$oc_path/Bootstrap/Bootstrap.efi" ]; then 488 | echo "Updating Bootstrap.efi..." 489 | cp "$DIR/OC/Bootstrap.efi" "$oc_path/Bootstrap/Bootstrap.efi" 490 | fi 491 | if [ -d "$oc_path/Drivers" ]; then 492 | echo "Updating .efi drivers..." 493 | ls "$oc_path/Drivers" | while read f; do 494 | if [ -e "$DIR/OC/$f" ]; then 495 | echo " - Found $f, replacing..." 496 | cp "$DIR/OC/$f" "$oc_path/Drivers/$f" 497 | fi 498 | done 499 | fi 500 | fi 501 | if [ "$to_opencanopy" != "FALSE" ] && [ -d "$DIR/OC/Resources" ] && [ -d "$oc_path/Resources" ]; then 502 | echo "Walking OpenCanopy Resources..." 503 | if [ "$to_force" == "TRUE" ]; then 504 | response="FORCE" 505 | elif [ "$to_list" == "TRUE" ]; then 506 | response="LIST" 507 | else 508 | response="" 509 | fi 510 | compare_path "" "$DIR/OC/Resources" "$oc_path/Resources" "$response" " " "${exclusions[@]}" 511 | fi 512 | fi 513 | 514 | if [ "$mounted" != "" ]; then 515 | echo "Unmounting $vol_name..." 516 | diskutil unmount "$target_disk" 517 | fi 518 | # All done 519 | echo "Done." 520 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OC-Update 2 | Bash script to update OpenCore and some efi drivers 3 | 4 | ## Help Output 5 | 6 | usage: OC-Update.command [-h] [-c] [-b] [-o] [-f] [-l] [-r] [-g] 7 | [-d DISK] [-e NAME] [-e NAME] [-e...] 8 | 9 | OC-Update - a bash script to update OpenCore and efi drivers 10 | 11 | optional arguments: 12 | -h, --help show this help message and exit 13 | -c, --no-copy don't copy results to target disk 14 | -b, --no-build don't clone and build repos, use what's in the OC 15 | folder already 16 | -o, --no-opencanopy skip checking OpenCanopy Resources for changes 17 | -f, --force force update OpenCanopy Resources - overrides -l 18 | -l, --list-changes only list OpenCanopy changes, don't update files 19 | -r, --reveal reveal the temp folder after building 20 | -g, --debug build the debug version of OC 21 | -d DISK, --disk DISK the mount point/identifier to target 22 | -e NAME, --exclude NAME regex to exclude matching file/folder names from 23 | OpenCanopy Resources to update - can be used 24 | more than once, case-insensitive 25 | --------------------------------------------------------------------------------