1 #!/bin/bash 2 3 echo -n "Bugzilla login or email address: " 4 read LOGIN 5 echo -n "Bugzilla password: " 6 stty -echo 7 read PW 8 stty echo 9 echo 10 echo "Logging in and fetching cookie values..." 11 echo 12 13 #older versions of curl (like the one on emf) don't have -k 14 OUT=$(curl -k 2>&1| grep unknown) 15 if [[ $OUT ]]; 16 then 17 CURLARG="" 18 else 19 CURLARG="-k" 20 fi 21 HEADERS=$(mktemp) 22 curl -s -S $CURLARG 'https://bugs.eclipse.org/bugs/index.cgi' -d "GoAheadAndLogIn=1&Bugzilla_login=$LOGIN&Bugzilla_password=$PW" -D $HEADERS >/dev/null 23 PW="$RANDOM $RANDOM $RANDOM $RANDOM" 24 VALUES=$(grep Set-Cookie $HEADERS | sed -e 's/.\{1,\}Bugzilla_\(login\(cookie\)\?=[0-9]\{1,\}\).\{1,\}/\1/') 25 rm -fr $HEADERS 26 27 if [[ $VALUES ]]; 28 then 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< ----" 41 else 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." 47 fi 48