Yes, but once the script has installed the new curl in /opt/bin on the first pass (when everything will work), the *NEXT TIME* the script is run, it will go to the else statement, which rewrites $PATH to put sbin upfront.
The opkg installation changes $PATH so /opt/bin is at the front, as shown...