[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: preinstall section - how to backup ssh keys?

Is it required to have "--nochroot" in my "%post" section? I have a lot of other things in "%post" and am not currently using "--nochroot". I thought I should still be able to see the /tmp/ssh directory created in the "%pre" section, correct? It does not seem to work, though, since I do not see the /tmp/ssh directory in the "%post" section. I did an "ls -la" on /tmp in the "%post" section, and the only thing there was:
total 12
drwxrwxrwt 2 root root 4096 Dec 2 10:48 .
drwxr-xr-x 21 root root 4096 Dec 2 10:48 ..
-rwx------ 1 root root 157 Dec 2 10:48 ks-script

I would think I would at least see the directory since it should have been created with mkdir in the %pre section. Is this a different "/tmp" directory in the %post section than what was used in %pre?

Any ideas?


From: Alf Wachsmann <alfw SLAC Stanford EDU>
Reply-To: kickstart-list redhat com
To: "'kickstart-list redhat com'" <kickstart-list redhat com>
Subject: RE: preinstall section - how to backup ssh keys?
Date: Tue, 02 Dec 2003 07:47:43 -0800 (PST)

On Mon, 1 Dec 2003, James Olin Oden wrote:
> On Mon, 1 Dec 2003, Robert Denton wrote:
> > The post script doesn't have to run in a chroot environment. But it will if
> > you specify: '%post --chroot'
> It runs in chroot by default (%post that is). To run in non-chroot
> specify: [ proposal deleted ]

Here is what we do. It avoids the rather ugly loop in the %pre section
to copy the data back.

-- Alf.


mkdir -p /mnt/oldroot
mkdir -p /tmp/ssh

if [ -b /dev/sda ] ; then

for i in `/usr/sbin/fdisk -l $disk | grep -i linux | grep -v swap | cut -d" " -f 1`
part=`/usr/sbin/e2label $i`
if [ $part = "/" ] ; then
mount $i /mnt/oldroot

if [ -d /mnt/oldroot/etc/ssh ] ; then
  cp -a /mnt/oldroot/etc/ssh/ssh_host_* /tmp/ssh/.
  echo "Copied old ssh keys"
  echo "No old ssh directory found"

# Add other stuff here that needs to be copied
# like Kerberos keytab files etc.

if [ -n $mounted ] ; then
  umount /mnt/oldroot

%post --nochroot

if [ -d /tmp/ssh ] ; then
  mv -f /tmp/ssh/ssh_host_* /mnt/sysimage/etc/ssh/.
  mv -f /tmp/ssh/*srv*      /mnt/sysimage/etc/.
  mv -f /tmp/ssh/*keytab    /mnt/sysimage/etc/.

  Alf Wachsmann                       | e-mail: alfw slac stanford edu
  SLAC Computing Service              | Phone:  +1-650-926-4802
  2575 Sand Hill Road, M/S 97         | FAX:    +1-650-926-3329
  Menlo Park, CA 94025, USA           | Office: Bldg. 50/323
                http://www.slac.stanford.edu/~alfw (PGP)

_______________________________________________ Kickstart-list mailing list Kickstart-list redhat com https://www.redhat.com/mailman/listinfo/kickstart-list

Is there a gadget-lover on your gift list? MSN Shopping has lined up some good bets! http://shopping.msn.com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]