aboutsummaryrefslogtreecommitdiff
path: root/basebuilder-3.6.2/org.eclipse.releng.basebuilder/plugins/org.eclipse.build.tools/scripts_bugzilla/bugzillaLogin.sh
blob: 9edd9f582eebfe274e0e62afda9245171cb2d78c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash

echo -n "Bugzilla login or email address: "
read LOGIN
echo -n "Bugzilla password: "
stty -echo
read PW
stty echo
echo
echo "Logging in and fetching cookie values..."
echo

#older versions of curl (like the one on emf) don't have -k
OUT=$(curl -k 2>&1| grep unknown)
if [[ $OUT ]];
then
	CURLARG=""
else
	CURLARG="-k"
fi
HEADERS=$(mktemp)
curl -s -S $CURLARG 'https://bugs.eclipse.org/bugs/index.cgi' -d "GoAheadAndLogIn=1&Bugzilla_login=$LOGIN&Bugzilla_password=$PW" -D $HEADERS >/dev/null
PW="$RANDOM $RANDOM $RANDOM $RANDOM"
VALUES=$(grep Set-Cookie $HEADERS | sed -e 's/.\{1,\}Bugzilla_\(login\(cookie\)\?=[0-9]\{1,\}\).\{1,\}/\1/')
rm -fr $HEADERS

if [[ $VALUES ]];
then
	#alternatively, you can do ./UpdateBugStateTask.sh 2>../properties/UpdateBugStateTask.properties
	echo "Paste the following into UpdateBugStateTask.properties:"
	echo "---- 8< ---- cut here ---- 8< ----"
	echo ""
	if [[ -e /proc/self/fd/2 ]];
	then
		echo "$VALUES" >/proc/self/fd/2
	else
		echo "$VALUES"
	fi
	echo ""
	echo "---- 8< ---- cut here ---- 8< ----"
else
	echo "Bugzilla didn't send us any cookie values, this means that either:"
	echo "   - you mistyped your login/password"
	echo "   - you can't reach Bugzilla for some reason"
	echo
	echo "Make sure that you can reach <https://bugs.eclipse.org/bugs/index.cgi> and try again."
fi