puppet-standalone-mashup/skel/rename.erb

19 lines
350 B
Plaintext
Raw Normal View History

#!/bin/bash
if [ ! $UID -eq 0 ]; then
sudo $0 $1
exit
fi
echo $1 > /etc/hostname
cat /etc/hosts | sed "s#^\\(127.0.0.1\\)\\(.*\\)\$#\\1 $1 \\2#g" > /etc/hosts.tmp
mv /etc/hosts.tmp /etc/hosts
hostname $1
2012-01-18 17:29:05 +00:00
if [ -f /etc/sysconfig/network ]; then
echo -e "NETWORKING=yes\nHOSTNAME=$1\n" > /etc/sysconfig/network
fi
echo "Server renamed to $1"