2012-01-08 17:48:23 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
|
|
|
|
echo "Enter your Pastebin Developper API Key (see http://pastebin.com/api), or leave blank to use the default one (may not work):"
|
|
|
|
read input
|
|
|
|
|
|
|
|
if [ -z $input ] ; then
|
2012-01-08 21:49:27 +01:00
|
|
|
echo "Trying to obtain default Developper API Key..."
|
2012-01-08 17:48:23 +01:00
|
|
|
input=`wget -qO - http://tobast.fr/ressources/pastebin_devkey`
|
|
|
|
|
|
|
|
if (( ! `echo $input | grep -ce "[0-9a-f]\{32\}"` > 0 )) ; then
|
|
|
|
echo -e "\nERROR: Cannot obtain the default Developper API Key ! Please re-try with your API key.\n"
|
|
|
|
else
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if (( ! `echo $input | grep -ce "[0-9a-f]\{32\}"` > 0 )) ; then
|
|
|
|
echo -e "\nERROR: Wrong API key, please re-try.\n"
|
|
|
|
else
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2012-08-21 19:50:31 +02:00
|
|
|
sed -i "s/\(#define DEVELOPPER_CODE \)\"\"/\1\"${input}\"/" data_devcode.h
|
|
|
|
#sed -ire "49s/\"\".*$/\"${input}\"/" data_devcode.h
|
2012-01-08 17:48:23 +01:00
|
|
|
echo "Success!"
|
|
|
|
|