#!/bin/sh

cat <<EOF > /dev/hosts
#This is a ltsp chroot and this file will be rewritten in boot process
#of terminal.
127.0.0.1 localhost
EOF

rm -f /etc/hosts
ln -s ../dev/hosts /etc/hosts

cat <<EOF > /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain
/bin/grep -q "Generated by ltsp-client" /etc/hosts 2> /dev/null
if [ \$? -ne 0 ]; then
    ipaddr=\$(ip addr show scope global | awk '/[[:space:]]inet / { print gensub("/.*","","g",\$2) }')
    echo "# Generated by ltsp-client during bootup" >> /etc/hosts
    echo "127.0.0.1 localhost"      >> /etc/hosts
    echo "\$ipaddr       client-\$ipaddr" >> /etc/hosts
fi
EOF
