-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
# PartEFIMount | ||
# By chris1111 | ||
# Dependencies: platypus | ||
# Declare some VARS | ||
APP_NAME="PartEFIMount.app" | ||
SCRIPT_NAME="PartEFIMount.sh" | ||
PARENTDIR=$(dirname "$0") | ||
cd "$PARENTDIR" | ||
CLI=/usr/local/share/platypus/ScriptExec | ||
if [ -e "$CLI" ]; then | ||
echo "$CLI exists" | ||
else | ||
echo "$CLI does not exist" | ||
echo "Binaries for building platypus are not installed you must install them" | ||
echo "Insert Your Password To Procceed" | ||
sudo mkdir -p /usr/local/bin | ||
sudo mkdir -p /usr/local/share/platypus | ||
sudo mkdir -p /usr/local/share/man/man1 | ||
sudo cp -rp ./Share/share/platypus/* /usr/local/share/platypus/ | ||
sudo cp -rp ./Share/share/man/man1/platypus.1.gz /usr/local/share/man/man1/ | ||
sudo cp -rp ./Share/platypus /usr/local/bin/ | ||
fi | ||
rm -rf ./"$APP_NAME" | ||
Sleep 2 | ||
# platypus CLI | ||
platypus -o 'Status Menu' -i ./'AppIcon.icns' --background --quit-after-execution --status-item-icon ./'AppIcon.png' -f ./'Credits.rtf' -f ./'PartEFIMount' -f ./'MainMenu.nib' ./"$SCRIPT_NAME" -u chris1111 -I com.chris1111.PartEFIMount -y ./"$APP_NAME" | ||
# Add Copyright and custom Icon status menu | ||
/usr/libexec/PlistBuddy -c "Set :StatusItemDisplayType 'Icon'" ./"PartEFIMount.app"/Contents/Resources/AppSettings.plist | ||
/usr/libexec/PlistBuddy -c "Set :Creator 'chris1111'" ./"PartEFIMount.app"/Contents/Resources/AppSettings.plist | ||
/usr/libexec/PlistBuddy -c "Set :NSHumanReadableCopyright 'Copyright (c) 2024 chris1111 All rights reserved.'" ./"PartEFIMount.app"/Contents/Info.plist | ||
|
||
|
||
# Remove if exist | ||
if [ -d "/Applications/$APP_NAME" ]; then | ||
echo "$APP_NAME exists. Delete app" | ||
osascript -e 'tell application "System Events" to delete login item "PartEFIMount"' | ||
killall -c PartEFIMount | ||
Sleep 1 | ||
rm -rf /Applications/$APP_NAME | ||
fi | ||
# Install PartEFIMount | ||
echo Install "$APP_NAME" | ||
cp -Rp ./PartEFIMount.app /Applications/PartEFIMount.app | ||
osascript -e 'tell application "System Events" to make login item at end with properties {path:"/Applications/PartEFIMount.app", hidden:false}' | ||
Sleep 1 | ||
Open -a /Applications/PartEFIMount.app | ||
rm -rf ./"$APP_NAME" | ||
echo "= = = = = = = = = = = = = = = = = = = = = = = = = " | ||
echo "Create PartEFIMount.app Done. | ||
App is ready on Status Bar" | ||
echo "= = = = = = = = = = = = = = = = = = = = = = = = = " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{\rtf1\ansi\ansicpg1252\cocoartf2821 | ||
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\froman\fcharset0 Times-Roman;} | ||
{\colortbl;\red255\green255\blue255;\red0\green0\blue233;} | ||
{\*\expandedcolortbl;;\cssrgb\c0\c0\c93333;} | ||
\margl1440\margr1440\vieww19680\viewh8400\viewkind0 | ||
\deftab720 | ||
\pard\pardeftab720\qc\partightenfactor0 | ||
|
||
\f0\fs20 \cf0 \expnd0\expndtw0\kerning0 | ||
Build by {\field{\*\fldinst{HYPERLINK "https://github.com/chris1111/"}}{\fldrslt \cf2 \ul \ulc2 chris1111}}, Created from {\field{\*\fldinst{HYPERLINK "https://github.com/sveinbjornt/Platypus"}}{\fldrslt \cf2 \ul \ulc2 Platypus}}\ | ||
Base on RehabMan {\field{\*\fldinst{HYPERLINK "https://github.com/RehabMan/hack-tools/blob/master/mount_efi.sh"}}{\fldrslt \cf2 \ul \ulc2 mount efi script}}, {\field{\*\fldinst{HYPERLINK "https://sourceforge.net/p/cloverefiboot/code/HEAD/tree/CloverPackage/package/Scripts.templates/EFIFolder/MountESP"}}{\fldrslt \cf2 \ul \ulc2 Clover MountESP }}} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
apptitle="PartEFIMount" | ||
version="1.0" | ||
|
||
open ./PartEFIMount/PartEFIMount |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
#!/bin/bash | ||
# By christ1111: Based on rehabman script and CloverPackage MountESP Package script. | ||
# A tool to mount EFI partitions in macOS - 100% bash | ||
# Partition Map: JHFS+, APFS, NTFS is supported | ||
# Vars | ||
Plist=/Private/tmp/PartEFIMount.plist | ||
rm -f $Plist | ||
apptitle="PartEFIMount" | ||
version="1.0" | ||
|
||
# Get Volumes location with "osascript CodeMenu" | ||
read -r -d '' CodeMenu <<'EOF' | ||
activate me | ||
set Volumepath to paragraphs of (do shell script "ls /Volumes") | ||
set Diskpath to choose from list Volumepath with prompt " | ||
Choose the Disk to Mount the EFI partition | ||
Then press the OK button" OK button name "OK" | ||
if Diskpath is false then | ||
set IconPath to "System:Library:CoreServices:Finder.app:Contents:Resources:Finder.icns:" as alias | ||
display dialog "Quit PartEFIMount Now! | ||
Quit will terminate the running processes: bash!" with icon IconPath buttons {"EXIT"} default button {"EXIT"} | ||
display notification "Program closing" with title "PartEFIMount" subtitle "User cancelled" | ||
tell application "Terminal" to close (get window 1) | ||
quit | ||
end if | ||
return Diskpath | ||
EOF | ||
PartEFI=$(osascript -e "$CodeMenu"); | ||
DestVolume=$PartEFI | ||
|
||
# find whole disk for the destination volume | ||
DiskDevice=$(LC_ALL=C diskutil info "$DestVolume" 2>/dev/null | sed -n 's/.*Part [oO]f Whole: *//p') | ||
if [[ -z "$DiskDevice" ]]; then | ||
echo "Error: Not able to find volume with the name \"$DestVolume\"" | ||
exit 1 | ||
fi | ||
|
||
# check if target volume is a logical Volume instead of physical | ||
if [[ "$(echo $(LC_ALL=C diskutil list | grep -i 'Logical Volume' | awk '{print tolower($0)}'))" == *"logical volume"* ]]; then | ||
# ok, we have a logical volume somewhere.. so that can assume that we can use "diskutil cs" | ||
LC_ALL=C diskutil cs info $DiskDevice > /dev/null 2>&1 | ||
if [[ $? -eq 0 ]] ; then | ||
# logical volumes does not have an EFI partition (or not suitable for us?) | ||
# find the partition uuid | ||
UUID=$(LC_ALL=C diskutil info "${DiskDevice}" 2>/dev/null | sed -n 's/.*artition UUID: *//p') | ||
# with the partition uuid we can find the real disk in in diskutil list output | ||
if [[ -n "$UUID" ]]; then | ||
realDisk=$(LC_ALL=C diskutil list | grep -B 1 "$UUID" | grep -i 'logical volume' | awk '{print $4}' | sed -e 's/,//g' | sed -e 's/ //g') | ||
if [[ -n "$realDisk" ]]; then | ||
DiskDevice=$(LC_ALL=C diskutil info "${realDisk}" 2>/dev/null | sed -n 's/.*Part [oO]f Whole: *//p') | ||
fi | ||
fi | ||
fi | ||
fi | ||
|
||
# check if target volume is APFS, and therefore part of an APFS container | ||
if [[ "$(echo $(LC_ALL=C diskutil list "$DiskDevice" | grep -i 'APFS Container Scheme' | awk '{print tolower($0)}'))" == *"apfs container scheme"* ]]; then | ||
# ok, this disk is an APFS partition, extract physical store device | ||
realDisk=$(LC_ALL=C diskutil list "$DiskDevice" 2>/dev/null | sed -n 's/.*Physical Store *//p') | ||
DiskDevice=$(LC_ALL=C diskutil info "$realDisk" 2>/dev/null | sed -n 's/.*Part [oO]f Whole: *//p') | ||
fi | ||
|
||
PartitionScheme=$(LC_ALL=C diskutil info "$DiskDevice" 2>/dev/null | sed -nE 's/.*(Partition Type|Content \(IOContent\)): *//p') | ||
# Check if the disk is an MBR disk | ||
if [[ "$PartitionScheme" == "FDisk_partition_scheme" ]]; then | ||
echo "Error: Volume \"$DestVolume\" is part of an MBR disk" | ||
exit 1 | ||
fi | ||
# Check if not GPT | ||
if [[ "$PartitionScheme" != "GUID_partition_scheme" ]]; then | ||
echo "Error: Volume \"$DestVolume\" is not on GPT disk or APFS container" | ||
exit 1 | ||
fi | ||
|
||
# Find the associated EFI partition on DiskDevice | ||
diskutil list -plist "/dev/$DiskDevice" 2>/dev/null > $Plist | ||
for ((part=0; 1; part++)); do | ||
content=`/usr/libexec/PlistBuddy -c "Print :AllDisksAndPartitions:0:Partitions:$part:Content" $Plist 2>&1` | ||
if [[ "$content" == *"Does Not Exist"* ]]; then | ||
echo "Error: cannot locate EFI partition for $DestVolume" | ||
exit 1 | ||
fi | ||
if [[ "$content" == "EFI" ]]; then | ||
EFIDevice=`/usr/libexec/PlistBuddy -c "Print :AllDisksAndPartitions:0:Partitions:$part:DeviceIdentifier" $Plist 2>&1` | ||
break | ||
fi | ||
|
||
done | ||
|
||
# should not happen | ||
if [[ -z "$EFIDevice" ]]; then | ||
echo "Error: unable to determine EFIDevice from $DiskDevice" | ||
exit 1 | ||
fi | ||
|
||
# Get the EFI mount point if the partition is currently mounted | ||
code=0 | ||
EFIMountPoint=$(LC_ALL=C diskutil info "$EFIDevice" 2>/dev/null | sed -n 's/.*Mount Point: *//p') | ||
if [[ -z "$EFIMountPoint" ]]; then | ||
# Mount the EFI partition | ||
echo "------------------------------------------------------------------------" | ||
echo "Trying to mount the EFI partition --> /Volumes/$PartEFI" | ||
echo "------------------------------------------------------------------------" | ||
sudo diskutil mount /dev/$EFIDevice >/dev/null 2>&1 | ||
EFIMountPoint=$(LC_ALL=C diskutil info "$EFIDevice" 2>/dev/null | sed -n 's/.*Mount Point: *//p') | ||
code=$? | ||
fi | ||
|
||
rm -f $Plist | ||
echo "" | ||
echo "------------------------------------------------------------------------" | ||
echo "$EFIMountPoint --> $PartEFI is mounted | ||
Done!" | ||
echo "------------------------------------------------------------------------" | ||
exit $code |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.