The officially official Devuan Forum!

You are not logged in.

#1 2019-10-13 14:10:25

omnio
Member
Registered: 2019-07-12
Posts: 15  

Is ~/.profile ignored when running live remastered images?

Hello again,

I'm not sure where to post this but since the question I have is somehow related to remastering with refractasnapshot I'll use this section.

In short, my question is whether ignoring ~/.profile is the intended behavior while running a live image of devuan (made with refractasnapshot).

In long, this is what I did:
1. Installed devuan ascii (using the livedvd and refractainstaller).
2. Created ~/bin and placed there a couple of scripts I needed so I can execute them by just typing their name. I'm able to do that since ~/bin is in my $PATH, as ~/.profile says:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

3. Logged out, logged back in. Everything works fine so far:

omnio@devuan:~$ echo $PATH
/home/omnio/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

4. Ran refractasnapshot.
5. Booted in Virtualbox the resulted image. Everything looks fine here (my scripts are in ~/bin and ~/.profile has the lines about adding ~/bin to $PATH) but for some reason it didn't happen:

omnio@devuan:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

Any idea about this?

Thanks,
Omnio

Offline

#2 2019-10-13 23:56:47

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,486  

Re: Is ~/.profile ignored when running live remastered images?

Copy those lines to ~/.bashrc and they'll work. I don't know why. I should, and I'm sure I've read an explanation, but I don't remember it. It's been like that for as long as I can remember (maybe as far back as lenny or etch.)

Offline

#3 2019-10-14 16:09:25

chris2be8
Member
Registered: 2018-08-11
Posts: 307  

Re: Is ~/.profile ignored when running live remastered images?

From the man page for bash:

When  bash  is  invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands
from the file /etc/profile, if that file exists.  After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and  ~/.profile,  in  that
order,  and  reads  and  executes  commands  from the first one that exists and is readable.

So if there is a .bashrc on the system .profile will be ignored (unless I've misread that).

Chris

Offline

#4 2019-10-14 19:54:54

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: Is ~/.profile ignored when running live remastered images?

chris2be8 wrote:

I've misread that

^ This.

~/.profile is only ignored if ~/.bash_profile (or ~/.bash_login) is present.

Last edited by Head_on_a_Stick (2019-10-14 19:55:06)


Brianna Ghey — Rest In Power

Offline

#5 2019-10-17 08:12:25

omnio
Member
Registered: 2019-07-12
Posts: 15  

Re: Is ~/.profile ignored when running live remastered images?

Thank you very much, guys. In the end I chose another way of doing things - I placed all my stuff in /opt (mainly scripts and artwork) and symlink it from there to /usr/local/bin or wherever necessary. This may seem odd but it has this big advantage that pretty much everything I did to "alter" the system can be found in one place (/opt).

A while ago I thought it was a good way to go to create deb packages (with fpm it's fast and easy) but that would mean to re-create and re-install those packages every time I make a minor change so I gave up on that smile

Best wishes,
Omnio

Last edited by omnio (2019-10-17 08:13:32)

Offline

Board footer