Browse Source

micropatcher/unpatch: Allow command line parameter for VOLUME

With this commit, micropatcher.sh and unpatch.sh now allow the
pathname for the installer USB to be specified on the command line. (The
easy way to do this is to drag-and-drop the USB stick from the Finder.)

(Maybe I should eventually extend this for drag-and-drop of the installer
app on the USB stick, instead of just the USB stick itself, but this is
still an improvement.)
pull/14/head
Barry K. Nathan 5 years ago
parent
commit
0125e410aa
  1. 26
      micropatcher.sh
  2. 26
      unpatch.sh

26
micropatcher.sh

@ -9,12 +9,11 @@ echo 'Macs! (See the README for more information.)'
# Add a blank line of output to make things easier on the eyes.
echo
# Hardcoded for now. (The assumptions are that the recovery USB stick was
# created using createinstallmedia and was not renamed afterward -- and that
# there is only one Big Sur recovery USB stick plugged into this Mac.)
#
# As of v0.0.9, changed to first check for the name that will probably be
# used throughout the majority of the beta cycle.
# Allow the user to drag-and-drop the USB stick in Terminal, to specify the
# path to the USB stick in question. (Otherwise it will try a hardcoded path
# for beta 2 and up, followed by a hardcoded path for beta 1.)
if [ -z "$1" ]
then
VOLUME='/Volumes/Install macOS Big Sur Beta'
if [ ! -d "$VOLUME/Install macOS Big Sur Beta.app" ]
then
@ -24,6 +23,21 @@ then
then
echo "Failed to locate Big Sur recovery USB stick."
echo Remember to create it using createinstallmedia, and do not rename it.
echo "If all else fails, try specifying the path to the USB stick"
echo "as a command line parameter to this script."
echo
echo "Patcher cannot continue and will now exit."
exit 1
fi
fi
else
VOLUME="$1"
if [ ! -d "$VOLUME/Install macOS"*.app ]
then
echo "Failed to locate Big Sur recovery USB stick for patching."
echo "Make sure you specified the correct volume. You may also try"
echo "not specifying a volume and allowing the patcher to find"
echo "the volume itself."
echo
echo "Patcher cannot continue and will now exit."
exit 1

26
unpatch.sh

@ -11,12 +11,11 @@ echo "It's really best to recreate the USB stick using createinstallmedia,"
echo "but this takes much less time and is useful for patcher development."
echo
# Hardcoded for now. (The assumptions are that the recovery USB stick was
# created using createinstallmedia and was not renamed afterward -- and that
# there is only one Big Sur recovery USB stick plugged into this Mac.)
#
# As of v0.0.9, changed to first check for the name that will probably be
# used throughout the majority of the beta cycle.
# Allow the user to drag-and-drop the USB stick in Terminal, to specify the
# path to the USB stick in question. (Otherwise it will try a hardcoded path
# for beta 2 and up, followed by a hardcoded path for beta 1.)
if [ -z "$1" ]
then
VOLUME='/Volumes/Install macOS Big Sur Beta'
if [ ! -d "$VOLUME/Install macOS Big Sur Beta.app" ]
then
@ -26,7 +25,20 @@ then
then
echo "Failed to locate Big Sur recovery USB stick for unpatching."
echo
echo "Patcher cannot continue and will now exit."
echo "Unpatcher cannot continue and will now exit."
exit 1
fi
fi
else
VOLUME="$1"
if [ ! -d "$VOLUME/Install macOS"*.app ]
then
echo "Failed to locate Big Sur recovery USB stick for unpatching."
echo "Make sure you specified the correct volume. You may also try"
echo "not specifying a volume and allowing the unpatcher to find"
echo "the volume itself."
echo
echo "Unpatcher cannot continue and will now exit."
exit 1
fi
fi

Loading…
Cancel
Save