Skip to content

csd-wrapper: make it work again if binaries are compressed

CSD binaries can be uncompressed or .gz compressed, and the csd-wrapper.sh script here tries to support both cases, but actually doesn't work in the compressed case.

It just ends up specifying incorrect URLs and destination file names, making this miserably fail:

+ curl -s -k https://xx.xxx.xxx.xx/CACHE/sdesktop/hostscan/linux_x64/cscan -o /home/xxx/.cisco/hostscan/bin/cscan.tmp
+ [[ ! -f /home/xxx/.cisco/hostscan/bin/cscan.tmp ]]
+ [[ ! -s /home/xxx/.cisco/hostscan/bin/cscan.tmp ]]
+ [[ ! -s /home/xxx/.cisco/hostscan/bin/cscan.tmp ]]
+ rm /home/xxx/.cisco/hostscan/bin/cscan.tmp
+ echo 'Failure on cscan, trying gz'
Failure on cscan, trying gz
+ FILE_GZ=/home/xxx/.cisco/hostscan/bin/cscan.tmp.gz
+ curl -s -k --pinnedpubkey sha256//vI158z4H4BLBZKv927uWmvsJbFZzGEilTkI36lKv5BM= https://xx.xxx.xxx.xx/CACHE/sdesktop/hostscan/linux_x64//home/xxx/.cisco/hostscan/bin/cscan.tmp.gz -o /home/xxx/.cisco/hostscan/bin/cscan.tmp.gz
+ gunzip --verbose --decompress /home/xxx/.cisco/hostscan/bin/cscan.tmp.gz

gzip: /home/xxx/.cisco/hostscan/bin/cscan.tmp.gz: unexpected end of file

As can be seen the 2nd curl call has my local path appended to the URL, which of course can not work ($TMPFILE contains the full local path).

Edited by Daniel Lenski

Merge request reports