I’m attempting to contact a remote server using curl in the remove hook bash script in my app. For testing purposes, I put it into the install hook bash script first, and once I get it working there I will put it into remove, where it will hopefully work perfectly.
Attempting to install the snap fails and I get this message:
meta/hooks/install: curl: not found
In my attempts to fix this, I added
curl to my
requirements.txt file in
snapcraft.yaml, but I believe that is not actually for the hooks, but only for the actual application, so I didn’t expect it to work.
parts: my-app-name: requirements: - /root/project/requirements.txt
Whether it should have or not, it accomplished nothing. Is there a different place in the
snapcraft.yaml I should have added it?
I also tried to install curl in the install hook itself:
if hash apt-get 2>/dev/null; then apt-get install curl echo 'Install of libraries via apt-get successful' elif hash apt 2>/dev/null; then apt install curl echo 'Install of libraries via apt successful' elif hash dnf 2>/dev/null; then dnf install curl echo 'Install of libraries via dnf successful' elif hash yum 2>/dev/null; then yum install curl echo 'Install of libraries via yum successful' elif hash zypper 2>/dev/null; then zypper install curl echo 'Install of libraries via zypper successful' elif hash pacman 2>/dev/null; then pacman -Sy curl echo 'Install of libraries via pacman successful' else echo 'Install of libraries failed' fi
The snap app install process still fails, giving me my own message:
Install of libraries failed
What would be the best way to make a network SOAP request in my remove bash script? Or, if I’m on the right track, how can I install curl so that it is available for my remove script?