Skip to content

Commit ced95f3

Browse files
committed
Update rpm script to use npm ping rather than raw curl
to fix #61
1 parent fb63a5c commit ced95f3

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

rpm/update-nodejs-and-nodered

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@ then
158158
esac
159159
fi
160160

161-
162-
163-
164161
if [[ -z "${OPEN_FIREWALL}" ]] && [[ "${CONFIRM_INSTALL}" == "n" ]]
165162
then
166163
OPEN_FIREWALL="n"
@@ -190,17 +187,31 @@ esac
190187
[[ -n "${NODERED_HOME}" ]] || export NODERED_HOME="/home/${NODERED_USER}"
191188

192189

193-
# check internet, if failure exit
194-
if curl -f https://www.npmjs.com/package/node-red >/dev/null 2>&1
195-
then
196-
echo " "
190+
# # check internet, if failure exit
191+
# if curl -f https://www.npmjs.com/package/node-red >/dev/null 2>&1
192+
# then
193+
# echo " "
194+
# else
195+
# echo " "
196+
# echo "Sorry - cannot connect to internet - not going to touch anything."
197+
# echo "https://www.npmjs.com/package/node-red is not reachable."
198+
# echo "Please ensure you have a working internet connection."
199+
# echo " "
200+
# exit 1
201+
# fi
202+
203+
output=$(npm ping 2>&1)
204+
exit_code=$?
205+
206+
if [ $exit_code -eq 0 ]; then
207+
echo " "
197208
else
198-
echo " "
199-
echo "Sorry - cannot connect to internet - not going to touch anything."
200-
echo "https://www.npmjs.com/package/node-red is not reachable."
201-
echo "Please ensure you have a working internet connection."
202-
echo " "
203-
exit 1
209+
echo " "
210+
echo "Sorry - cannot connect to internet - not going to touch anything."
211+
echo "https://www.npmjs.com/package/node-red is not reachable."
212+
echo "Please ensure you have a working internet connection."
213+
echo " "
214+
return 1
204215
fi
205216

206217
# final install details
@@ -415,4 +426,3 @@ EOF
415426
exit 1
416427
;;
417428
esac
418-

0 commit comments

Comments
 (0)