Feature Request: User text input confirmation for Erase option
Closed this issue · 3 comments
I have implemented a confirmation option which forces the user to type 'ERASE' before the policy will execute. Others might find this useful too, I placed it at the top of the script. Improvements welcome. This does not factor in the $8 variable.
userConfirmation=$(osascript << EOF
text returned of (display dialog "Confirm that you want to reset your Mac and lose all data by typing ERASE" with title "Erase Mac and Install macOS Mojave" default answer "" buttons {"Exit","Continue"} default button 1)
EOF)
if [[ $userConfirmation == ERASE ]]
then
echo user confirmed intent to reset macOS and erase all data by typing ERASE
else
echo user cancelled macOS reset
osascript -e 'display dialog "Cancelled." with title "Erase Mac and Install macOS Mojave" buttons {"OK"} default button 1'
exit 0
fi
@redshirtdave
Thank you for your proposal.
Of course, we think this script needs to be simple for admins and end users.
We have no plans to enrich the script of this project beyond its update functionality.
Your suggested patch might be complicate for this project.
However, please do not give up.
If you want end users to choose erase, currently we have two options.
Option 1. Create two policies. One is setting $8
variable to 0
as macOSUpgrade without Erasing Installer Policy
, the other is setting $8
variable to 1
as macOSUpgrade with Erasing Installer Policy
.
Option 2. Create three policies. One is setting $8
variable to 0
with macOSUpgrade-without-erasing-installer
event as macOSUpgrade without Erasing Installer Policy
. Two is setting $8
variable to 1
with macOSUpgrade-with-erasing-installer
event as macOSUpgrade with Erasing Installer Policy
, the other is setting your custom dialog script like
#!/bin/bash
userConfirmation=$(osascript << EOF
text returned of (display dialog "Confirm that you want to reset your Mac and lose all data by typing ERASE" with title "Erase Mac and Install macOS Mojave" default answer "" buttons {"Exit","Continue"} default button 1)
EOF)
if [ "$userConfirmation" = "ERASE" ];then
jamf policy -event "macOSUpgrade-with-erasing-installer"
else
jamf policy -event "macOSUpgrade-without-erasing-installer"
fi
exit 0
as macOSUpgrade with option for end user
.
How did it go after that?
If you have any problems, please let us know.
If you still have problems, please reopen.