VMware Cloud Community
DavidWallis
Contributor
Contributor

Really annoying ks.cfg issue - copying files

I've created a custom ks.cfg which i've got prompting for server names, IP addresses etc, however in the %post section I have:

%post --interpreter=bash --nochroot

mkdir /extra

cp /mnt/source/extra/hpmgmt-8.5.1-vmware4x.tgz /extra

before the box reboots I can see the folder and the files, however after reboot they are not on the server.

Wtf am I doing wrong as Its driving me mad now!

i've also tried:

%post --interpreter=bash --nochroot

mkdir /mnt/sysimage/extra

cp /mnt/source/extra/hpmgmt-8.5.1-vmware4x.tgz /mnt/sysimage/extra

(oh and this is for vsphere)

David

Reply
0 Kudos
13 Replies
DavidWallis
Contributor
Contributor

Anyone got any ideas?

Its driving me mad now.

David

Reply
0 Kudos
Bhanta
Contributor
Contributor

Hi,

Can you share how you managed to prompt for service console ip, hostname etc??? ive managed to prompt for the sc ip and hostname but can't get the prompt for vmotion working - i'd like to prompt for the vmotion ip address when the build first starts and then configure it in the post section.....but not having much luck at the mo.

Sorry cant help much with your question at the mo...i'll keep trying to plug away at it though.

Reply
0 Kudos
DavidWallis
Contributor
Contributor

I do it in the PRE section..

I've got

%pre --interpreter-bash

exec </dev/tty1 >/dev/tty1

chvt 1

echo "Enter Service Console Address"

read ip

  1. and get rest etc...

chvt 6

then

cat <<EOF>> /tmp/networkconfig

network --device=vmnic0 --bootprotostatic --ip=$ip

EOF

then in the main part of ks.cfg for network config do:

%include /tmp/networkconfig

Drop me a mail if you want the full scripts (david.wallis@callcreditgroup.com)

David

Reply
0 Kudos
Bhanta
Contributor
Contributor

OK im slightly confused, i thought you managed to figure out a way to prompt for vmotion ip aswell and then set that dynamically in the post section???

Reply
0 Kudos
DavidWallis
Contributor
Contributor

Ill take a look at it tomorrow for you

Reply
0 Kudos
Bhanta
Contributor
Contributor

Thanks...that'll be absolutely ace if you can!

Reply
0 Kudos
cdu
Enthusiast
Enthusiast

This is what I do based a lot of references on the web. put the post script in init.d, otherwise it gets deleted after reboot.

##########################################################

%post –interpreter=bash

#Create post config script

cat << \EOF > /etc/rc3.d/S99postconf

#!/bin/bash

blah blah...

  1. Reset system to normal boot mode

echo "Removing automated post script..."

rm /etc/rc3.d/S99postconf

EOF

chmod +x /etc/rc3.d/S99postconf

Also, I use UDA 2 and use subtemplate feature to configure vmotion, vmkernerl IP, etc.

Reply
0 Kudos
Kirizan
Contributor
Contributor

This is how I got it to work in my environment:

%post --interpreter=bash

mkdir /mnt/sysimage/extra

mount /dev/cdrom /mnt/cdrom

cp /mnt/cdrom/extra/hpmgmt-8.5.1-vmware4x.tgz /mnt/sysimage/extra

If this doesn't work (I'm not sure if /mnt/ will retain anything on reboot) try this:

%post --interpreter=bash

mkdir /home/sysimage/extra

mount /dev/cdrom /mnt/cdrom

cp /mnt/cdrom/extra/hpmgmt-8.5.1-vmware4x.tgz /home/sysimage/extra

Reply
0 Kudos
DavidWallis
Contributor
Contributor

Cheers will have a play, never thought of mounting the cd! I should stick to microsoft really! As you can tell bash isn't one of my strong points!

David Wallis

Reply
0 Kudos
Kirizan
Contributor
Contributor

It took me several hours of searching forums and messing around to finally get that to work. Hopefully it will work for you as well.

Reply
0 Kudos
DSTAVERT
Immortal
Immortal

David

I removed your personal information from your last post. I would be very careful about including it.

-- David -- VMware Communities Moderator
Reply
0 Kudos
DavidWallis
Contributor
Contributor

Cheers, Should have remembered that replying from my blackberry would automatically add my disclaimer from my email!

David

Reply
0 Kudos
DSTAVERT
Immortal
Immortal

I use LogicMail for BlackBerry just for that problem.

-- David -- VMware Communities Moderator
Reply
0 Kudos