Skip to content

Commit

Permalink
nheimlich feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
danmcd committed Nov 19, 2024
1 parent 75f2035 commit 6af63d1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/smartdc/bin/sdc-factoryreset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function abort()

function usage()
{
printf "\nUsage: $myname [-h | --help]\n\n"
printf "\nUsage: $myname [-h | --help] {-s}\n\n"
printf "Resets a machine to its originally installed state. See "
printf "sdc-factoryreset(1)\nfor more information.\n"
exit 1
Expand All @@ -48,20 +48,21 @@ if [[ -n $1 ]] && [[ $1 = "--help" ]]; then
fi

final_command="reboot"
final_verb="Rebooting"

while getopts "hs" opt
do
case "$opt" in
h) usage;;
s) final_command="poweroff";;
s) final_command="poweroff"; final_verb="Powering off;;
*) usage;;
esac
done
trap abort SIGINT
printf "WARNING: This machine will reboot and destroy its ZFS pools after "
printf "rebooting.\n"
printf "WARNING: This machine will $final_command and destroy its ZFS pools "
printf "after the next reboot.\n"
read -p "Do you want to proceed with the factory reset? (y/n) " -n 1
Expand All @@ -72,7 +73,7 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
read -p "Are you sure? (y/n) " -n 1
if [[ $REPLY =~ ^[Yy]$ ]]; then
printf "\n\nRebooting in 5 seconds ... "
printf "\n\n$final_verb in 5 seconds ... "
sleep 5
printf "now!\n"
Expand Down

0 comments on commit 6af63d1

Please sign in to comment.