Open ryantischer opened 8 years ago
Can confirm this is correct for 9372PX.
Yes, the command doesn't work on OSX or Ubuntu. I tried your command but after the md5sum appears the filename... for example:
Have anyone a fix for that?
Just confirmed @ma-hack on an ubuntu server. When I get back into work I'll grab the string I used.
Here is what's been working for us:
# or like this on nexus 9k series switches that demand double quotes around the md5sum:
# f=poap.py ; cat $f | sed '/^#md5sum/d' > $f.md5 ; sed -i "s/^#md5sum=.*/#md5sum=\"$(md5sum $f.md5 | sed 's/ .*//')\"/" $f
looks like the main difference is changing a few instances of ./
into .*/
, but I'm not a sed guy
Great it works! Thanks for sharing!
The command to recalculate the md5 is wrong. The result needs to be in double quotes. Command in question. f=poap.py ; cat $f | sed '/^#md5sum/d' > $f.md5 ; sed -i "s/^#md5sum=./#md5sum=$(md5sum $f.md5 | sed 's/ .//')/" $f
Correct command
f=poap.py ; cat $f | sed '/^#md5sum/d' > $f.md5 ; sed -i "s/^#md5sum=./#md5sum=\"$(md5sum $f.md5 | sed 's/ .//')\"/" $f