1#!/bin/bash 2 3echo -n "Bugzilla login or email address: " 4read LOGIN 5echo -n "Bugzilla password: " 6stty -echo 7read PW 8stty echo 9echo 10echo "Logging in and fetching cookie values..." 11echo 12 13#older versions of curl (like the one on emf) don't have -k 14OUT=$(curl -k 2>&1| grep unknown) 15if [[ $OUT ]]; 16then 17 CURLARG="" 18else 19 CURLARG="-k" 20fi 21HEADERS=$(mktemp) 22curl -s -S $CURLARG 'https://bugs.eclipse.org/bugs/index.cgi' -d "GoAheadAndLogIn=1&Bugzilla_login=$LOGIN&Bugzilla_password=$PW" -D $HEADERS >/dev/null 23PW="$RANDOM $RANDOM $RANDOM $RANDOM" 24VALUES=$(grep Set-Cookie $HEADERS | sed -e 's/.\{1,\}Bugzilla_\(login\(cookie\)\?=[0-9]\{1,\}\).\{1,\}/\1/') 25rm -fr $HEADERS 26 27if [[ $VALUES ]]; 28then 29 #alternatively, you can do ./UpdateBugStateTask.sh 2>../properties/UpdateBugStateTask.properties 30 echo "Paste the following into UpdateBugStateTask.properties:" 31 echo "---- 8< ---- cut here ---- 8< ----" 32 echo "" 33 if [[ -e /proc/self/fd/2 ]]; 34 then 35 echo "$VALUES" >/proc/self/fd/2 36 else 37 echo "$VALUES" 38 fi 39 echo "" 40 echo "---- 8< ---- cut here ---- 8< ----" 41else 42 echo "Bugzilla didn't send us any cookie values, this means that either:" 43 echo " - you mistyped your login/password" 44 echo " - you can't reach Bugzilla for some reason" 45 echo 46 echo "Make sure that you can reach <https://bugs.eclipse.org/bugs/index.cgi> and try again." 47fi 48