C'est gruik, très gruik, mais ça a le mérite de fonctionner :
RPM="redhat-release-server-6Server-6.3.0.3.el6.x86_64.rpm"
RRPM="redhat-release-server-6Server-6.3.0.3.el6"
function centos () {
mkdir redhat
mv /etc/issue /etc/issue.net /etc/redhat-release /etc/system-release /etc/system-release-cpe redhat/
cp -a centos/* /etc/
rpm -e --justdb $RRPM
}
function redhat () {
mkdir centos
mv /etc/issue /etc/issue.net /etc/redhat-release /etc/system-release /etc/system-release-cpe centos/
rpm2cpio $RPM | cpio -ivdm
cp -a etc/issue.net /etc/
cp -a etc/issue /etc/
cp -a etc/redhat-release /etc/
cp -a etc/system-release /etc/
cp -a etc/system-release-cpe /etc/
rpm -i --justdb $RPM
}
case $1 in
centos) centos ;;
redhat) redhat ;;
*)
echo "missing argument: centos | redhat"
;;
esac
1) Extract
mv initrd.img initrd.img.xz
xz --format=lzma initrd.img.xz --decompress
mkdir initrd-new
cd initrd-new
cpio -ivdum < ../initrd.img
2) Add/delete/modify files
3) Build
find . -print |cpio -o -H newc | xz --format=lzma > ../initrd.img