source: open-sysclone/trunk/fuentes/open-sysclone-server.install/net/OpenSysClone/opensysclone-system/hostnamesaverip.sh @ 647

Last change on this file since 647 was 647, checked in by daduve, 4 years ago

Ading file

File size: 632 bytes
Line 
1#!/bin/bash
2echo
3echo
4echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
5echo "Your files /etc/hosts & /etc/hostname are generated"
6NAME_END="$(ifconfig  | grep inet | cut -d ":"  -f2 | head -1| cut -d " " -f1| cut -d "." -f4)"
7echo "client$NAME_END" > /tmp/hostname.old
8
9cat <<EOF > /tmp/hosts.old
10127.0.0.1       localhost
11127.0.1.1       _@_CLIENT_@_
12
13# The following lines are desirable for IPv6 capable hosts
14::1     ip6-localhost ip6-loopback
15fe00::0 ip6-localnet
16ff00::0 ip6-mcastprefix
17ff02::1 ip6-allnodes
18ff02::2 ip6-allrouters
19EOF
20
21sed -e "s%_@_CLIENT_@_%client$NAME_END%g" -i /tmp/hosts.old
22echo
23echo
24sleep 5
25exit 0
Note: See TracBrowser for help on using the repository browser.