This is what I had: -
unzip -l certificate-bundle.zip
Archive: certificate-bundle.zip
Length Date Time Name
--------- ---------- ----- ----
0 10-19-2017 16:58 ca/
1310 10-19-2017 16:58 ca/ca.crt
1679 10-19-2017 16:58 ca/ca.key
0 10-19-2017 16:58 node1/
1379 10-19-2017 16:58 node1/node1.crt
1679 10-19-2017 16:58 node1/node1.key
--------- -------
6047 6 files
So I wanted to extract the certificates and one of the keys …. and place them into specific locations
BUT…..
I didn't want the paths, just the files.
Whilst zip supports this: -
-j junk paths (do not make directories)
alas, unzip does not.
Thankfully, the internet had the answer: -
How do I exclude absolute paths for Tar?
I knew that I could use tar on a ZIP file, but this was a nuance.
I knew that I could use tar on a ZIP file, but this was a nuance.
So here're the commands that I used: -
tar xvzf ~/certificate-bundle.zip --strip-components=1 -C ~/Desktop/elasticsearch-config/x-pack ca/ca.crt
tar xvzf ~/certificate-bundle.zip --strip-components=1 -C ~/Desktop/elasticsearch-config/x-pack node1/node1.crt
tar xvzf ~/certificate-bundle.zip --strip-components=1 -C ~/Desktop/elasticsearch-config/x-pack node1/node1.key
tar xvzf ~/certificate-bundle.zip --strip-components=1 -C ~/Desktop/elasticsearch-config/x-pack node1/node1.crt
tar xvzf ~/certificate-bundle.zip --strip-components=1 -C ~/Desktop/elasticsearch-config/x-pack node1/node1.key
so we use —strip-components to remove the path and -C to place the files into specific locations.
So that's all good then :-)
No comments:
Post a Comment