datacenter / nexus9000

Nexus 9000
248 stars 193 forks source link

MD5 command in example poap file #21

Open ryantischer opened 8 years ago

ryantischer commented 8 years ago

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

wrgeorge1983 commented 8 years ago

Can confirm this is correct for 9372PX.

ma-hack commented 8 years ago

Yes, the command doesn't work on OSX or Ubuntu. I tried your command but after the md5sum appears the filename... for example:

md5sum="daff7e4f7617d257b66de61504120fe9n6000_poap_script.7.2.1.N1.1.py.md5"243

Have anyone a fix for that?

wrgeorge1983 commented 8 years ago

Just confirmed @ma-hack on an ubuntu server. When I get back into work I'll grab the string I used.

wrgeorge1983 commented 8 years ago

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

ma-hack commented 8 years ago

Great it works! Thanks for sharing!