I want to program a script that allows what is said in the title. So basically I gunzip the initrd, than unpack the cpio, open vi to allow editing, save, pack with cpio, and gzip again, so nothing fancy here (at least I hope that, I am not good at shell scripting). Now after gunzipping the archive the ending .gzip or .gz is left out so that I can't use $1 as the name. How should I delete the ending so that I can use a new variable foo, for further processing?
This is probably not an very elegant way, but I hope it works :)
#/bin/bash # This script should make it possible to edit the preseed file # within a initrd gzipped cpio archive, without unpacking and packing it # manually mkdir temporarydirectory # $1 will be the initrd (cpio archive which is compressed with gzip) mv $1 temporarydirectory cd temporarydirectory gunzip $1 cpio -id < $1 # here is where i need to cut of the gzip ending rm $1 # again without the gzip ending cutted of vim preseed.cfg find . | cpio -H newc -o > $1 # again without gzip ending gzip $1 # here the same mv $1 .. # here the gzip ending is used again cd .. rm -r temporarydirectory