SliTaz SliTaz Forum

You are not logged in.

#1 2013-01-10 21:04:46

ernia
Member
Registered: 2011-05-20
Posts: 299

rolling hd install /etc/hosts

It seems to me that after an hdinstall /etc/hosts always contains

[c]127.0.0.1      localhost slitaz tazpanel[/c]

where slitaz is not always the real hostname.

would it be possible to make tazinst change /etc/hosts in the end of the install process or maybe in function users_settings(), something like sed -i 's/slitaz/realhostname/' /etc/hosts ?

thanks

Offline

#2 2013-01-10 22:17:33

mojo
Administrator
Registered: 2011-03-29
Posts: 2,174

Re: rolling hd install /etc/hosts

User must make changes to configuration template file before installation.

Install with tazpanel:

http://tazpanel:82/installer.cgi?page=install

Hostname

Set Hostname to: [c]Your hostname here[/c]

Install from console:

[c]tazinst new install.conf[/c]

vi install.conf

# Hostname

TGT_HOSTNAME="Your hostname here"

[c]# tazinst install install.conf[/c]

Offline

#3 2013-01-11 05:18:10

ernia
Member
Registered: 2011-05-20
Posts: 299

Re: rolling hd install /etc/hosts

again, thanks for your answer.

i did set hostname in install.cgi and it correctly transfers the value to tazinst:

[c]...
INSTFILE=/var/lib/tazinst.conf
...
sed -i s/"^TGT_HOSTNAME=.*"/"TGT_HOSTNAME=\"$TGT_HOSTNAME\"/" $INSTFILE[/c]
but in the ending system in the hard disk i have the correct hostname and the wrong /etc/hosts.conf .

e.g. in my hd installed system hostname is slitvaio and i had "127.0.0.1 localhost slitaz tazpanel" in /etc/hosts , which i edited to "127.0.0.1 localhost slitvaio tazpanel".

this is the reason why i think that tazinst sets only the hostname and doesn't care about /etc/hosts.

not a big problem but if i have the wrong /etc/hosts and two different slitaz system in my network, e.g. slitvaio and slitaz, slitvaio trying to ping slitaz would end in slitvaio pinging itself.

messing with slitaz's script it's a little scaring to me :-) and devs probably would fix this trivially (if it's considered to be fixed), but if devs have no time and i'm allowed i could try to fix it myself and post here results.

Offline

#4 2013-01-11 18:00:19

mojo
Administrator
Registered: 2011-03-29
Posts: 2,174

Re: rolling hd install /etc/hosts

tazinst : http://hg.slitaz.org/slitaz-tools/file/066dd36cc2cc/installer/tazinst

Line 707 => echo $TGT_HOSTNAME > etc/hostname

We can use this instead:

[c]sed -i s/slitaz/$TGT_HOSTNAME/  /etc/hosts /etc/hostname[/c]

Offline

#5 2013-01-11 18:23:56

ernia
Member
Registered: 2011-05-20
Posts: 299

Re: rolling hd install /etc/hosts

for what i can understand it should work.

i would not use the prepending slash before every etc, original command does not use it and the presence of the command cd $TARGET_ROOT in the beginning of the function at line 691 makes me feel scared to break something.

if you can push it i can do some test when new version will be available.

Offline

#6 2013-01-11 19:21:33

ernia
Member
Registered: 2011-05-20
Posts: 299

Re: rolling hd install /etc/hosts

tested editing tazinst in a livecd and installing, it works.

Offline

#7 2013-01-11 20:37:18

ernia
Member
Registered: 2011-05-20
Posts: 299

Re: rolling hd install /etc/hosts

thanks mojo

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.019 seconds, 7 queries executed - Memory usage: 1.54 MiB (Peak: 1.77 MiB) ]