First off; I am sorry if my title is incorrect, but I didn't want to "clutter" it too much.
I am creating a bash script which is used to install various servers based on CentOS 6 and CentOS 7 with hardware raid and software RAID 1. So far I am doing pretty well. CentOS 6 (hardware RAID and software RAID 1) is completely done.
However I am now experiencing an issue re-installing a CentOS 7 through a kickstart file which has already software RAID 1 installed on it. For a pre-installed hardware RAID this is not an issue, as I can use "set root='hd0,gpt2'" in my script.
I think I need to use (on a CentOS 7 with software RAID 1) the "set root='mduuid/950f53e3b96cf5bbde74b5665f8d124c'" option, correct (first question)?
So I tried the following on the server (sorry not a clean code writer whatsoever):
tmpraid=$(cat grub.cfg | grep -e 'set root=' | head -1)
tmpraid2="${tmpraid::-1}"
tmpraid3=${tmpraid2//set root=\'/}
This results in the following output on the test server: mduuid/950f53e3b96cf5bbde74b5665f8d124c
However when I put this to use in my script, like this:
ssh root@192.168.0.1 "tmpraid=$(cat /boot/grub2/grub.cfg | grep -e 'set root=' | head -1)"
ssh root@192.168.0.1 "tmpraid2="${tmpraid::-1}""
ssh root@192.168.0.1 "tmpraid3=${tmpraid2//set root=\'/}"
It will output: cat: /boot/grub2/grub.cfg: No such file or directory
I am guessing it's trying to run this command on the current server instead of the target server?
Now as for my questions.
- Is using the "mduuid"-line correct for booting the kickstart through GRUB2 correct? Or is there a different way?
- Why is it saying "No such file or directory" in bash?
- Perhaps there is a better / cleaner way to get the "mduuid"-line from the target server?
I hope explained everything detailed enough to receive some help or advice with the above. If not, do not hesitate to ask me. Thank you kindly in advance.
//edit
Well I managed to get the the script working. Had to make some changes after doing a lot of searching and experimenting. Maybe there is an easier way to achieve this kickstart, but if no one explains, I will be trying with this.
ssh root@$nodeIP "wget http://192.50.100.200/files/getgrub -O /root/getgrub"
ssh root@$nodeIP "chmod +x /root/getgrub"
ssh root@$nodeIP "sh /root/getgrub"
getgrub=$(ssh root@$nodeIP "sh /root/getgrub")
The result is finally stored in getgrub. So I can experiment with that.