On Fri, Feb 6, 2009 at 11:01 AM, Michael DeHaan <[email protected]> wrote: > [email protected] wrote: >> >> From: Jeff Schroeder <[email protected]> >> >> The original idea is from Garrick Staples @ USC. My implementation is >> designed to work on crazy raid controllers like in HP servers that show >> /dev/cciss/c0d0 or normal servers that show /dev/sda. This assumes that >> the list-harddrives command is available. It is part of anaconda and >> might not be available on SUSE or other non Redhat based distributions. >> >> Signed-off-by: Jeff Schroeder <[email protected]> >> --- >> snippets/keep_ssh_host_keys | 44 >> +++++++++++++++++++++++++++++++++++++++++++ >> 1 files changed, 44 insertions(+), 0 deletions(-) >> create mode 100644 snippets/keep_ssh_host_keys >> >> diff --git a/snippets/keep_ssh_host_keys b/snippets/keep_ssh_host_keys >> new file mode 100644 >> index 0000000..93a6fad >> --- /dev/null >> +++ b/snippets/keep_ssh_host_keys >> @@ -0,0 +1,44 @@ >> +#raw >> +# Nifty trick to restore ssh keys without using a nochroot %post >> + >> +echo "Saving ssh host keys..." > /dev/ttyS0 >> + >> +keys_found=no >> + >> +insmod /lib/jbd.o >> +insmod /lib/ext3.o >> + >> +drives=$(list-harddrives | awk '{print $1}') >> +for disk in $drives; do >> + DISKS="$DISKS $(fdisk -l /dev/$disk | awk '/^\/dev/{print $1}')" >> +done >> + >> +for disk in $DISKS; do >> + name=$(basename $disk) >> + mkdir -p /tmp/$name /tmp/ssh >> + mount $disk /tmp/$name >> + [ $? -eq 0 ] || continue # Skip to the next partition if the mount >> fails >> + >> + # Copy current ssh host keys out to be reused >> + if [ -d /tmp/${name}/etc/ssh ]; then >> + cp -a /tmp/${name}/etc/ssh/ssh_host* /tmp/ssh >> + keys_found="yes" >> + umount /tmp/$name >> + break >> + fi >> + umount /tmp/$name >> + rm -r /tmp/$name >> +done >> + >> +# Loop until the ssh rpm is installed >> +if [ "$keys_found" = "yes" ]; then >> + while : ; do >> + sleep 10 >> + if [ -d /mnt/sysimage/etc/ssh ] ; then >> + cp -f /tmp/ssh/ssh_host* /mnt/sysimage/etc/ssh/ >> + logger "SSH-HOST-KEY copied to newly installed system" >> + break >> + fi >> + done & >> +fi >> +#end >> > > Applied to devel, thanks!
Perhaps my git-foo is lacking or something is missing :) j...@jschroeder2:~/git/cobbler$ git show 8d176c4075fbc8ad0fe534611cf8d1e920d40ac4 commit 8d176c4075fbc8ad0fe534611cf8d1e920d40ac4 Author: Michael DeHaan <[email protected]> Date: Fri Feb 6 14:00:57 2009 -0500 Jeff Schroeder's patch to provide a "preserve SSH host keys between installs" snippet. diff --git a/AUTHORS b/AUTHORS index 92e9722..ab1638f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -51,6 +51,7 @@ Patches and other contributions from: Jeremy Rosengren <[email protected]> Adam Rosenwald <[email protected]> Satoru Satoh <[email protected]> + Jeff Schroeder <[email protected]> Scott Seago <[email protected]> Justin Sherill <[email protected]> Anderson Silva <[email protected]> j...@jschroeder2:~/git/cobbler$ -- Jeff Schroeder Don't drink and derive, alcohol and analysis don't mix. http://www.digitalprognosis.com _______________________________________________ cobbler mailing list [email protected] https://fedorahosted.org/mailman/listinfo/cobbler
