kickstart copy file to new system
I have solved it...
%post --log=/root/ks-post.log
exec < /dev/tty6 > /dev/tty6 2> /dev/tty6
chvt 6
#mount the cd (ISO in my case) to copy files from it
#since this is chrooted environment
mount /dev/cdrom /mnt
cp -rf /mnt/JOTC/src/jotc/ /opt/
cp -f /mnt/JOTC/src/service /etc/init.d/jotc
#starting a service is dead simple
chkconfig iptables on
service iptables start
#opening a port is a little trickier
#this line adds a rule right before the word 'COMMIT' in iptables config
sed -i "/COMMIT/ { N; s/COMMIT\n/-A INPUT -p tcp -m tcp --dport 8888 -j ACCEPT\n&/ }" /etc/sysconfig/iptables
iptables-save > /etc/sysconfig/iptables
service iptables restart
I hope someone will benefit from this. Took me 3 days to figure it all out :) (my kickstart file has ~50 more lines).
Comments
-
ivica over 1 year
I've finished writing my kickstart file but one thing bugs me the whole day. I've searched all over the net, found numerous posts with different solutions and none of them helped me.
I did a fresh install from my
kickstart-ed
ISO which contains several files. I would like to copy those files to the newly installed system and start one of those files as a service (it is a service).This is my
%post
right now:%post --log=/root/ks-post.log exec < /dev/tty6 > /dev/tty6 2> /dev/tty6 chvt 6 clear cp /mnt/source/JOTC/src/mongod.conf /etc/ cp -r /mnt/source/JOTC/src/jotc/ /opt/ cp /mnt/source/JOTC/src/service /etc/init.d/jotc
Errors are fairly reasonable;
/mnt/source/JOTC/src/mongod.conf: no such file or directory
.However, if I switch to virtual terminal 2 manually and do a quick
ls /mnt/source/JOTC/src/
there IS thatmongod.conf
file.What am I doing wrong?
-
Admin over 10 yearsIs mongod.conf a broken symlink?
-
Admin over 10 yearsI don't believe it is. That file, along with the others is on the installation ISO that I prepared.
-
Admin about 9 yearsSeems to be chrooted environment. Wouldn't
%post --nochroot
help?
-
-
Jeff Hewitt over 10 years+1 but have you managed to find out why VT2 that you manually used didn't have a chrooted environment?