Re: Kickstarting a running server

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

 



Jeff,

We have a hacked up script that copies a floppy image and ks.cfg into
place in LILO or GRUB and makes it the default boot.  Once you reboot,
it kickstarts itself.

We run these with SUDO and use the $SUDO_USER.  You should change your
paths as necessary, but the logic will work.  It also assumes /boot is
it's own partition.

I've attached "remotekick" (LILO) and "grubkick".  Hope they're useful. 
"remotekick.console" and "grubkick.console" set up Kickstart via Serial
port instead of VGA.

/Brian/
-- 
       Brian Long                      |         |           |
       Americas IT Hosting Sys Admin   |       .|||.       .|||.
       Cisco Linux Developer           |   ..:|||||||:...:|||||||:..
       Phone: (919) 392-7363           |   C i s c o   S y s t e m s

#!/bin/bash -x

GRUB=/boot/grub/grub.conf

cp /auto/ecslinux/bootdisks/$SUDO_USER/floppy.img /var/tmp
mount -o loop /var/tmp/floppy.img /mnt
    cp /mnt/vmlinuz /boot/vmlinuz-floppy
    cp /mnt/initrd.img /var/tmp/initrd.img.gz
umount /mnt

gunzip /var/tmp/initrd.img.gz
mount -o loop /var/tmp/initrd.img /mnt
    cp /auto/ecslinux/bootdisks/$SUDO_USER/ks.cfg /mnt
umount /mnt
gzip /var/tmp/initrd.img
cp /var/tmp/initrd.img.gz /boot/floppy.img


# don't forget to remove any vga stuff and tell kickstart to do a text mode install
#        append="console=ttyS0,9600n8 ks=file:/ks.cfg"

DEFAULT=`grep "^title" $GRUB | wc -l | sed "s/ //g"`

perl -pi -e "s/default=\d+/default=$DEFAULT/" $GRUB

cat >> $GRUB<<EOF
title kickstart
        kernel /vmlinuz-floppy ks=file:/ks.cfg
        initrd=/floppy.img
EOF
#!/bin/bash -x

if [ -f "/auto/ecslinux/bootdisks/$SUDO_USER/pxe_initrd.img" ]; then
   cp /auto/ecslinux/bootdisks/$SUDO_USER/pxe_initrd.img /var/tmp/initrd.img.gz
   cp /auto/ecslinux/bootdisks/$SUDO_USER/pxe_vmlinuz /boot/vmlinuz-floppy
else
   cp /auto/ecslinux/bootdisks/$SUDO_USER/floppy.img /var/tmp/floppy.img
   mount -o loop /var/tmp/floppy.img /mnt
       cp /mnt/vmlinuz /boot/vmlinuz-floppy
       cp /mnt/initrd.img /var/tmp/initrd.img.gz
   umount /mnt
fi

gunzip /var/tmp/initrd.img.gz
mount -o loop /var/tmp/initrd.img /mnt
    cp /auto/ecslinux/bootdisks/$SUDO_USER/ks.cfg /mnt
umount /mnt
gzip /var/tmp/initrd.img
cp /var/tmp/initrd.img.gz /boot/floppy.img


# don't forget to remove any vga stuff and tell kickstart to do a text mode install
#        append="console=ttyS0,9600n8 ks=file:/ks.cfg"

cp /etc/lilo.conf /etc/lilo.conf.orig
sed -e s/default=linux/default=kickstart/ /etc/lilo.conf.orig > /etc/lilo.conf

cat >> /etc/lilo.conf<<EOF

image=/boot/vmlinuz-floppy
        append="ks=file:/ks.cfg"
        label=kickstart
        initrd=/boot/floppy.img
EOF

/sbin/lilo
#!/bin/bash -x

GRUB=/boot/grub/grub.conf

cp /auto/ecslinux/bootdisks/$SUDO_USER/floppy.img /var/tmp
mount -o loop /var/tmp/floppy.img /mnt
    cp /mnt/vmlinuz /boot/vmlinuz-floppy
    cp /mnt/initrd.img /var/tmp/initrd.img.gz
umount /mnt

gunzip /var/tmp/initrd.img.gz
mount -o loop /var/tmp/initrd.img /mnt
    cp /auto/ecslinux/bootdisks/$SUDO_USER/ks.cfg /mnt
umount /mnt
gzip /var/tmp/initrd.img
cp /var/tmp/initrd.img.gz /boot/floppy.img


# don't forget to remove any vga stuff and tell kickstart to do a text mode install
#        append="console=ttyS0,9600n8 ks=file:/ks.cfg"

DEFAULT=`grep "^title" $GRUB | wc -l | sed "s/ //g"`

perl -pi -e "s/default=\d+/default=$DEFAULT/" $GRUB

cat >> $GRUB<<EOF
title kickstart
        kernel /vmlinuz-floppy ks=file:/ks.cfg console=ttyS0,9600n8 ks=file:/ks.cfg text
        initrd=/floppy.img
EOF
#!/bin/bash -x

cp /auto/ecslinux/bootdisks/$SUDO_USER/floppy.img /tmp
mount -o loop /tmp/floppy.img /mnt
    cp /mnt/vmlinuz /boot/vmlinuz-floppy
    cp /mnt/initrd.img /tmp/initrd.img.gz
umount /mnt

gunzip /tmp/initrd.img.gz
mount -o loop /tmp/initrd.img /mnt
    cp /auto/ecslinux/bootdisks/$SUDO_USER/ks.cfg /mnt
umount /mnt
gzip /tmp/initrd.img
cp /tmp/initrd.img.gz /boot/floppy.img


# don't forget to remove any vga stuff and tell kickstart to do a text mode install
#        append="console=ttyS0,9600n8 ks=file:/ks.cfg"

cp /etc/lilo.conf /etc/lilo.conf.orig
sed -e s/default=linux/default=kickstart/ /etc/lilo.conf.orig > /etc/lilo.conf

cat >> /etc/lilo.conf<<EOF

image=/boot/vmlinuz-floppy
        append="console=ttyS0,9600n8 ks=file:/ks.cfg"
        label=kickstart
        initrd=/boot/floppy.img
EOF

/sbin/lilo

[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux