31 lines
883 B
Bash
Executable File
31 lines
883 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# fake-zenity: script that mocks the behavior of zenity based on the ./.fake-zenity-response file
|
|
|
|
if [[ $1 == "--set-fake-response" ]]; then
|
|
#someone knows we are fake :)
|
|
echo $2 >~/.fake_zenity_response
|
|
else
|
|
if [ -f ~/.fake_zenity_response ]; then
|
|
FAKE_ZENITY_RESPONSE=$(cat ~/.fake_zenity_response)
|
|
|
|
if [[ $FAKE_ZENITY_RESPONSE == "yes_tmp" ]]; then
|
|
printf "Allow this time\n"
|
|
exit 1
|
|
elif [[ $FAKE_ZENITY_RESPONSE == "yes_tmp_alt" ]]; then
|
|
printf "Allow this time\n"
|
|
echo "yes_alt" >~/.fake_zenity_response
|
|
exit 1
|
|
elif [[ $FAKE_ZENITY_RESPONSE == "no" ]]; then
|
|
exit 1
|
|
elif [[ $FAKE_ZENITY_RESPONSE == "yes" ]]; then
|
|
exit 0
|
|
elif [[ $FAKE_ZENITY_RESPONSE == "yes_alt" ]]; then
|
|
echo "yes_tmp_alt" >~/.fake_zenity_response
|
|
exit 0
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
exit 255 # TODO: call actual zenity here
|