28 lines
695 B
Bash
Executable File
28 lines
695 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# fake-zenity: script that mocks the behavior of zenity based on the ./.fake-zenity-response file
|
|
|
|
ZENITY_YES=0
|
|
ZENITY_NO=1
|
|
ZENITY_PERM=2
|
|
|
|
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)
|
|
|
|
printf "%s" "$4"
|
|
if [[ $FAKE_ZENITY_RESPONSE == "yes_tmp" ]]; then
|
|
exit "$ZENITY_YES"
|
|
elif [[ $FAKE_ZENITY_RESPONSE == "no" ]]; then
|
|
exit "$ZENITY_NO"
|
|
elif [[ $FAKE_ZENITY_RESPONSE == "yes" ]]; then
|
|
exit "$((ZENITY_YES | ZENITY_PERM))"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
exit 255 # TODO: call actual zenity here
|