You are not logged in.

#1 2017-03-31 23:35:02

mrflibblehat
Member
Registered: 2017-03-31
Posts: 2

Dynamically changing hostname during boot & updating PS1 env variable

Hi,

I have looked at many answers to the above query have tried for quite a few hours now so I thought I would post.

I have remastered the Live ISO to fit my needs and whilst this will be booted on different computers around my workplace I need to come up with a hardware ID, to do this I have taken some dmi & hdd data, hashed them and cut the first 10 chars. This part is all working fine and I have it working using a script in /etc/profile.d/, I have also had it working as a systemd unit service in case it needed to be run earlier in the kernel. the script uses hostnamectl set-hostname and hostname -F /etc/hostname

I cant however get this to show on PS1 unless I run "exit" as soon as it auto logs into root. When I use "exec bash" still no update. I am wondering how I can get this to show on PS1? I think put exit in the .bashrc file but when it boots in I then need to ctrl+c to get back to a prompt which is correct.

Thanks for any help

Offline

Board footer

Powered by FluxBB