[one-users] CentOS Contextualization

André Monteiro andre.monteir at gmail.com
Mon Oct 15 06:45:18 PDT 2012


Hello, here is my CentOS contextualization file, include it on CONTEXT
section with FILE="../yourpath/init.sh".

#!/bin/bash

if [ -f /mnt/context/context.sh ];
then
  . /mnt/context/context.sh
else
  . /media/CDROM/context.sh
fi
hostname $HOSTNAME
sed -i "/HOSTNAME=/s/=.*$/=$HOSTNAME/" /etc/sysconfig/network
source /etc/sysconfig/network
hostname $HOSTNAME
if [ -n "$IP_PUBLIC" ]; then
        ifconfig eth0 $IP_PUBLIC
fi
if [ -n "$NETMASK_PUBLIC" ]; then
        ifconfig eth0 netmask $NETMASK_PUBLIC
fi
if [ -n "$GATEWAY" ]; then
        ip route del default
        ip route add default via $GATEWAY
fi
if [ -f /mnt/context/resolv.conf ]; then
        #use cat, dont screw up file permissions or context
        cat /mnt/context/resolv.conf > /etc/resolv.conf
fi
/etc/init.d/network restart
if [ -n "$USERNAME" ]; then
        useradd $USERNAME
        echo $USER_PW | passwd --stdin $USERNAME
        if [ -f /mnt/$USER_PUBKEY ]; then
                mkdir -p /home/$USERNAME/.ssh/
                cat /mnt/$USER_PUBKEY >>
/home/$USERNAME/.ssh/authorized_keys
                chown -R $USERNAME:$USERNAME /home/$USERNAME/.ssh
                chmod -R 600 /home/$USERNAME/.ssh/authorized_keys
                chcon -R -t user_ssh_home_t
/home/$USERNAME/.ssh/authorized_keys
       fi
fi


--
André Monteiro




On Mon, Oct 15, 2012 at 2:21 PM, Kannadhasan Thangadurai <
kannadhasan.t at payoda.com> wrote:

>
> Hi Team,
>
> I have installed Opennebula 3.6 and sunstone successively on centos 6.3,
> are working in default market place image.
>
> I am trying to contextualize CentOS image, Could you please  guide me on
> this.
>
> Kindly share if you have any proper document.
>
> Thanks,
> Kannadhasan Thangadurai.
>
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20121015/0f106cc1/attachment-0002.htm>


More information about the Users mailing list