File tree 2 files changed +23
-2
lines changed
2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,18 @@ xfr="$(jose jwk exc -i '{"alg":"ECMR"}' -l- -r- <<< "$clt$eph")"
101
101
102
102
rec_url=" $url /rec/$kid "
103
103
ct=" Content-Type: application/jwk+json"
104
- if ! rep=" $( curl -sfg -X POST -H " $ct " --data-binary @- " $rec_url " <<< " $xfr" ) " ; then
104
+
105
+ # Check if netrc-file option exists
106
+ curl_net_rc_option=" --netrc-file"
107
+ curl_net_rc_file=" /etc/clevis/clevis_netrc.conf"
108
+ netrc=" $( curl --help all | grep netrc-file) " || true
109
+ if [ -z " ${netrc} " ];
110
+ then
111
+ curl_net_rc_option=" "
112
+ curl_net_rc_file=" "
113
+ fi
114
+
115
+ if ! rep=" $( curl " ${curl_net_rc_option} " " ${curl_net_rc_file} " -sfg -X POST -H " $ct " --data-binary @- " $rec_url " <<< " $xfr" ) " ; then
105
116
echo " Error communicating with server $url " >&2
106
117
exit 1
107
118
fi
Original file line number Diff line number Diff line change @@ -75,6 +75,16 @@ if ! url="$(jose fmt -j- -Og url -u- <<< "$cfg")"; then
75
75
exit 1
76
76
fi
77
77
78
+ # Check if netrc-file option exists
79
+ curl_net_rc_option=" --netrc-file"
80
+ curl_net_rc_file=" /etc/clevis/clevis_netrc.conf"
81
+ netrc=" $( curl --help all | grep netrc-file) " || true
82
+ if [ -z " ${netrc} " ];
83
+ then
84
+ curl_net_rc_option=" "
85
+ curl_net_rc_file=" "
86
+ fi
87
+
78
88
thp=" $( jose fmt -j- -Og thp -Su- <<< " $cfg" ) " || true
79
89
80
90
# ## Get the advertisement
@@ -92,7 +102,7 @@ elif jws="$(jose fmt -j- -g adv -Su- <<< "$cfg")"; then
92
102
fi
93
103
94
104
thp=" ${thp:- any} "
95
- elif ! jws=" $( curl -sfg " $url /adv/$thp " ) " ; then
105
+ elif ! jws=" $( curl " ${curl_net_rc_option} " " ${curl_net_rc_file} " -sfg " $url /adv/$thp " ) " ; then
96
106
echo " Unable to fetch advertisement: '$url /adv/$thp '!" >&2
97
107
exit 1
98
108
fi
You can’t perform that action at this time.
0 commit comments